Skip to content
26 changes: 19 additions & 7 deletions grails-app/taglib/org/grails/plugin/platform/ThemeTagLib.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -315,13 +315,13 @@ class ThemeTagLib {
def bodyAttrs = attrs.bodyAttrs
def bodyAttrsStr = ''
if (bodyAttrs instanceof Map) {
bodyAttrsStr = HTMLTagLib.attrsToString(bodyAttrs)
bodyAttrsStr = TagLibUtils.attrsToString(bodyAttrs)
} else if (bodyAttrs instanceof List) {
def bodyAttrsMap = [:]
bodyAttrs.each { p -> bodyAttrsMap[p] = g.pageProperty(name:'body.'+p) }
bodyAttrsStr = HTMLTagLib.attrsToString(bodyAttrsMap)
bodyAttrsStr = TagLibUtils.attrsToString(bodyAttrsMap)
}
out << "<body${bodyAttrsStr}>"
out << "<body ${bodyAttrsStr}>"
if (debugMode) {
// We need the body of the debug GSP as it has the panel in it
// @todo we can probably ditch this layoutBody if theme previewer concats to "body" zone
Expand All @@ -334,10 +334,22 @@ class ThemeTagLib {

def layoutTemplate = { attrs ->
def templateView = grailsThemes.getRequestThemeTemplateView(request, attrs.name)
if (log.debugEnabled) {
log.debug "Resolved current request's theme template for [${attrs.name}] to [${templateView}]"
// 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}]"
}
out << g.render(template:layoutTemplatePath)
} else {
if (log.debugEnabled) {
log.debug "Resolved current request's theme template for [${attrs.name}] to [${templateView}]"
}
out << g.render(template:templateView.path, plugin:templateView.plugin)
}
out << g.render(template:templateView.path, plugin:templateView.plugin)
}

def defaultContent = { attrs ->
Expand All @@ -364,4 +376,4 @@ class ThemeTagLib {
}


}
}
6 changes: 4 additions & 2 deletions grails-app/taglib/org/grails/plugin/platform/UITagLib.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ class UITagLib implements InitializingBean {
def name = attrs.name
def type = attrs.type
def value = attrs.value
def beanObject = attrs.bean
def beanObject = attrs.beanObject?: attrs.bean //leave bean for backward compatibility
def classes = attrs.remove('classes')
def i18name = name
if (!attrs.id) {
Expand All @@ -696,7 +696,9 @@ class UITagLib implements InitializingBean {
def labelCode = attrs.remove('label')
if (!labelCode && name) {
def propName = resolvePropertyName(name)
label = GrailsNameUtils.getNaturalName(propName)
label = p.text(code: "${GrailsNameUtils.getPropertyName(beanObject.getClass().simpleName)}.${propName}.label", default: '')
if(!label)
label = GrailsNameUtils.getNaturalName(propName)
}
if ((labelCode == null) && !label) {
throwTagError "A value must be provided for [label] or [name] if no custom label is provided"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class UISetDefinition {
}

for (p in pluginViewInfos) {
if (!mergedViews.find { v -> v == p}) {
if (!mergedViews.find { v -> v.name == p.name}) {
mergedViews << p
}
}
Expand Down Expand Up @@ -96,4 +96,4 @@ class UISetDefinition {
}
return v
}
}
}