History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: GRAILS-67
Type: New Feature New Feature
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Graeme Rocher
Reporter: Dierk Koenig
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Grails

shared templates

Created: 13/Mar/06 04:23 PM   Updated: 19/Apr/06 06:19 AM
Component/s: View technologies
Affects Version/s: None
Fix Version/s: 0.2

Time Tracking:
Not Specified


 Description  « Hide
currently templates as used with the render method need to reside in the same directory as the calling gsp view. This limits the area of reusability of templates.

RoR follows the following convention of shared templates ('partials'):
''''
Shared Partial Page Templates
If the :partial parameter to a render method call is a simple name, Rails
assumes that the target template is in the current controller's view directory.
However, if the name contains one or more / characters, Rails
assumes that the part up to the last slash is a directory name and the rest
is the template name. The directory is assumed to be under app/views.
This makes it easy to share partials across controllers.
The convention among Rails applications is to store these shared partials
in a subdirectory of app/views called shared. These can be rendered using
something such as
<%= render(:partial => "shared/post", :object => @article) %>
. . .
In this previous example, the @article object will be assigned to the local
variable post within the template.
''''



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Graeme Rocher - 19/Apr/06 06:19 AM
shared templates are now supported with the same rules as those defined on RoR

<g:render template="/test" model="[:]" />

Results in evaluating a template called

grails-app/views/_test.gsp