(Quick Reference)

3 Usage

Version: 1.0.0

3 Usage

Add dynamic-modules plugin to your build.gradle,

apply plugin: "org.graceframework.grace-gsp"

repositories {
    mavenCentral()
}

dependencies {
    implementation "org.graceframework.plugins:dynamic-modules:1.0.0"
}

Currently, Grace dynamic-modules plugin provides two module types,

  • WebItem

  • WebSection

app/plugins/grace/demos/MenuGrailsPlugin.groovy
class MenuGrailsPlugin extends DynamicPlugin {
    Closure doWithDynamicModules() { {->
        webSection(key: "topnav", name: "Top Navigation Bar", i18nNameKey: "top.navigation.bar")

        webItem(key: 'about', i18nNameKey: 'menu.about', name: 'About US', section: 'topnav', description: 'This is a description') {
            label(key: 'menu.about')
            link(linkId: "about_link", url: '/about')
        }
        webItem(key: 'product', i18nNameKey: 'menu.product', name: 'Products', section: 'topnav') {
            label(key: 'menu.product')
            link(linkId: 'product_link', url: '/product')
        }
        webItem(key: 'contact', i18nNameKey: 'menu.contact', name: 'Contact', section: 'topnav') {
            link(linkId: 'contact_link', url: '/contact')
        }
        webItem(key: 'help', i18nNameKey: 'menu.help', name: 'Help', section: 'topnav') {
            link(linkId: 'help_link', url: '/help')
        }
    }}
}