我正在为我需要开发的新Grails web-app测试ui和主题。
我想知道是否有可能在我的应用程序中覆盖主题区域(http://grailsrocks.github.io/grails-platform-ui/guide/creatingThemes.html#themeRequiredZones)。
我知道主题布局和ui集模板(http://grailsrocks.github.io/grails-platform-ui/guide/advanced.html#advancedOverridingThemeLayouts)是可能的。
在我的测试应用程序中,我想重写:
<theme:layoutTemplate name="header"/>
/grails-app/views/_themes/Bootstrap/_header.gsp和
<theme:layoutZone name="navigation"/>
/grails-app/views/_themes/Bootstrap/default/_navigation.gsp这是我的Config.groovy:
compile ":platform-ui:1.0.RC3"
runtime ':bootstrap-theme:1.0.RC3'
grails.plugin.location.'grails-platform-ui-scaffolding' = "../grails-platform-ui-scaffolding"发布于 2014-06-25 02:39:02
下一版本的platform-ui插件将修复此https://github.com/MerryCoders/grails-platform-ui/pull/7
同时,这里提供了一个自定义TagLib作为变通方法,至少用于layoutTemplate标记。
class OwnThemeTagLib extends org.grails.plugin.platform.ThemeTagLib {
def layoutTemplate = { attrs ->
def templateView = grailsThemes.getRequestThemeTemplateView(request, attrs.name)
// Location of app's standard content for theme layout templates
// /grails-app/views/_themes/<ThemeName>/<templateName>
def layoutTemplatePath = "/_themes/${templateView.owner}/${attrs.name}"
// First see if the application provides default content for this template
if (grailsViewFinder.templateExists(layoutTemplatePath)) {
if (log.debugEnabled) {
log.debug "Resolved current request's theme template for [${attrs.name}] to [${layoutTemplatePath}]"
}
delegate.out << g.render(template:layoutTemplatePath)
} else {
if (log.debugEnabled) {
log.debug "Resolved current request's theme template for [${attrs.name}] to [${templateView}]"
}
delegate.out << g.render(template:templateView.path, plugin:templateView.plugin)
}
}}
https://stackoverflow.com/questions/17405618
复制相似问题