最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Rails 4 - how to install "jquery-ui"? - Stack Overflow

programmeradmin2浏览0评论

For using jquery autocomplete plugin, I need to install jquery-ui gem.

So far, I had in my gemfile following:

gem 'jquery-rails'

So I added:

gem 'jquery-ui-rails'

And to application.js I added:

//= require jquery
//= require jquery_ujs
//= require jquery-ui

and to application.css:

 *= require_self
 *= require jquery.ui

bundle update, restart server and:

couldn't find file 'jquery.ui'

I am using in the app also turbolinks. Do I miss a gem something or something in order to make jquery-ui work in the app?

Thanks.

EDIT:

All jquery-related stuff in tehe Gemfile:

gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'jquery-turbolinks'

For using jquery autocomplete plugin, I need to install jquery-ui gem.

So far, I had in my gemfile following:

gem 'jquery-rails'

So I added:

gem 'jquery-ui-rails'

And to application.js I added:

//= require jquery
//= require jquery_ujs
//= require jquery-ui

and to application.css:

 *= require_self
 *= require jquery.ui

bundle update, restart server and:

couldn't find file 'jquery.ui'

I am using in the app also turbolinks. Do I miss a gem something or something in order to make jquery-ui work in the app?

Thanks.

EDIT:

All jquery-related stuff in tehe Gemfile:

gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'jquery-turbolinks'
Share Improve this question asked Jul 17, 2014 at 12:32 user984621user984621 48.5k76 gold badges233 silver badges427 bronze badges 1
  • 1 I belive that you need to require the gem in application.js like this: //= require jquery.ui or in your application.css use *= require jquery-ui – alexsmn Commented Jul 17, 2014 at 12:37
Add a comment  | 

4 Answers 4

Reset to default 6

In application.css it should be

 *= require jquery-ui

In application.js you need to add:

//= require jquery.ui.all

or for specific components e.g.

//= require jquery.ui.sortable

To update this answer, the current convention is:

//= require jquery-ui

and for css:

/*
*= require jquery-ui
*/

for specific modules:

//= require jquery-ui/draggable

See latest docs here for more configuration options

You need to describe which component you want to use. You can add

application.js

//= require jquery.ui.all

application.css

*= require jquery.ui.all

these lines for all component

发布评论

评论列表(0)

  1. 暂无评论