snimavat / nimble

Nimble Security Grails Plugin
Other
15 stars 19 forks source link

fix a bug in the admin list where sitemesh applies the layout to the ajax request #40

Closed simonckenyon closed 10 years ago

simonckenyon commented 10 years ago

to fix this, move grails-app/views/admins/list.gsp to grails-app/views/templates/admin/_admins_list.gsp and amend AdminsController accordingly.

snimavat commented 10 years ago

@simonckenyon - How does the issue reproduce ? - Admin screen seems to work okay.. does it reproduce on demo as well http://nimble.ap01.aws.af.cm/ ?

simonckenyon commented 10 years ago

by default grails will pass all render requests through grails-app/views/layout/application.gsp (unless you specify differently in the config.

so when AdminsController invokes index.gsp; in there it makes an ajax call back to list which returns the table of admin users, wheich gets passed through sitemesh.

templates are not passed through sitemesh, so my fix was to turn the render of a page into a render of a template.

i have a ayout which puts a header and footer on all pages and this appears in the list.

i would suggest that all returns from ajax should be templates. this would be consistent with the rest of the code.

the alternative (which i have just discovered in the documentation) is to add a layout: "none" to the render call for all ajax returns.

see http://jira.grails.org/browse/GRAILS-6314

snimavat commented 10 years ago

Alryt, It's not detected till now, probably because we dont have the default layout (application.gsp). I'll merge.