letsrate
letsrate copied to clipboard
it can not work after adding readOnly option
In letsrate.js.erb:
$(function(){
$(".star").raty({
score: function(){
return $(this).attr('data-rating')
},
number: function() {
return $(this).attr('data-star-count')
},
readOnly: function() {
//console.log('sss')
return false;//$(this).attr('data-readonly') == 'true'
},
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 ...
}
});
}
});
});
If I add readOnly option , no matter it is true or false, the star can not be clicked.