shorter logic for ConfigurationTagLib
authorSven Arnold <sven@zottel.(none)>
Mon, 13 Apr 2009 19:46:31 +0000 (21:46 +0200)
committerSven Arnold <sven@zottel.(none)>
Mon, 13 Apr 2009 19:46:31 +0000 (21:46 +0200)
grails-app/taglib/ConfigurationTagLib.groovy
grails-app/views/news/display.gsp

index 996f011..213f1b2 100644 (file)
@@ -5,14 +5,8 @@ class ConfigurationTagLib {
        static namespace = 'conf'
        
        def value = { attrs ->
-               def key = attrs['key']
-               def keys = []
-               key.split(/\./).each { keys.add(it) }
-               
                def prop = ConfigurationHolder.config
-               while (keys.size > 0) {
-                       prop = prop.getProperty(keys.remove(0))
-               }
+               attrs['key']?.split(/\./).each { prop = prop[it] }
                out << prop
        }
 }
index c5e7707..72f0f40 100644 (file)
@@ -3,7 +3,7 @@
 
 <head>
   <title>${pageInstance?.title}</title>
-  <meta name="layout" content="${PortalConfiguration.findByName("default").theme}"/>
+  <meta name="layout" content="${conf.value(key:'cms.theme')}.gsp"/>
 </head>
 
 <body>