tezu memo blog

日々行った作業をメモしていきます

Grails Platform Core siteNameTagの値はAppのConfig.groovyで変更

軽く苦戦したのでメモ。こんな簡単な変更に苦戦しているようでは悪戦苦闘の日々が続くのだろう、、


siteNameタグのリファレンス抜粋

Renders the name of the site. This is defined in config plugin.platformCore.site.name.

configって何だろ。サンプルコードが欲しい、、


デフォルト値はFile : PlatformCoreGrailsPlugin.groovy - Ohloh Code Searchに記述されている

    def doWithConfigOptions = {
        legacyPrefix = 'grails.plugin.platform'

        'organization.name'(type: String, defaultValue: 'My Corp (set plugin.platformCore.organization.name)')
        'site.name'(type: String, defaultValue: 'Our App (set plugin.platformCore.site.name)')


まずは、Grails Plugin: Plugin Platform CoreをインストールしたPrivate Pluginの<plugin-name>GrailsPlugin.groovyファイルに追加してみたがダメ

def doWithConfigOptions = {
    'organization.name'(type: String, defaultValue: 'My Corp (set plugin.platformCore.organization.name)')
//  'site.name'(type: String, defaultValue: 'Our App (set plugin.platformCore.site.name)')
    'site.name'(type: String, defaultValue: 'Grais EC Admin site.name')
    'plugin.platformCore.site.name'(type: String, defaultValue: 'Grais EC Admin plugin.platformCore.site.name')
    'plugin.grailsEcAdmin.site.name'(type: String, defaultValue: 'Grais EC Admin plugin.grailsEcAdmin.site.name')
}


Grails Plugin: Application Infoをインストールして変数を確認。keyにplugin.grailsEcAdminが付与されている
http://localhost:8080/<app-name>/adminManage/grailsProperties

f:id:tezu35:20130214164335j:plain

key value
plugin.grailsEcAdmin.plugin.grailsEcAdmin.site.name Grais EC Admin plugin.grailsEcAdmin.site.name
plugin.grailsEcAdmin.plugin.platformCore.site.name Grais EC Admin plugin.platformCore.site.name
plugin.grailsEcAdmin.site.name Grais EC Admin site.name
plugin.platformCore.site.name Our App (set plugin.platformCore.site.name)


続いて、Private PluginのConfig.groovyに追加。これもダメ

plugin.platformCore.site.name="Grais EC Admin"


AppのConfig.groovyに追加。これがダメだったら、もう無理

// app-info plugin
grails.plugins.dynamicController.mixins = [
    'com.burtbeckwith.grails.plugins.appinfo.IndexControllerMixin': 'com.burtbeckwith.appinfo_test.AdminManageController',
    'com.burtbeckwith.grails.plugins.appinfo.HibernateControllerMixin': 'com.burtbeckwith.appinfo_test.AdminManageController',
    'com.burtbeckwith.grails.plugins.appinfo.Log4jControllerMixin' : 'com.burtbeckwith.appinfo_test.AdminManageController',
    'com.burtbeckwith.grails.plugins.appinfo.SpringControllerMixin' : 'com.burtbeckwith.appinfo_test.AdminManageController',
    'com.burtbeckwith.grails.plugins.appinfo.MemoryControllerMixin' : 'com.burtbeckwith.appinfo_test.AdminManageController',
    'com.burtbeckwith.grails.plugins.appinfo.PropertiesControllerMixin' : 'com.burtbeckwith.appinfo_test.AdminManageController',
    'com.burtbeckwith.grails.plugins.appinfo.ScopesControllerMixin' : 'com.burtbeckwith.appinfo_test.AdminManageController'
]

plugin.platformCore.site.name="Sample Grails EC Admin"


お!value:Grais EC Adminを認識してる
f:id:tezu35:20130214165658j:plain


TOP画面を表示。footerの値も更新された!
f:id:tezu35:20130214165825j:plain