0.0
No commit activity in last 3 years
No release in over 3 years
Rate according to your mood.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 4.2
 Project Readme

SmileyRating Gem

A Ruby Gem that provides Smiley rating by using smiley-faces fonts. You can find and use these fonts from here: https://www.dafont.com/smileyface.font.

Instructions

Install

Add smiley_rating to your Gemfile:

gem 'smiley_rating', github: 'babarajay/smiley_rating'

Generate

Bundle your dependencies and run the installation generator:

bundle
bundle exec rails generate smiley_rating:install

TODO

Update your application.js:

= require jquery
= require smiley_rating.min

Update your application.css

*= require smiley_rating.min

Now add a blank division to you html template like:

<div id="smiley_rating"></div>

And add one hidden field which will provides with your rating string:

<%= f.hidden_field :rating, id: 'rating' %>

Now, add a script to generate smiley rating:

<script>
  $("#smiley_rating").smileyRating({
    target: '#rating'
  });
</script>

You can use any number of faces and different smiley-faces fonts from available URL, add class for the your font and follow the steps:

For Eg.

<script>
  $('#smiley_rating').smileyRating({
    itemCount: 3,
    smileyFaces:["smiley-face-bad","smiley-face-average","smiley-face-good"],
    hints:["Bad","Average","Good"],
    target: '#rating'
  });
</script>