Friday, 23 May 2014

HOW TO GIVE STAR RATING..... IN RUBY ON RAILS

STAR RATING IN RAILS

Simple integration of jQuery Star Rating plugin into the asset pipeline.

ADD THIS TO YOUR GEM FILE 
$gem 'jquery-star-rating-rails'
Then run, 
$bundle install 
ADD THIS TWO STATEMENTS TO YOUR LAYOUT
<%= javascript_include_tag "jquery-star-rating" %>
<%= stylesheet_link_tag "jquery-star-rating" %>  
ADD BELOW LINES TO YOUR HTML.ERB FILE 
<%= f.label :rating %><br>
  <%= f.radio_button :rating,'1',:id=>"1", :class => 'star' %> 
 <%= f.radio_button :rating,'2', :class => 'star',:id=>"1" %>
<%= f.radio_button :rating,'3', :class => 'star', :id=>"1" %> 
<%= f.radio_button :rating,'4', :class => 'star', :id=>"1" %>   
  <%= f.radio_button :rating,'5', :class => 'star', :id=>"1" %>   
 
SOURCE FROM:
http://www.fyneworks.com/jquery/star-rating/ 
 

No comments:

Post a Comment