开发者

Grails pass arguments to module using resources plugin

开发者 https://www.devze.com 2023-03-10 03:37 出处:网络
I\'m using Grails 1.3.7 and I want to use both resources plugin as well as jquery ui, the problem comes when I want to switch to a different jquery ui theme. I cannot give the theme argument.

I'm using Grails 1.3.7 and I want to use both resources plugin as well as jquery ui, the problem comes when I want to switch to a different jquery ui theme. I cannot give the theme argument.

I use this tag:

<开发者_如何学JAVAr:use module="jquery" />
<r:use module="jquery-ui" theme="smoothness" />

but doesn't work, also tried with themeCSS attribute and no effect.

Thanks.


You can override the default jquery-theme resource in your own local resources definition (like /conf/AppResources.groovy). To do that add overrides section like:

modules = {
...
    overrides {
        // this overrides the default ui-lightness theme from jquery-ui plugin
        'jquery-theme' {
            resource id:'theme', url:'/css/themes/my-theme/jquery-ui.custom.css', attrs: [media: 'screen, projection']
        }
    }
...
}

Adjust the url accordingly to point to your theme css downloaded from a ThemeRoller. Then simply use

<r:require module="jquery-ui" />

jquery-ui module depends on jquery-theme and will pull it according to your overridden definition.


I don't know why this plugin makes it so hard but anyway, if you want to change the theme you need to specify (inside of head tag):

<jqui:resources themeCss="${g.resource(dir:'/css/jquery-ui/theme/smoothness', file:'jquery-ui-1.4.4.custom.css')}" />

Than you need to place your template files (css file and also images folder) into your application css folder (web-app/css). This should work

0

精彩评论

暂无评论...
验证码 换一张
取 消