Skip to content

Instantly share code, notes, and snippets.

@sunloverz
Created April 19, 2013 11:22
Show Gist options
  • Save sunloverz/5419754 to your computer and use it in GitHub Desktop.
Save sunloverz/5419754 to your computer and use it in GitHub Desktop.
rate_path usage in project
$.fn.raty.defaults.path = "/assets";
$.fn.raty.defaults.half_show = true;
$(function(){
$(".star").raty({
score: function(){
return $(this).attr('data-rating')
},
number: function() {
return $(this).attr('data-star-count')
},
click: function(score, evt) {
$.post('<%= Rails.application.class.routes.url_helpers.rate_path %>',
{
score: score,
dimension: $(this).attr('data-dimension'),
id: $(this).attr('data-id'),
klass: $(this).attr('data-classname')
},
function(data) {
if(data) {
// success code goes here ...
}
});
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment