Skip to content

Instantly share code, notes, and snippets.

@Znow
Created May 10, 2012 19:20
Show Gist options
  • Save Znow/2655254 to your computer and use it in GitHub Desktop.
Save Znow/2655254 to your computer and use it in GitHub Desktop.
$('.personality-rating').raty({
starOff    : 'star-off.png',
starOn     : 'star-on.png',
path : '/assets/',
space : false,
width : 100,
score : $('.personality-rating').data('rating'),
click : function(score, evt) {
var url = '/admin/contractors/' + $('.rating-header').attr('id') + '/rating';
console.log('ID: ' + $(this).attr('id') + '\nscore: ' + score + '\nevent: ' + evt + '\nurl: ' + url);
$.ajax({
type: 'PUT',
url: url,
data: {
personality : score,
loyality : $('.loyality-rating').data('rating'),
skills : $('.skills-rating').data('rating'),
trustworthiness : $('.trustworthiness-rating').data('rating')
},
beforeSend: function () {
console.log(this);
},
success: function () {
//window.location = "/admin/contractors/" + this.i
}
});
}
});
$('.loyality-rating').raty({
starOff    : 'star-off.png',
starOn     : 'star-on.png',
path : '/assets/',
space : false,
width : 100,
score : $('.loyality-rating').data('rating'),
click : function(score, evt) {
var url = '/admin/contractors/' + $('.rating-header').attr('id') + '/rating';
console.log('ID: ' + $(this).attr('id') + '\nscore: ' + score + '\nevent: ' + evt + url);
$.ajax({
type: 'PUT',
url: url,
data: {
personality : $('.personality-score').data('rating'),
loyality : score,
skills : $('.skills-rating').data('rating'),
trustworthiness : $('.trustworthiness-rating').data('rating')
},
beforeSend: function () { /*console.log(this)*/ },
success: function () {
//window.location = "/admin/contractors/" + this.i
}
});
}
});
$('.skills-rating').raty({
starOff    : 'star-off.png',
starOn     : 'star-on.png',
path : '/assets/',
space : false,
width : 100,
score : $('.skills-rating').data('rating'),
click : function(score, evt) {
var url = '/admin/contractors/' + $('.rating-header').attr('id') + '/rating';
console.log('ID: ' + $(this).attr('id') + '\nscore: ' + score + '\nevent: ' + evt + url);
$.ajax({
type: 'PUT',
url: url,
data: {
personality : $('.personality-score').data('rating'),
loyality : $('.loyality-rating').data('rating'),
skills : score,
trustworthiness : $('.trustworthiness-rating').data('rating')
},
beforeSend: function () { /*console.log(this)*/ },
success: function () {
//window.location = "/admin/contractors/" + this.i
}
});
}
});
$('.trustworthiness-rating').raty({
starOff    : 'star-off.png',
starOn     : 'star-on.png',
path : '/assets/',
space : false,
width : 100,
score : $('.trustworthiness-rating').data('rating'),
click : function(score, evt) {
var url = '/admin/contractors/' + $('.rating-header').attr('id') + '/rating';
console.log('ID: ' + $(this).attr('id') + '\nscore: ' + score + '\nevent: ' + evt + url);
$.ajax({
type: 'PUT',
url: url,
data: {
personality : $('.personality-score').data('rating'),
loyality : $('.loyality-rating').data('rating'),
skills : $('.skills-rating').data('rating'),
trustworthiness : score
},
beforeSend: function () { /*console.log(this)*/ },
success: function () {
//window.location = "/admin/contractors/" + this.i
}
});
}
});
NoMethodError (undefined method `[]' for nil:NilClass):
app/controllers/admin/contractors_controller.rb:75:in `rating'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment