Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grails 2.4 Include jquery-ui

My grails application is using jquery-ui and twitter bootstrap plugin. I use the default application.js structure. Then I add the following line to include the jquery-ui and bootstrap.js :

...
//= require jquery
//= require jquery-ui
//= require bootstrap
...

The bootstrap.js in loaded properly, but the jquery-ui.js is not included.

like image 550
Julius Prayogo Avatar asked Jul 01 '14 08:07

Julius Prayogo


2 Answers

I had to use the following settings (for these versions):

grails-app/conf/BuildConfig.groovy

compile ":asset-pipeline:1.9.9"
runtime ":jquery:1.11.1"
runtime ":jquery-ui:1.10.3"

grails-app/assets/javascripts/foobar.js

//= require jquery
//= require js/jquery-ui-1.10.3.custom

grails-app/assets/stylesheets/foobar.css

/*
*= require themes/ui-lightness/jquery-ui-1.10.3.custom
*/
like image 184
Nick Grealy Avatar answered Oct 24 '22 05:10

Nick Grealy


Assuming that you are using the jquery-ui grails plugin, it is not included, because the current version has no directive file under grails-app/assets/jquery-ui. Instead it uses the web-app directory, to put the javascript files in the subfolder jquery-ui/js as you see in the sources.

In order to get jquery-ui working you have to put the following line in your directive file:

//= require jquery
//= require jquery-ui/js/jquery-ui-1.10.3.custom.min
//= require bootstrap

In bootstrap it works out of the box, because they use a directive file under grails-app/assets/javascript as you see here.

like image 27
Mario David Avatar answered Oct 24 '22 04:10

Mario David