0

I'm testing ui and themes for new Grails web-app I need to develop.

I would like to know if it's possibile to override theme zones (http://grailsrocks.github.io/grails-platform-ui/guide/creatingThemes.html#themeRequiredZones) in my app.

I know it's possible for theme layouts and ui sets templates (http://grailsrocks.github.io/grails-platform-ui/guide/advanced.html#advancedOverridingThemeLayouts).

In concrete in my test app I would like to override:

<theme:layoutTemplate name="header"/>
/grails-app/views/_themes/Bootstrap/_header.gsp

and

<theme:layoutZone name="navigation"/>
/grails-app/views/_themes/Bootstrap/default/_navigation.gsp

Here is my 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"

1 Answers1

0

Next version of platform-ui plugin will fix this https://github.com/MerryCoders/grails-platform-ui/pull/7

In the meantime here is a custom TagLib used as a workaround, at least for layoutTemplate tag.

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)    
    }
}

}