Skip to content

Commit

Permalink
Improve AdminTagLib
Browse files Browse the repository at this point in the history
  • Loading branch information
rainboyan committed Feb 3, 2024
1 parent e59314e commit b02f672
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ class AdminTagLib {
css = attrs.currentcss
}
value = StringUtils.replace(value, "[class]", css)
value = StringUtils.replace(value, "[name]", g.message(code: section?.i18nNameKey, default: section?.name))
value = StringUtils.replace(value, "[description]", g.message(code: section?.descriptionKey, default: section?.description))
value = StringUtils.replace(value, "[name]", g.message(code: section.i18nNameKey, default: section.name) ?: section.name)
value = StringUtils.replace(value, "[description]", g.message(code: section.descriptionKey, default: section.description) ?: section.description)
}
if (!justlinks) buf.append("<li class=\"nav-item\">")
if (justlinks && i > 0) buf.append(" | ")
Expand Down Expand Up @@ -130,7 +130,7 @@ class AdminTagLib {
StringBuilder buf = new StringBuilder()
sections.eachWithIndex { section, i ->
buf.append("<h6 class=\"text-black-50 text-uppercase\">")
buf.append(g.message(code: section?.i18nNameKey, default: section?.name))
buf.append(g.message(code: section.i18nNameKey, default: section.name) ?: section.name)
buf.append("</h6>")

def items = webInterfaceManager.getDisplayableItems(selectedMenuSection + '/' + section.key, [:])
Expand All @@ -140,9 +140,9 @@ class AdminTagLib {
String value = body()
if (value) {
value = StringUtils.replace(value, "[id]", item.key)
value = StringUtils.replace(value, "[name]", g.message(code: item?.webLabel?.key, default: item?.name))
value = StringUtils.replace(value, "[description]", item?.description ?: '')
value = StringUtils.replace(value, "[url]", getLinkForItemUrl(item?.link?.url))
value = StringUtils.replace(value, "[name]", g.message(code: item.webLabel?.key, default: item.name) ?: item.name)
value = StringUtils.replace(value, "[description]", item.description ?: item.name)
value = StringUtils.replace(value, "[url]", getLinkForItemUrl(item.link?.url))

def css = attrs.css
if (item.key == currentItem) {
Expand Down

0 comments on commit b02f672

Please sign in to comment.