jquery-ui-bootstrap-rails-asset
This gem packages the jQuery UI Bootstrap 1.10.2 assets (JavaScripts, stylesheets, and images) for the Rails 3.1+ asset pipeline, so you never have to download a custom package through the web interface again.
Also check out the jquery-ui-sass-rails gem, which allows you to override theme variables with Sass.
Usage
In your Gemfile, add:
gem 'jquery-ui-bootstrap-rails-asset'
Require Everything
To require all jQuery UI modules, add the following to your application.js:
//= require jquery
//= require jquery_ujs
//= require twitter/bootstrap
//= require jquery-ui-bootstrap
Also add the jQuery UI CSS to your application.css:
/*
*= require twitter/bootstrap
*= require twitter/bootstrap/responsive
*= require jquery-ui-bootstrap
*/
All images required by jQuery UI are automatically served through the asset pipeline, so you are good to go! For example, this code will add a datepicker:
$(function() {
$('.datepicker').datepicker();
});
Contributing
Setup
The jquery-ui-bootstrap-rails-asset
gem should work in Ruby 1.8.7 apps. To run the rake
tasks, you need Ruby 1.9 however.
git clone git://github.com/applicat/jquery-ui-bootstrap-rails-asset.git
cd jquery-ui-bootstrap-rails-asset
git submodule update --init
bundle install
bundle exec rake # rebuild assets
Most of the code lives in the Rakefile
. Pull requests are more than welcome!
Hacking jQuery UI
The jquery-ui-bootstrap-rails-asset repository is contributor-friendly and has a git submodule containing the official jquery-ui-bootstrap. This way it's easy to hack the jQuery UI Bootstrap code:
cd jquery-ui-bootstrap
git checkout master
... hack-hack-hack ...
bundle exec rake # rebuild assets based on your changes
Assuming your app's Gemfile points at your jquery-ui-bootstrap-rails-asset checkout (gem
'jquery-ui-bootstrap-rails-asset', :path => '~/path/to/jquery-ui-bootstrap-rails-asset'
), all you need to do
now is refresh your browser, and your changes to jQuery UI are live in your
Rails application.
Testing
As a smoke test, a dummy
application is available in the repository under the spec directory, which
displays a check mark and a datepicker to make sure the assets load correctly:
cd spec/dummy
bundle
rails s
Now point your browser at http://localhost:3000/.