Rails wrapper for the jQuery RateIt plugin with improved SVG images!
Add this line to your application's Gemfile:
gem 'rails-rateit', '~> 1.0.22', github: 'berikin/rails-rateit'
and run bundle install
.
Or install it yourself as:
gem install rails-rateit
In your application.css
, include the css file:
/*
*= require rateit
*/
In your application.js
, include the js file:
//= require jquery.rateit
Or simply use the javascript and stylesheet generator:
rails generate rateit:install
In you view, use the rateit_tag helper :
<%= number_field_tag(:rating, nil, {min: 0, max: 4, step: 1, id: "my_object_rating"}) %>
<%= rateit(extra: {:"data-foo" => "bar"}, type: "div", backingfld: "#my_object_rating", max: 4, min: 0, step: 1, resetable: "false") %>
<%= number_field_tag(:rating, 4, {min: 0, max: 10, step: 1, id: "my_object_rating2"}) %>
<%= rateit(type: "span", backingfld: "#my_object_rating2", max: 10, min: 0, step: 0.5, resetable: "true", value: "2", ispreset: "true") %>
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request