How do I add jquery-ui to a Ruby on Rails 3.1 app?

后端 未结 8 1147
滥情空心
滥情空心 2020-12-17 10:31

I have added //=require jquery-ui to my application.js file and that seems to give me the javascript but I can\'t seem to get the stylesheets to be included. If

相关标签:
8条回答
  • 2020-12-17 11:15

    quote from the jquery-rails manual:

    In order to use the themed parts of jQuery UI, you will also need to supply your own theme CSS. See jqueryui.com for more information.

    So, you have to include or style them yourself! Just include the theme's .css in the header of your page. In Rails 3 you'd put the css in public/stylesheets, don't know for Rails 3.1.

    0 讨论(0)
  • 2020-12-17 11:23

    If you have jquery-rails on Gemfile, just do:

    //= require jquery-ui
    

    or

    //= require jquery-ui.min
    

    both will work fine. If not, try to update jquery-rails gem

    Don't forget the css files, here I followed some articles on that other answer: Ruby on Rails 3.1 and jQuery UI images and got it working by this way:

    *= require jquery-ui/jquery-ui.css
    

    this is the path for files:

    vendor/assets/stylesheets/jquery-ui/jquery-ui.css 
    vendor/assets/images/jquery-ui/images/ (your theme images)
    
    0 讨论(0)
提交回复
热议问题