jquery-star-rating-rails 0.0.1 → 4.0.4
Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown
CHANGED
File without changes
|
File without changes
|
@@ -1,11 +1,9 @@
|
|
1
1
|
/*
|
2
|
-
### jQuery Star Rating Plugin
|
2
|
+
### jQuery Star Rating Plugin v4.04 - 2013-03-04 ###
|
3
3
|
* Home: http://www.fyneworks.com/jquery/star-rating/
|
4
4
|
* Code: http://code.google.com/p/jquery-star-rating-plugin/
|
5
5
|
*
|
6
|
-
*
|
7
|
-
* http://www.opensource.org/licenses/mit-license.php
|
8
|
-
* http://www.gnu.org/licenses/gpl.html
|
6
|
+
* Licensed under http://en.wikipedia.org/wiki/MIT_License
|
9
7
|
###
|
10
8
|
*/
|
11
9
|
|
@@ -14,7 +12,7 @@
|
|
14
12
|
/*# AVOID COLLISIONS #*/
|
15
13
|
|
16
14
|
// IE6 Background Image Fix
|
17
|
-
if (
|
15
|
+
if ((!$.support.opacity && !$.support.style)) try { document.execCommand("BackgroundImageCache", false, true)} catch(e) { };
|
18
16
|
// Thanks to http://www.visualjquery.com/rating/rating_redux.html
|
19
17
|
|
20
18
|
// plugin initialization
|
@@ -73,7 +71,7 @@
|
|
73
71
|
else{
|
74
72
|
// create new control if first star or control element was removed/replaced
|
75
73
|
|
76
|
-
// Initialize options for this
|
74
|
+
// Initialize options for this rater
|
77
75
|
control = $.extend(
|
78
76
|
{}/* new object */,
|
79
77
|
options || {} /* current call options */,
|
@@ -92,7 +90,10 @@
|
|
92
90
|
rater.addClass('rating-to-be-drawn');
|
93
91
|
|
94
92
|
// Accept readOnly setting from 'disabled' property
|
95
|
-
if(input.attr('disabled')) control.readOnly = true;
|
93
|
+
if(input.attr('disabled') || input.hasClass('disabled')) control.readOnly = true;
|
94
|
+
|
95
|
+
// Accept required setting from class property (class='required')
|
96
|
+
if(input.hasClass('required')) control.required = true;
|
96
97
|
|
97
98
|
// Create 'cancel' button
|
98
99
|
rater.append(
|
@@ -115,8 +116,8 @@
|
|
115
116
|
|
116
117
|
}; // first element of group
|
117
118
|
|
118
|
-
// insert rating star
|
119
|
-
var star = $('<div class="star-rating rater-'+ control.serial +'"><a title="' + (this.title || this.value) + '">' + this.value + '</a></div>');
|
119
|
+
// insert rating star (thanks Jan Fanslau rev125 for blind support https://code.google.com/p/jquery-star-rating-plugin/issues/detail?id=125)
|
120
|
+
var star = $('<div role="text" aria-label="'+ this.title +'" class="star-rating rater-'+ control.serial +'"><a title="' + (this.title || this.value) + '">' + this.value + '</a></div>');
|
120
121
|
rater.append(star);
|
121
122
|
|
122
123
|
// inherit attributes from input element
|
@@ -164,6 +165,12 @@
|
|
164
165
|
// set current selection
|
165
166
|
if(this.checked) control.current = star;
|
166
167
|
|
168
|
+
// set current select for links
|
169
|
+
if(this.nodeName=="A"){
|
170
|
+
if($(this).hasClass('selected'))
|
171
|
+
control.current = star;
|
172
|
+
};
|
173
|
+
|
167
174
|
// hide input element
|
168
175
|
input.hide();
|
169
176
|
|
@@ -244,7 +251,7 @@
|
|
244
251
|
this.rating('drain');
|
245
252
|
// Set control value
|
246
253
|
if(control.current){
|
247
|
-
control.current.data('rating.input').attr('checked','checked');
|
254
|
+
control.current.data('rating.input').attr('checked','checked').prop('checked',true);
|
248
255
|
control.current.prevAll().andSelf().filter('.rater-'+ control.serial).addClass('star-rating-on');
|
249
256
|
}
|
250
257
|
else
|
@@ -260,57 +267,44 @@
|
|
260
267
|
|
261
268
|
|
262
269
|
select: function(value,wantCallBack){ // select a value
|
263
|
-
|
264
|
-
// ***** MODIFICATION *****
|
265
|
-
// Thanks to faivre.thomas - http://code.google.com/p/jquery-star-rating-plugin/issues/detail?id=27
|
266
|
-
//
|
267
|
-
// ***** LIST OF MODIFICATION *****
|
268
|
-
// ***** added Parameter wantCallBack : false if you don't want a callback. true or undefined if you want postback to be performed at the end of this method'
|
269
|
-
// ***** recursive calls to this method were like : ... .rating('select') it's now like .rating('select',undefined,wantCallBack); (parameters are set.)
|
270
|
-
// ***** line which is calling callback
|
271
|
-
// ***** /LIST OF MODIFICATION *****
|
272
|
-
|
273
270
|
var control = this.data('rating'); if(!control) return this;
|
274
271
|
// do not execute when control is in read-only mode
|
275
272
|
if(control.readOnly) return;
|
276
273
|
// clear selection
|
277
274
|
control.current = null;
|
278
275
|
// programmatically (based on user input)
|
279
|
-
if(typeof value!='undefined'){
|
276
|
+
if(typeof value!='undefined' || this.length>1){
|
280
277
|
// select by index (0 based)
|
281
278
|
if(typeof value=='number')
|
282
279
|
return $(control.stars[value]).rating('select',undefined,wantCallBack);
|
283
280
|
// select by literal value (must be passed as a string
|
284
|
-
if(typeof value=='string')
|
281
|
+
if(typeof value=='string'){
|
285
282
|
//return
|
286
283
|
$.each(control.stars, function(){
|
284
|
+
//console.log($(this).data('rating.input'), $(this).data('rating.input').val(), value, $(this).data('rating.input').val()==value?'BINGO!':'');
|
287
285
|
if($(this).data('rating.input').val()==value) $(this).rating('select',undefined,wantCallBack);
|
288
286
|
});
|
287
|
+
// don't break the chain
|
288
|
+
return this;
|
289
|
+
};
|
289
290
|
}
|
290
|
-
else
|
291
|
+
else{
|
291
292
|
control.current = this[0].tagName=='INPUT' ?
|
292
293
|
this.data('rating.star') :
|
293
294
|
(this.is('.rater-'+ control.serial) ? this : null);
|
294
|
-
|
295
|
+
};
|
295
296
|
// Update rating control state
|
296
297
|
this.data('rating', control);
|
297
298
|
// Update display
|
298
299
|
this.rating('draw');
|
299
300
|
// find data for event
|
300
301
|
var input = $( control.current ? control.current.data('rating.input') : null );
|
302
|
+
// change selection - required since 1.9, see http://code.google.com/p/jquery-star-rating-plugin/issues/detail?id=123
|
303
|
+
if(input.length) input.attr('checked','checked')[0].checked=true;
|
301
304
|
// click callback, as requested here: http://plugins.jquery.com/node/1655
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
//
|
306
|
-
//old line doing the callback :
|
307
|
-
//if(control.callback) control.callback.apply(input[0], [input.val(), $('a', control.current)[0]]);// callback event
|
308
|
-
//
|
309
|
-
//new line doing the callback (if i want :)
|
310
|
-
if((wantCallBack ||wantCallBack == undefined) && control.callback) control.callback.apply(input[0], [input.val(), $('a', control.current)[0]]);// callback event
|
311
|
-
//to ensure retro-compatibility, wantCallBack must be considered as true by default
|
312
|
-
// **** /MODIFICATION *****
|
313
|
-
|
305
|
+
if((wantCallBack ||wantCallBack == undefined) && control.callback) control.callback.apply(input[0], [input.val(), $('a', control.current)[0]]);// callback event
|
306
|
+
// don't break the chain
|
307
|
+
return this;
|
314
308
|
},// $.fn.rating.select
|
315
309
|
|
316
310
|
|
@@ -367,15 +361,11 @@
|
|
367
361
|
|
368
362
|
/*--------------------------------------------------------*/
|
369
363
|
|
370
|
-
/*
|
371
|
-
### Default implementation ###
|
372
|
-
The plugin will attach itself to file inputs
|
373
|
-
with the class 'multi' when the page loads
|
374
|
-
*/
|
375
|
-
$(function(){
|
376
|
-
$('input[type=radio].star').rating();
|
377
|
-
});
|
378
364
|
|
365
|
+
// auto-initialize plugin
|
366
|
+
$(function(){
|
367
|
+
$('input[type=radio].star').rating();
|
368
|
+
});
|
379
369
|
|
380
370
|
|
381
371
|
/*# AVOID COLLISIONS #*/
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/* jQuery.Rating Plugin CSS - http://www.fyneworks.com/jquery/star-rating/ */
|
2
2
|
div.rating-cancel,div.star-rating{float:left;width:17px;height:15px;text-indent:-999em;cursor:pointer;display:block;background:transparent;overflow:hidden}
|
3
|
-
div.rating-cancel,div.rating-cancel a{background:
|
4
|
-
div.star-rating,div.star-rating a{background:
|
3
|
+
div.rating-cancel,div.rating-cancel a{background:url(<%= asset_path 'delete.gif' %>) no-repeat 0 -16px}
|
4
|
+
div.star-rating,div.star-rating a{background:url(<%= asset_path 'star.gif' %>) no-repeat 0 0px}
|
5
5
|
div.rating-cancel a,div.star-rating a{display:block;width:16px;height:100%;background-position:0 0px;border:0}
|
6
6
|
div.star-rating-on a{background-position:0 -16px!important}
|
7
7
|
div.star-rating-hover a{background-position:0 -32px}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jquery-star-rating-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-03-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,12 @@ dependencies:
|
|
21
21
|
version: 3.1.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.1.0
|
25
30
|
description: This gem provides the star rating jQuery plugin from fyneworks to your
|
26
31
|
Rails 3.1 and above applications.
|
27
32
|
email:
|
@@ -65,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
65
70
|
version: '0'
|
66
71
|
requirements: []
|
67
72
|
rubyforge_project: jquery-star-rating-rails
|
68
|
-
rubygems_version: 1.8.
|
73
|
+
rubygems_version: 1.8.23
|
69
74
|
signing_key:
|
70
75
|
specification_version: 3
|
71
76
|
summary: Use jQuery star rating from fyneworks with Rails 3.1
|