Details
-
Type:
New Feature
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 0.2
-
Component/s: View technologies
-
Labels:None
Description
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.
''''
Activity
- All
- Comments
- Work Log
- History
- Activity
- Git Commits
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