Details
-
Type:
Improvement
-
Status:
Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: 1.0-RC3
-
Fix Version/s: 3.0
-
Component/s: View technologies
-
Labels:None
Description
It appears that the path for unqualified template names corresponds to the calling controller, not the including view. That is, if a tag like:
<g:render template="footer" />
is included in the view shared/index.gsp which is being rendered by, say, the UserController with a call like:
render(view:'/shared/index')
Then grails looks for _footer.gsp in views/user, not views/shared. It seems strange for the behavior of the render tag and the view to depend on which controller is using it. It makes it harder to create a modular set of views, as they need to include hardcoded paths to their own location; e.g., shared/index.gsp would contain:
<g:render template="/shared/footer" />
This makes it more difficult to move the views (e.g. from "shared" to "admin"), as these hard-coded paths need to be changed.
-
Hide
- template-search-path.zip
- 27/Dec/07 4:03 PM
- 208 kB
- David A. Mellis
-
- template-search-path/.classpath 6 kB
- template-search-path/.project 0.5 kB
- template-search-path/application.properties 0.1 kB
- __MACOSX/.../._application.properties 0.2 kB
- template-search-path/build.xml 1 kB
- template-search-path/.../BootStrap.groovy 0.1 kB
- template-search-path/.../Config.groovy 4 kB
- template-search-path/.../DataSource.groovy 0.6 kB
- template-search-path/.../resources.xml 0.3 kB
- template-search-path/.../UrlMappings.groovy 0.2 kB
- template-search-path/.../TestController.groovy 0.1 kB
- __MACOSX/.../._TestController.groovy 0.2 kB
- template-search-path/.../messages.properties 2 kB
- template-search-path/.../messages_de.properties 3 kB
- template-search-path/.../messages_es.properties 3 kB
- template-search-path/.../messages_fr.properties 2 kB
- template-search-path/.../messages_it.properties 2 kB
- template-search-path/.../messages_ja.properties 2 kB
- template-search-path/.../messages_nl.properties 3 kB
- template-search-path/.../messages_ru.properties 4 kB
- template-search-path/.../messages_th.properties 5 kB
- template-search-path/.../messages_zh_CN.properties 2 kB
- template-search-path/.../error.gsp 1 kB
- template-search-path/grails-app/.../main.gsp 0.7 kB
- template-search-path/.../_footer.gsp 0.0 kB
- __MACOSX/.../.__footer.gsp 0.2 kB
- template-search-path/.../index.gsp 0.0 kB
- __MACOSX/.../._index.gsp 0.2 kB
- template-search-path/stacktrace.log 111 kB
- template-search-path/template-search-path.launch 2 kB
Activity
- All
- Comments
- Work Log
- History
- Activity
- Git Commits
I think this would be a fairly significant breaking change, so it's best to aim for 2.0 with this.
A simple grails application demonstrating the problem.