Code Monkey home page Code Monkey logo

jquery-star-rating-rails's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

jquery-star-rating-rails's Issues

Additional Documentation?

I'd like to use this potentially, but the documentation doesn't really seem to be there... and I'm pretty terrible at figuring such out from the code alone... any tips to getting started? If I have Users and I have Products, I'd like Users to be able to leave ratings on Products for example...

Need to refresh(reload) a page to display rating stars

I created a very simple application to see how it works. The problem I could see is that every time I have to reload a page to display rating stars, if not, the radio buttons are displayed instead.

Here is my versions:

  • Rails 4.0.0
  • ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.3.0]
  • gem 'jquery-star-rating-rails', '~> 4.0.4'

Here is how ratings are declared in the view:

<%= form_for(@user) do |f| %>
  <% if @user.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>

      <ul>
      <% @user.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <div class="field">
    <%= f.label :name %><br>
    <%= f.text_field :name %>
  </div>
  <div class="field">
    <%= f.label :experience %><br>
    <% User.notation_range.each do |star| %>
      <%= f.radio_button :experience, star, {class: "star" } %>

    <% end %>

  </div>
  <div class="actions">
    <%= f.submit %>
  </div>
<% end %>

User model:

class User < ActiveRecord::Base

  def self.notation_range
      (0..5)
  end
end    

Declarations of query-star_rating js (application.js)

//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require jquery-star-rating
//= require_tree . 

Declarations of query-star_rating css (application.css):

 *= require_self 
 *= require jquery-star-rating
 *= require_tree .
 */        

All the stuff was generated by a simple scaffold generator, so there is nothing special.
Any idea ? Thnx.

jquery 1.9

Hi RichGuk,

As the plugin is using $.browser, there is a bug with jquery 1.9, could you update ?

Improve usage in README

Can you please improve the Usage area in the Readme file?

I believe for Rails 3.1 by default it uses Coffeescript and SCSS.

For example, if our controller is called Projects:

In projects.js.coffee, add the line
//= require jquery-star-rating

In projects.css.scss, add the line
/*
*= require jquery-star-rating
*/

In our view (e.g. new.html.erb) add the "star" class to your radio buttons:
<%= f.label :rating, "Rating" %>
<%= f.radio_button :rating, "1", :class => "star" %>
<%= f.radio_button :rating, "2", :class => "star" %>
<%= f.radio_button :rating, "3", :class => "star" %>
<%= f.radio_button :rating, "4", :class => "star" %>
<%= f.radio_button :rating, "5", :class => "star" %>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.