Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for using bodyAttrs in theme:body tag #10

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 Down Expand Up @@ -364,4 +364,4 @@ class ThemeTagLib {
}


}
}
4 changes: 3 additions & 1 deletion grails-app/taglib/org/grails/plugin/platform/UITagLib.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}