Reputation: 167
I used this command to install gems for my rails project
and I added following in application.js
require jquery-ui
require jquery-colorpicker
This gave error:
could not find file 'jquery-colorpicker'
this is the code for items/new.js.erb
$('#dialog h3').html("<i class='glyphicon glyphicon-plus'></i> Add New Item");
$('.modal-body').html('<%= j render("form") %>');
$('#dialog').modal("show");
$('#dialog').on('shown.bs.modal', function () {
# $('.colorpicker').focus()
$('.colorpicker').colorpicker {autoOpen:true, hideOn:'button'}
})
Upvotes: 0
Views: 1572
Reputation: 171
Add following to your Gemfile:
gem 'jquery-ui-rails'
gem 'jquery-colorpicker-rails'
Add following to application.js
//= require jquery-ui
//= require jquery-colorpicker
Hope, this helps!
Also, there is another gem jquery-minicolors-rails
which embeds the jQuery colorpicker in the Rails asset pipeline. See: https://github.com/kostia/jquery-minicolors-rails
Upvotes: 1
Reputation: 327
You need to include the gem itself into the gemfile.
Using gem install colorpicker will only install it on your local machine.
Upvotes: 0