rateyo-rails 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +47 -0
- data/Rakefile +1 -0
- data/app/assets/javascripts/jquery.rateyo.js +1062 -0
- data/app/assets/stylesheets/jquery.rateyo.css +37 -0
- data/lib/card-rails.rb +1 -0
- data/lib/rateyo/rails.rb +7 -0
- data/lib/rateyo/rails/engine.rb +6 -0
- data/lib/rateyo/rails/version.rb +5 -0
- data/rateyo-rails.gemspec +20 -0
- metadata +56 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: acdb11643b88d00abd40e8e779b945a9de7a7f53
|
4
|
+
data.tar.gz: 29a0136a91f8874da97e042f62c3c76479e767c0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0825f17078b7925cc29b7856dd25e93541dbc93a102f50a568792edac9398f3196573fbaf6629d7d5c93085165565b4612178df656b85385ef94aa9e72ed5ac1
|
7
|
+
data.tar.gz: 4436b40873d3951b3c612ddfc1213b3171a2ddf263fa891f4a26f8192b1859a692ff1280b63b0f842eeae9d08e18ca128542069f4b3a75cfe52cf19d21741af6
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 prashanth pamidi
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# rateYo
|
2
|
+
|
3
|
+
Rails asset pipeline integration for [rateYo](https://github.com/prrashi/rateYo)
|
4
|
+
|
5
|
+
rateYo version `2.1.1`
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'rateyo-rails'
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install rateyo-rails
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
rateyo-rails contains both css and js for rateyo
|
24
|
+
|
25
|
+
Include rateyo js in app/assets/javascripts/application.js
|
26
|
+
|
27
|
+
```javascript
|
28
|
+
//= require jquery.rateyo
|
29
|
+
```
|
30
|
+
|
31
|
+
Include card css in app/assets/stylesheets/application.css
|
32
|
+
|
33
|
+
```css
|
34
|
+
/*
|
35
|
+
*= require jquery.rateyo
|
36
|
+
*/
|
37
|
+
```
|
38
|
+
|
39
|
+
For information on how to use rateyo please visit [https://github.com/prrashi/rateYo](https://github.com/prrashi/rateYo)
|
40
|
+
|
41
|
+
## Contributing
|
42
|
+
|
43
|
+
1. Fork it
|
44
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
45
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
46
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
47
|
+
5. Create new pull request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,1062 @@
|
|
1
|
+
/*****
|
2
|
+
* rateYo - v2.1.1
|
3
|
+
* http://prrashi.github.io/rateyo/
|
4
|
+
* Copyright (c) 2014 Prashanth Pamidi; Licensed MIT
|
5
|
+
*****/
|
6
|
+
|
7
|
+
;(function ($) {
|
8
|
+
"use strict";
|
9
|
+
|
10
|
+
// The basic svg string required to generate stars
|
11
|
+
var BASICSTAR = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"+
|
12
|
+
"<svg version=\"1.1\""+
|
13
|
+
"xmlns=\"http://www.w3.org/2000/svg\""+
|
14
|
+
"viewBox=\"0 12.705 512 486.59\""+
|
15
|
+
"x=\"0px\" y=\"0px\""+
|
16
|
+
"xml:space=\"preserve\">"+
|
17
|
+
"<polygon "+
|
18
|
+
"points=\"256.814,12.705 317.205,198.566"+
|
19
|
+
" 512.631,198.566 354.529,313.435 "+
|
20
|
+
"414.918,499.295 256.814,384.427 "+
|
21
|
+
"98.713,499.295 159.102,313.435 "+
|
22
|
+
"1,198.566 196.426,198.566 \"/>"+
|
23
|
+
"</svg>";
|
24
|
+
|
25
|
+
// The Default values of different options available in the Plugin
|
26
|
+
var DEFAULTS = {
|
27
|
+
|
28
|
+
starWidth : "32px",
|
29
|
+
normalFill: "gray",
|
30
|
+
ratedFill : "#f39c12",
|
31
|
+
numStars : 5,
|
32
|
+
maxValue : 5,
|
33
|
+
precision : 1,
|
34
|
+
rating : 0,
|
35
|
+
fullStar : false,
|
36
|
+
halfStar : false,
|
37
|
+
readOnly : false,
|
38
|
+
spacing : "0px",
|
39
|
+
multiColor: null,
|
40
|
+
onInit : null,
|
41
|
+
onChange : null,
|
42
|
+
onSet : null
|
43
|
+
};
|
44
|
+
|
45
|
+
//Default colors for multi-color rating
|
46
|
+
var MULTICOLOR_OPTIONS = {
|
47
|
+
|
48
|
+
startColor: "#c0392b", //red
|
49
|
+
endColor : "#f1c40f" //yellow
|
50
|
+
};
|
51
|
+
|
52
|
+
function checkPrecision (value, minValue, maxValue) {
|
53
|
+
|
54
|
+
/*
|
55
|
+
* This function removes the unnecessary precision, at Min and Max Values
|
56
|
+
*/
|
57
|
+
|
58
|
+
// Its like comparing 0.0 with 0, which is true
|
59
|
+
if (value === minValue) {
|
60
|
+
|
61
|
+
value = minValue;
|
62
|
+
}
|
63
|
+
else if(value === maxValue) {
|
64
|
+
|
65
|
+
value = maxValue;
|
66
|
+
}
|
67
|
+
|
68
|
+
return value;
|
69
|
+
}
|
70
|
+
|
71
|
+
function checkBounds (value, minValue, maxValue) {
|
72
|
+
|
73
|
+
/*
|
74
|
+
* Check if the value is between min and max values, if not, throw an error
|
75
|
+
*/
|
76
|
+
|
77
|
+
var isValid = value >= minValue && value <= maxValue;
|
78
|
+
|
79
|
+
if(!isValid){
|
80
|
+
|
81
|
+
throw Error("Invalid Rating, expected value between "+ minValue +
|
82
|
+
" and " + maxValue);
|
83
|
+
}
|
84
|
+
|
85
|
+
return value;
|
86
|
+
}
|
87
|
+
|
88
|
+
function isDefined(value) {
|
89
|
+
|
90
|
+
// Better way to check if a variable is defined or not
|
91
|
+
return typeof value !== "undefined";
|
92
|
+
}
|
93
|
+
|
94
|
+
// Regex to match Colors in Hex Format like #FF00FF
|
95
|
+
var hexRegex = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i;
|
96
|
+
|
97
|
+
var hexToRGB = function (hex) {
|
98
|
+
|
99
|
+
/*
|
100
|
+
* Extracts and returns the Red, Blue, Green Channel values,
|
101
|
+
* in the form of decimals
|
102
|
+
*/
|
103
|
+
|
104
|
+
if (!hexRegex.test(hex)) {
|
105
|
+
|
106
|
+
return null;
|
107
|
+
}
|
108
|
+
|
109
|
+
var hexValues = hexRegex.exec(hex),
|
110
|
+
r = parseInt(hexValues[1], 16),
|
111
|
+
g = parseInt(hexValues[2], 16),
|
112
|
+
b = parseInt(hexValues[3], 16);
|
113
|
+
|
114
|
+
return {r:r, g:g, b:b};
|
115
|
+
};
|
116
|
+
|
117
|
+
function getChannelValue(startVal, endVal, percent) {
|
118
|
+
|
119
|
+
/*
|
120
|
+
* Returns a value between `startVal` and `endVal` based on the percent
|
121
|
+
*/
|
122
|
+
|
123
|
+
var newVal = (endVal - startVal)*(percent/100);
|
124
|
+
|
125
|
+
newVal = Math.round(startVal + newVal).toString(16);
|
126
|
+
|
127
|
+
if (newVal.length === 1) {
|
128
|
+
|
129
|
+
newVal = "0" + newVal;
|
130
|
+
}
|
131
|
+
|
132
|
+
return newVal;
|
133
|
+
}
|
134
|
+
|
135
|
+
function getColor (startColor, endColor, percent) {
|
136
|
+
|
137
|
+
/*
|
138
|
+
* Given the percentage( `percent` ) of `endColor` to be mixed
|
139
|
+
* with the `startColor`, returns the mixed color.
|
140
|
+
* Colors should be only in Hex Format
|
141
|
+
*/
|
142
|
+
|
143
|
+
if (!startColor || !endColor) {
|
144
|
+
|
145
|
+
return null;
|
146
|
+
}
|
147
|
+
|
148
|
+
percent = isDefined(percent)? percent : 0;
|
149
|
+
|
150
|
+
startColor = hexToRGB(startColor);
|
151
|
+
endColor = hexToRGB(endColor);
|
152
|
+
|
153
|
+
var r = getChannelValue(startColor.r, endColor.r, percent),
|
154
|
+
b = getChannelValue(startColor.b, endColor.b, percent),
|
155
|
+
g = getChannelValue(startColor.g, endColor.g, percent);
|
156
|
+
|
157
|
+
return "#" + r + g + b;
|
158
|
+
}
|
159
|
+
|
160
|
+
function RateYo ($node, options) {
|
161
|
+
|
162
|
+
/*
|
163
|
+
* The Contructor, whose instances are used by plugin itself
|
164
|
+
*/
|
165
|
+
|
166
|
+
// Storing the HTML element as a property, for future access
|
167
|
+
this.node = $node.get(0);
|
168
|
+
|
169
|
+
var that = this;
|
170
|
+
|
171
|
+
// Remove any stuff that is present inside the container, and add the plugin class
|
172
|
+
$node.empty().addClass("jq-ry-container");
|
173
|
+
|
174
|
+
/*
|
175
|
+
* Basically the plugin displays the rating using two rows of stars lying one above
|
176
|
+
* the other, the row that is on the top represents the actual rating, and the one
|
177
|
+
* behind acts just like a background.
|
178
|
+
*
|
179
|
+
* `$groupWrapper`: is an element that wraps both the rows
|
180
|
+
* `$normalGroup`: is the container for row of stars thats behind and
|
181
|
+
* acts as background
|
182
|
+
* `$ratedGroup`: is the container for row of stars that display the actual rating.
|
183
|
+
*
|
184
|
+
* The rating is displayed by adjusting the width of `$ratedGroup`
|
185
|
+
*/
|
186
|
+
var $groupWrapper = $("<div/>").addClass("jq-ry-group-wrapper")
|
187
|
+
.appendTo($node);
|
188
|
+
|
189
|
+
var $normalGroup = $("<div/>").addClass("jq-ry-normal-group")
|
190
|
+
.addClass("jq-ry-group")
|
191
|
+
.appendTo($groupWrapper);
|
192
|
+
|
193
|
+
var $ratedGroup = $("<div/>").addClass("jq-ry-rated-group")
|
194
|
+
.addClass("jq-ry-group")
|
195
|
+
.appendTo($groupWrapper);
|
196
|
+
|
197
|
+
/*
|
198
|
+
* Variable `step`: store the value of the rating for each star
|
199
|
+
* eg: if `maxValue` is 5 and `numStars` is 5, value of each star
|
200
|
+
* is 1.
|
201
|
+
* Variable `starWidth`: stores the decimal value of width of star in units of px
|
202
|
+
* Variable `percentOfStar`: stores the percentage of width each star takes w.r.t
|
203
|
+
* the container
|
204
|
+
* Variable `spacing`: stores the decimal value of the spacing between stars
|
205
|
+
* in the units of px
|
206
|
+
* Variable `percentOfSpacing`: stores the percentage of width of the spacing
|
207
|
+
* between stars w.r.t the container
|
208
|
+
*/
|
209
|
+
var step, starWidth, percentOfStar, spacing,
|
210
|
+
percentOfSpacing, containerWidth, minValue = 0;
|
211
|
+
|
212
|
+
/*
|
213
|
+
* `currentRating` contains rating that is being displayed at the latest point of
|
214
|
+
* time.
|
215
|
+
*
|
216
|
+
* When ever you hover over the plugin UI, the rating value changes
|
217
|
+
* according to the place where you point the cursor, currentRating contains
|
218
|
+
* the current value of rating that is being shown in the UI
|
219
|
+
*/
|
220
|
+
var currentRating = options.rating;
|
221
|
+
|
222
|
+
// A flag to store if the plugin is already being displayed in the UI
|
223
|
+
var isInitialized = false;
|
224
|
+
|
225
|
+
function showRating (ratingVal) {
|
226
|
+
|
227
|
+
/*
|
228
|
+
* The function is responsible for displaying the rating by changing
|
229
|
+
* the width of `$ratedGroup`
|
230
|
+
*/
|
231
|
+
|
232
|
+
if (!isDefined(ratingVal)) {
|
233
|
+
|
234
|
+
ratingVal = options.rating;
|
235
|
+
}
|
236
|
+
|
237
|
+
// Storing the value that is being shown in `currentRating`.
|
238
|
+
currentRating = ratingVal;
|
239
|
+
|
240
|
+
var numStarsToShow = ratingVal/step;
|
241
|
+
|
242
|
+
// calculating the percentage of width of $ratedGroup with respect to its parent
|
243
|
+
var percent = numStarsToShow*percentOfStar;
|
244
|
+
|
245
|
+
if (numStarsToShow > 1) {
|
246
|
+
|
247
|
+
// adding the percentage of space that is taken by the gap the stars
|
248
|
+
percent += (Math.ceil(numStarsToShow) - 1)*percentOfSpacing;
|
249
|
+
}
|
250
|
+
|
251
|
+
setRatedFill(options.ratedFill);
|
252
|
+
|
253
|
+
$ratedGroup.css("width", percent + "%");
|
254
|
+
}
|
255
|
+
|
256
|
+
function setContainerWidth () {
|
257
|
+
|
258
|
+
/*
|
259
|
+
* Set the width of the `this.node` based on the width of each star and
|
260
|
+
* the space between them
|
261
|
+
*/
|
262
|
+
|
263
|
+
containerWidth = starWidth*options.numStars + spacing*(options.numStars - 1);
|
264
|
+
|
265
|
+
percentOfStar = (starWidth/containerWidth)*100;
|
266
|
+
|
267
|
+
percentOfSpacing = (spacing/containerWidth)*100;
|
268
|
+
|
269
|
+
$node.width(containerWidth);
|
270
|
+
|
271
|
+
showRating();
|
272
|
+
}
|
273
|
+
|
274
|
+
function setStarWidth (newWidth) {
|
275
|
+
|
276
|
+
/*
|
277
|
+
* Set the width and height of each SVG star, called whenever one changes the
|
278
|
+
* `starWidth` option
|
279
|
+
*/
|
280
|
+
|
281
|
+
// The width and height of the star should be the same
|
282
|
+
var starHeight = options.starWidth = newWidth;
|
283
|
+
|
284
|
+
starWidth = window.parseFloat(options.starWidth.replace("px", ""));
|
285
|
+
|
286
|
+
$normalGroup.find("svg")
|
287
|
+
.attr({width : options.starWidth,
|
288
|
+
height: starHeight});
|
289
|
+
|
290
|
+
$ratedGroup.find("svg")
|
291
|
+
.attr({width : options.starWidth,
|
292
|
+
height: starHeight});
|
293
|
+
|
294
|
+
setContainerWidth();
|
295
|
+
|
296
|
+
return $node;
|
297
|
+
}
|
298
|
+
|
299
|
+
function setSpacing (newSpacing) {
|
300
|
+
|
301
|
+
/*
|
302
|
+
* Set spacing between the SVG stars, called whenever one changes
|
303
|
+
* the `spacing` option
|
304
|
+
*/
|
305
|
+
|
306
|
+
options.spacing = newSpacing;
|
307
|
+
|
308
|
+
spacing = parseFloat(options.spacing.replace("px", ""));
|
309
|
+
|
310
|
+
$normalGroup.find("svg:not(:first-child)")
|
311
|
+
.css({"margin-left": newSpacing});
|
312
|
+
|
313
|
+
$ratedGroup.find("svg:not(:first-child)")
|
314
|
+
.css({"margin-left": newSpacing});
|
315
|
+
|
316
|
+
setContainerWidth();
|
317
|
+
|
318
|
+
return $node;
|
319
|
+
}
|
320
|
+
|
321
|
+
function setNormalFill (newFill) {
|
322
|
+
|
323
|
+
/*
|
324
|
+
* Set the background fill of the Stars, called whenever one changes the
|
325
|
+
* `normalFill` option
|
326
|
+
*/
|
327
|
+
|
328
|
+
options.normalFill = newFill;
|
329
|
+
|
330
|
+
$normalGroup.find("svg").attr({fill: options.normalFill});
|
331
|
+
|
332
|
+
return $node;
|
333
|
+
}
|
334
|
+
|
335
|
+
/*
|
336
|
+
* Store the recent `ratedFill` option in a variable
|
337
|
+
* so that if multiColor is unset, we can use the perviously set `ratedFill`
|
338
|
+
* from this variable
|
339
|
+
*/
|
340
|
+
var ratedFill = options.ratedFill;
|
341
|
+
|
342
|
+
function setRatedFill (newFill) {
|
343
|
+
|
344
|
+
/*
|
345
|
+
* Set ratedFill of the stars, called when one changes the `ratedFill` option
|
346
|
+
*/
|
347
|
+
|
348
|
+
/*
|
349
|
+
* If `multiColor` option is set, `newFill` variable is dynamically set
|
350
|
+
* based on the rating, what ever set as parameter will be discarded
|
351
|
+
*/
|
352
|
+
if (options.multiColor) {
|
353
|
+
|
354
|
+
var ratingDiff = currentRating - minValue,
|
355
|
+
percentCovered = (ratingDiff/options.maxValue)*100;
|
356
|
+
|
357
|
+
var colorOpts = options.multiColor || {},
|
358
|
+
startColor = colorOpts.startColor || MULTICOLOR_OPTIONS.startColor,
|
359
|
+
endColor = colorOpts.endColor || MULTICOLOR_OPTIONS.endColor;
|
360
|
+
|
361
|
+
newFill = getColor(startColor, endColor, percentCovered);
|
362
|
+
} else {
|
363
|
+
|
364
|
+
ratedFill = newFill;
|
365
|
+
}
|
366
|
+
|
367
|
+
options.ratedFill = newFill;
|
368
|
+
|
369
|
+
$ratedGroup.find("svg").attr({fill: options.ratedFill});
|
370
|
+
|
371
|
+
return $node;
|
372
|
+
}
|
373
|
+
|
374
|
+
function setMultiColor (colorOptions) {
|
375
|
+
|
376
|
+
/*
|
377
|
+
* called whenever one changes the `multiColor` option
|
378
|
+
*/
|
379
|
+
|
380
|
+
options.multiColor = colorOptions;
|
381
|
+
|
382
|
+
// set the recently set `ratedFill` option, if multiColor Options are unset
|
383
|
+
setRatedFill(colorOptions ? colorOptions : ratedFill);
|
384
|
+
}
|
385
|
+
|
386
|
+
function setNumStars (newValue) {
|
387
|
+
|
388
|
+
/*
|
389
|
+
* Set the number of stars to use to display the rating, called whenever one
|
390
|
+
* changes the `numStars` option
|
391
|
+
*/
|
392
|
+
|
393
|
+
options.numStars = newValue;
|
394
|
+
|
395
|
+
step = options.maxValue/options.numStars;
|
396
|
+
|
397
|
+
$normalGroup.empty();
|
398
|
+
$ratedGroup.empty();
|
399
|
+
|
400
|
+
for (var i=0; i<options.numStars; i++) {
|
401
|
+
|
402
|
+
$normalGroup.append($(BASICSTAR));
|
403
|
+
$ratedGroup.append($(BASICSTAR));
|
404
|
+
}
|
405
|
+
|
406
|
+
setStarWidth(options.starWidth);
|
407
|
+
setNormalFill(options.normalFill);
|
408
|
+
setSpacing(options.spacing);
|
409
|
+
|
410
|
+
showRating();
|
411
|
+
|
412
|
+
return $node;
|
413
|
+
}
|
414
|
+
|
415
|
+
function setMaxValue (newValue) {
|
416
|
+
|
417
|
+
/*
|
418
|
+
* set the Maximum Value of rating to be allowed, called whenever
|
419
|
+
* one changes the `maxValue` option
|
420
|
+
*/
|
421
|
+
|
422
|
+
options.maxValue = newValue;
|
423
|
+
|
424
|
+
step = options.maxValue/options.numStars;
|
425
|
+
|
426
|
+
if (options.rating > newValue) {
|
427
|
+
|
428
|
+
setRating(newValue);
|
429
|
+
}
|
430
|
+
|
431
|
+
showRating();
|
432
|
+
|
433
|
+
return $node;
|
434
|
+
}
|
435
|
+
|
436
|
+
function setPrecision (newValue) {
|
437
|
+
|
438
|
+
/*
|
439
|
+
* Set the precision of the rating value, called if one changes the
|
440
|
+
* `precision` option
|
441
|
+
*/
|
442
|
+
|
443
|
+
options.precision = newValue;
|
444
|
+
|
445
|
+
setRating(options.rating);
|
446
|
+
|
447
|
+
return $node;
|
448
|
+
}
|
449
|
+
|
450
|
+
function setHalfStar (newValue) {
|
451
|
+
|
452
|
+
/*
|
453
|
+
* This function will be called if one changes the `halfStar` option
|
454
|
+
*/
|
455
|
+
|
456
|
+
options.halfStar = newValue;
|
457
|
+
|
458
|
+
return $node;
|
459
|
+
}
|
460
|
+
|
461
|
+
function setFullStar (newValue) {
|
462
|
+
|
463
|
+
/*
|
464
|
+
* This function will be called if one changes the `fullStar` option
|
465
|
+
*/
|
466
|
+
|
467
|
+
options.fullStar = newValue;
|
468
|
+
|
469
|
+
return $node;
|
470
|
+
}
|
471
|
+
|
472
|
+
function round (value) {
|
473
|
+
|
474
|
+
/*
|
475
|
+
* Rounds the value of rating if `halfStar` or `fullStar` options are chosen
|
476
|
+
*/
|
477
|
+
|
478
|
+
var remainder = value%step,
|
479
|
+
halfStep = step/2,
|
480
|
+
isHalfStar = options.halfStar,
|
481
|
+
isFullStar = options.fullStar;
|
482
|
+
|
483
|
+
if (!isFullStar && !isHalfStar) {
|
484
|
+
|
485
|
+
return value;
|
486
|
+
}
|
487
|
+
|
488
|
+
if (isFullStar || (isHalfStar && remainder > halfStep)) {
|
489
|
+
|
490
|
+
value += step - remainder;
|
491
|
+
} else {
|
492
|
+
|
493
|
+
value = value - remainder;
|
494
|
+
|
495
|
+
if (remainder > 0) {
|
496
|
+
|
497
|
+
value += halfStep;
|
498
|
+
}
|
499
|
+
}
|
500
|
+
|
501
|
+
return value;
|
502
|
+
}
|
503
|
+
|
504
|
+
function calculateRating (e) {
|
505
|
+
|
506
|
+
/*
|
507
|
+
* Calculates and returns the rating based on the position of cursor w.r.t the
|
508
|
+
* plugin container
|
509
|
+
*/
|
510
|
+
|
511
|
+
var position = $normalGroup.offset(),
|
512
|
+
nodeStartX = position.left,
|
513
|
+
nodeEndX = nodeStartX + $normalGroup.width();
|
514
|
+
|
515
|
+
var maxValue = options.maxValue;
|
516
|
+
|
517
|
+
// The x-coordinate(position) of the mouse pointer w.r.t page
|
518
|
+
var pageX = e.pageX;
|
519
|
+
|
520
|
+
var calculatedRating = 0;
|
521
|
+
|
522
|
+
// If the mouse pointer is to the left of the container
|
523
|
+
if(pageX < nodeStartX) {
|
524
|
+
|
525
|
+
calculatedRating = minValue;
|
526
|
+
}else if (pageX > nodeEndX) { // If the mouse pointer is right of the container
|
527
|
+
|
528
|
+
calculatedRating = maxValue;
|
529
|
+
}else { // If the mouse pointer is inside the continer
|
530
|
+
|
531
|
+
/*
|
532
|
+
* The fraction of width covered by the pointer w.r.t to the total width
|
533
|
+
* of the container.
|
534
|
+
*/
|
535
|
+
var calcPrcnt = ((pageX - nodeStartX)/(nodeEndX - nodeStartX));
|
536
|
+
|
537
|
+
if (spacing > 0) {
|
538
|
+
|
539
|
+
/*
|
540
|
+
* If there is spacing between stars, take the percentage of width covered
|
541
|
+
* and subtract the percentage of width covered by stars and spacing, to find
|
542
|
+
* how many stars are covered, the number of stars covered is the rating
|
543
|
+
*
|
544
|
+
* TODO: I strongly feel that this logic can be improved!, Please help!
|
545
|
+
*/
|
546
|
+
calcPrcnt *= 100;
|
547
|
+
|
548
|
+
var remPrcnt = calcPrcnt;
|
549
|
+
|
550
|
+
while (remPrcnt > 0) {
|
551
|
+
|
552
|
+
if (remPrcnt > percentOfStar) {
|
553
|
+
|
554
|
+
calculatedRating += step;
|
555
|
+
remPrcnt -= (percentOfStar + percentOfSpacing);
|
556
|
+
} else {
|
557
|
+
|
558
|
+
calculatedRating += remPrcnt/percentOfStar*step;
|
559
|
+
remPrcnt = 0;
|
560
|
+
}
|
561
|
+
}
|
562
|
+
} else {
|
563
|
+
|
564
|
+
/*
|
565
|
+
* If there is not spacing between stars, the fraction of width covered per
|
566
|
+
* `maxValue` is the rating
|
567
|
+
*/
|
568
|
+
calculatedRating = calcPrcnt * (options.maxValue);
|
569
|
+
}
|
570
|
+
|
571
|
+
// Round the rating if `halfStar` or `fullStar` options are chosen
|
572
|
+
calculatedRating = round(calculatedRating);
|
573
|
+
}
|
574
|
+
|
575
|
+
return calculatedRating;
|
576
|
+
}
|
577
|
+
|
578
|
+
function setReadOnly (newValue) {
|
579
|
+
|
580
|
+
/*
|
581
|
+
* UnBinds mouse event handlers, called when whenever one changes the
|
582
|
+
* `readOnly` option
|
583
|
+
*/
|
584
|
+
|
585
|
+
options.readOnly = newValue;
|
586
|
+
|
587
|
+
$node.attr("readonly", true);
|
588
|
+
|
589
|
+
unbindEvents();
|
590
|
+
|
591
|
+
if (!newValue) {
|
592
|
+
|
593
|
+
$node.removeAttr("readonly");
|
594
|
+
|
595
|
+
bindEvents();
|
596
|
+
}
|
597
|
+
|
598
|
+
return $node;
|
599
|
+
}
|
600
|
+
|
601
|
+
function setRating (newValue) {
|
602
|
+
|
603
|
+
/*
|
604
|
+
* Sets the rating of the Plugin, Called when option `rating` is changed
|
605
|
+
* or, when `rating` method is called
|
606
|
+
*/
|
607
|
+
|
608
|
+
var rating = newValue;
|
609
|
+
|
610
|
+
var maxValue = options.maxValue;
|
611
|
+
|
612
|
+
if (typeof rating === "string") {
|
613
|
+
|
614
|
+
// If rating is given in percentage, maxValue should be 100
|
615
|
+
if (rating[rating.length - 1] === "%") {
|
616
|
+
|
617
|
+
rating = rating.substr(0, rating.length - 1);
|
618
|
+
maxValue = 100;
|
619
|
+
|
620
|
+
setMaxValue(maxValue);
|
621
|
+
}
|
622
|
+
|
623
|
+
rating = parseFloat(rating);
|
624
|
+
}
|
625
|
+
|
626
|
+
checkBounds(rating, minValue, maxValue);
|
627
|
+
|
628
|
+
rating = parseFloat(rating.toFixed(options.precision));
|
629
|
+
|
630
|
+
checkPrecision(parseFloat(rating), minValue, maxValue);
|
631
|
+
|
632
|
+
options.rating = rating;
|
633
|
+
|
634
|
+
showRating();
|
635
|
+
|
636
|
+
if (isInitialized) {
|
637
|
+
|
638
|
+
$node.trigger("rateyo.set", {rating: rating});
|
639
|
+
}
|
640
|
+
|
641
|
+
return $node;
|
642
|
+
}
|
643
|
+
|
644
|
+
function setOnInit (method) {
|
645
|
+
|
646
|
+
/*
|
647
|
+
* set what method to be called on Initialization
|
648
|
+
*/
|
649
|
+
|
650
|
+
options.onInit = method;
|
651
|
+
|
652
|
+
return $node;
|
653
|
+
}
|
654
|
+
|
655
|
+
function setOnSet (method) {
|
656
|
+
|
657
|
+
/*
|
658
|
+
* set what method to be called when rating is set
|
659
|
+
*/
|
660
|
+
|
661
|
+
options.onSet = method;
|
662
|
+
|
663
|
+
return $node;
|
664
|
+
}
|
665
|
+
|
666
|
+
function setOnChange (method) {
|
667
|
+
|
668
|
+
/*
|
669
|
+
* set what method to be called rating in the UI is changed
|
670
|
+
*/
|
671
|
+
|
672
|
+
options.onChange = method;
|
673
|
+
|
674
|
+
return $node;
|
675
|
+
}
|
676
|
+
|
677
|
+
this.rating = function (newValue) {
|
678
|
+
|
679
|
+
/*
|
680
|
+
* rating getter/setter
|
681
|
+
*/
|
682
|
+
|
683
|
+
if (!isDefined(newValue)) {
|
684
|
+
|
685
|
+
return options.rating;
|
686
|
+
}
|
687
|
+
|
688
|
+
setRating(newValue);
|
689
|
+
|
690
|
+
return $node;
|
691
|
+
};
|
692
|
+
|
693
|
+
this.destroy = function () {
|
694
|
+
|
695
|
+
/*
|
696
|
+
* Removes the Rating UI by clearing the content, and removing the custom classes
|
697
|
+
*/
|
698
|
+
|
699
|
+
if (!options.readOnly) {
|
700
|
+
|
701
|
+
unbindEvents();
|
702
|
+
}
|
703
|
+
|
704
|
+
RateYo.prototype.collection = deleteInstance($node.get(0),
|
705
|
+
this.collection);
|
706
|
+
|
707
|
+
$node.removeClass("jq-ry-container").children().remove();
|
708
|
+
|
709
|
+
return $node;
|
710
|
+
};
|
711
|
+
|
712
|
+
this.method = function (methodName) {
|
713
|
+
|
714
|
+
/*
|
715
|
+
* Method to call the methods of RateYo Instance
|
716
|
+
*/
|
717
|
+
|
718
|
+
if (!methodName) {
|
719
|
+
|
720
|
+
throw Error("Method name not specified!");
|
721
|
+
}
|
722
|
+
|
723
|
+
if (!isDefined(this[methodName])) {
|
724
|
+
|
725
|
+
throw Error("Method " + methodName + " doesn't exist!");
|
726
|
+
}
|
727
|
+
|
728
|
+
var args = Array.prototype.slice.apply(arguments, []),
|
729
|
+
params = args.slice(1),
|
730
|
+
method = this[methodName];
|
731
|
+
|
732
|
+
return method.apply(this, params);
|
733
|
+
};
|
734
|
+
|
735
|
+
this.option = function (optionName, param) {
|
736
|
+
|
737
|
+
/*
|
738
|
+
* Method to get/set Options
|
739
|
+
*/
|
740
|
+
|
741
|
+
if (!isDefined(optionName)) {
|
742
|
+
|
743
|
+
return options;
|
744
|
+
}
|
745
|
+
|
746
|
+
var method;
|
747
|
+
|
748
|
+
switch (optionName) {
|
749
|
+
|
750
|
+
case "starWidth":
|
751
|
+
|
752
|
+
method = setStarWidth;
|
753
|
+
break;
|
754
|
+
case "numStars":
|
755
|
+
|
756
|
+
method = setNumStars;
|
757
|
+
break;
|
758
|
+
case "normalFill":
|
759
|
+
|
760
|
+
method = setNormalFill;
|
761
|
+
break;
|
762
|
+
case "ratedFill":
|
763
|
+
|
764
|
+
method = setRatedFill;
|
765
|
+
break;
|
766
|
+
case "multiColor":
|
767
|
+
|
768
|
+
method = setMultiColor;
|
769
|
+
break;
|
770
|
+
case "maxValue":
|
771
|
+
|
772
|
+
method = setMaxValue;
|
773
|
+
break;
|
774
|
+
case "precision":
|
775
|
+
|
776
|
+
method = setPrecision;
|
777
|
+
break;
|
778
|
+
case "rating":
|
779
|
+
|
780
|
+
method = setRating;
|
781
|
+
break;
|
782
|
+
case "halfStar":
|
783
|
+
|
784
|
+
method = setHalfStar;
|
785
|
+
break;
|
786
|
+
case "fullStar":
|
787
|
+
|
788
|
+
method = setFullStar;
|
789
|
+
break;
|
790
|
+
case "readOnly":
|
791
|
+
|
792
|
+
method = setReadOnly;
|
793
|
+
break;
|
794
|
+
case "spacing":
|
795
|
+
|
796
|
+
method = setSpacing;
|
797
|
+
break;
|
798
|
+
case "onInit":
|
799
|
+
|
800
|
+
method = setOnInit;
|
801
|
+
break;
|
802
|
+
case "onSet":
|
803
|
+
|
804
|
+
method = setOnSet;
|
805
|
+
break;
|
806
|
+
case "onChange":
|
807
|
+
|
808
|
+
method = setOnChange;
|
809
|
+
break;
|
810
|
+
default:
|
811
|
+
|
812
|
+
throw Error("No such option as " + optionName);
|
813
|
+
}
|
814
|
+
|
815
|
+
return isDefined(param) ? method(param) : options[optionName];
|
816
|
+
};
|
817
|
+
|
818
|
+
function onMouseEnter (e) {
|
819
|
+
|
820
|
+
/*
|
821
|
+
* If the Mouse Pointer is inside the container, calculate and show the rating
|
822
|
+
* in UI
|
823
|
+
*/
|
824
|
+
|
825
|
+
var rating = calculateRating(e).toFixed(options.precision);
|
826
|
+
|
827
|
+
var maxValue = options.maxValue;
|
828
|
+
|
829
|
+
rating = checkPrecision(parseFloat(rating), minValue, maxValue);
|
830
|
+
|
831
|
+
showRating(rating);
|
832
|
+
|
833
|
+
$node.trigger("rateyo.change", {rating: rating});
|
834
|
+
}
|
835
|
+
|
836
|
+
function onMouseLeave () {
|
837
|
+
|
838
|
+
/*
|
839
|
+
* If mouse leaves, revert the rating in UI to previously set rating,
|
840
|
+
* when empty value is passed to showRating, it will take the previously set
|
841
|
+
* rating
|
842
|
+
*/
|
843
|
+
|
844
|
+
showRating();
|
845
|
+
|
846
|
+
$node.trigger("rateyo.change", {rating: options.rating});
|
847
|
+
}
|
848
|
+
|
849
|
+
function onMouseClick (e) {
|
850
|
+
|
851
|
+
/*
|
852
|
+
* On clicking the mouse inside the container, calculate and set the rating
|
853
|
+
*/
|
854
|
+
|
855
|
+
var resultantRating = calculateRating(e).toFixed(options.precision);
|
856
|
+
resultantRating = parseFloat(resultantRating);
|
857
|
+
|
858
|
+
that.rating(resultantRating);
|
859
|
+
}
|
860
|
+
|
861
|
+
function onInit(e, data) {
|
862
|
+
|
863
|
+
if(options.onInit && typeof options.onInit === "function") {
|
864
|
+
|
865
|
+
/* jshint validthis:true */
|
866
|
+
options.onInit.apply(this, [data.rating, that]);
|
867
|
+
}
|
868
|
+
}
|
869
|
+
|
870
|
+
function onChange (e, data) {
|
871
|
+
|
872
|
+
if(options.onChange && typeof options.onChange === "function") {
|
873
|
+
|
874
|
+
/* jshint validthis:true */
|
875
|
+
options.onChange.apply(this, [data.rating, that]);
|
876
|
+
}
|
877
|
+
}
|
878
|
+
|
879
|
+
function onSet (e, data) {
|
880
|
+
|
881
|
+
if(options.onSet && typeof options.onSet === "function") {
|
882
|
+
|
883
|
+
/* jshint validthis:true */
|
884
|
+
options.onSet.apply(this, [data.rating, that]);
|
885
|
+
}
|
886
|
+
}
|
887
|
+
|
888
|
+
function bindEvents () {
|
889
|
+
|
890
|
+
$node.on("mousemove", onMouseEnter)
|
891
|
+
.on("mouseenter", onMouseEnter)
|
892
|
+
.on("mouseleave", onMouseLeave)
|
893
|
+
.on("click", onMouseClick)
|
894
|
+
.on("rateyo.init", onInit)
|
895
|
+
.on("rateyo.change", onChange)
|
896
|
+
.on("rateyo.set", onSet);
|
897
|
+
}
|
898
|
+
|
899
|
+
function unbindEvents () {
|
900
|
+
|
901
|
+
$node.off("mousemove", onMouseEnter)
|
902
|
+
.off("mouseenter", onMouseEnter)
|
903
|
+
.off("mouseleave", onMouseLeave)
|
904
|
+
.off("click", onMouseClick)
|
905
|
+
.off("rateyo.init", onInit)
|
906
|
+
.off("rateyo.change", onChange)
|
907
|
+
.off("rateyo.set", onSet);
|
908
|
+
}
|
909
|
+
|
910
|
+
setNumStars(options.numStars);
|
911
|
+
setReadOnly(options.readOnly);
|
912
|
+
|
913
|
+
this.collection.push(this);
|
914
|
+
this.rating(options.rating, true);
|
915
|
+
|
916
|
+
isInitialized = true;
|
917
|
+
$node.trigger("rateyo.init", {rating: options.rating});
|
918
|
+
}
|
919
|
+
|
920
|
+
RateYo.prototype.collection = [];
|
921
|
+
|
922
|
+
function getInstance (node, collection) {
|
923
|
+
|
924
|
+
/*
|
925
|
+
* Given a HTML element (node) and a collection of RateYo instances,
|
926
|
+
* this function will search through the collection and return the matched
|
927
|
+
* instance having the node
|
928
|
+
*/
|
929
|
+
|
930
|
+
var instance;
|
931
|
+
|
932
|
+
$.each(collection, function () {
|
933
|
+
|
934
|
+
if(node === this.node){
|
935
|
+
|
936
|
+
instance = this;
|
937
|
+
return false;
|
938
|
+
}
|
939
|
+
});
|
940
|
+
|
941
|
+
return instance;
|
942
|
+
}
|
943
|
+
|
944
|
+
function deleteInstance (node, collection) {
|
945
|
+
|
946
|
+
/*
|
947
|
+
* Given a HTML element (node) and a collection of RateYo instances,
|
948
|
+
* this function will search through the collection and delete the
|
949
|
+
* instance having the node, and return the modified collection
|
950
|
+
*/
|
951
|
+
|
952
|
+
$.each(collection, function (index) {
|
953
|
+
|
954
|
+
if (node === this.node) {
|
955
|
+
|
956
|
+
var firstPart = collection.slice(0, index),
|
957
|
+
secondPart = collection.slice(index+1, collection.length);
|
958
|
+
|
959
|
+
collection = firstPart.concat(secondPart);
|
960
|
+
|
961
|
+
return false;
|
962
|
+
}
|
963
|
+
});
|
964
|
+
|
965
|
+
return collection;
|
966
|
+
}
|
967
|
+
|
968
|
+
function _rateYo (options) {
|
969
|
+
|
970
|
+
var rateYoInstances = RateYo.prototype.collection;
|
971
|
+
|
972
|
+
/* jshint validthis:true */
|
973
|
+
var $nodes = $(this);
|
974
|
+
|
975
|
+
if($nodes.length === 0) {
|
976
|
+
|
977
|
+
return $nodes;
|
978
|
+
}
|
979
|
+
|
980
|
+
var args = Array.prototype.slice.apply(arguments, []);
|
981
|
+
|
982
|
+
if (args.length === 0) {
|
983
|
+
|
984
|
+
//If args length is 0, Initialize the UI with default settings
|
985
|
+
options = args[0] = {};
|
986
|
+
}else if (args.length === 1 && typeof args[0] === "object") {
|
987
|
+
|
988
|
+
//If an Object is specified as first argument, it is considered as options
|
989
|
+
options = args[0];
|
990
|
+
}else if (args.length >= 1 && typeof args[0] === "string") {
|
991
|
+
|
992
|
+
/*
|
993
|
+
* if there is only one argument, and if its a string, it is supposed to be a
|
994
|
+
* method name, if more than one argument is specified, the remaining arguments
|
995
|
+
* except the first argument, will be passed as a params to the specified method
|
996
|
+
*/
|
997
|
+
|
998
|
+
var methodName = args[0],
|
999
|
+
params = args.slice(1);
|
1000
|
+
|
1001
|
+
var result = [];
|
1002
|
+
|
1003
|
+
$.each($nodes, function (i, node) {
|
1004
|
+
|
1005
|
+
var existingInstance = getInstance(node, rateYoInstances);
|
1006
|
+
|
1007
|
+
if(!existingInstance) {
|
1008
|
+
|
1009
|
+
throw Error("Trying to set options before even initialization");
|
1010
|
+
}
|
1011
|
+
|
1012
|
+
var method = existingInstance[methodName];
|
1013
|
+
|
1014
|
+
if (!method) {
|
1015
|
+
|
1016
|
+
throw Error("Method " + methodName + " does not exist!");
|
1017
|
+
}
|
1018
|
+
|
1019
|
+
var returnVal = method.apply(existingInstance, params);
|
1020
|
+
|
1021
|
+
result.push(returnVal);
|
1022
|
+
});
|
1023
|
+
|
1024
|
+
/*
|
1025
|
+
* If the plugin in being called on only one jQuery Element, return only the
|
1026
|
+
* first value, to support chaining.
|
1027
|
+
*/
|
1028
|
+
result = result.length === 1? result[0]: result;
|
1029
|
+
|
1030
|
+
return result;
|
1031
|
+
}else {
|
1032
|
+
|
1033
|
+
throw Error("Invalid Arguments");
|
1034
|
+
}
|
1035
|
+
|
1036
|
+
/*
|
1037
|
+
* if only options are passed, extend default options, and if the plugin is not
|
1038
|
+
* initialized on a particular jQuery element, initalize RateYo on it
|
1039
|
+
*/
|
1040
|
+
options = $.extend({}, DEFAULTS, options);
|
1041
|
+
|
1042
|
+
return $.each($nodes, function () {
|
1043
|
+
|
1044
|
+
var existingInstance = getInstance(this, rateYoInstances);
|
1045
|
+
|
1046
|
+
if (!existingInstance) {
|
1047
|
+
|
1048
|
+
return new RateYo($(this), $.extend({}, options));
|
1049
|
+
}
|
1050
|
+
});
|
1051
|
+
}
|
1052
|
+
|
1053
|
+
function rateYo () {
|
1054
|
+
|
1055
|
+
/* jshint validthis:true */
|
1056
|
+
return _rateYo.apply(this, Array.prototype.slice.apply(arguments, []));
|
1057
|
+
}
|
1058
|
+
|
1059
|
+
window.RateYo = RateYo;
|
1060
|
+
$.fn.rateYo = rateYo;
|
1061
|
+
|
1062
|
+
}(window.jQuery));
|
@@ -0,0 +1,37 @@
|
|
1
|
+
.jq-ry-container {
|
2
|
+
position: relative;
|
3
|
+
padding: 0 5px;
|
4
|
+
line-height: 0;
|
5
|
+
display: block;
|
6
|
+
cursor: pointer;
|
7
|
+
-webkit-box-sizing: content-box;
|
8
|
+
-moz-box-sizing: content-box;
|
9
|
+
box-sizing: content-box;
|
10
|
+
}
|
11
|
+
.jq-ry-container[readonly="readonly"] {
|
12
|
+
cursor: default;
|
13
|
+
}
|
14
|
+
.jq-ry-container > .jq-ry-group-wrapper {
|
15
|
+
position: relative;
|
16
|
+
width: 100%;
|
17
|
+
}
|
18
|
+
.jq-ry-container > .jq-ry-group-wrapper > .jq-ry-group {
|
19
|
+
position: relative;
|
20
|
+
line-height: 0;
|
21
|
+
z-index: 10;
|
22
|
+
white-space: nowrap;
|
23
|
+
}
|
24
|
+
.jq-ry-container > .jq-ry-group-wrapper > .jq-ry-group > svg {
|
25
|
+
display: inline-block;
|
26
|
+
}
|
27
|
+
.jq-ry-container > .jq-ry-group-wrapper > .jq-ry-group.jq-ry-normal-group {
|
28
|
+
width: 100%;
|
29
|
+
}
|
30
|
+
.jq-ry-container > .jq-ry-group-wrapper > .jq-ry-group.jq-ry-rated-group {
|
31
|
+
width: 0;
|
32
|
+
z-index: 11;
|
33
|
+
position: absolute;
|
34
|
+
top: 0;
|
35
|
+
left: 0;
|
36
|
+
overflow: hidden;
|
37
|
+
}
|
data/lib/card-rails.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "rateyo/rails"
|
data/lib/rateyo/rails.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rateyo/rails/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rateyo-rails"
|
8
|
+
spec.version = Rateyo::Rails::VERSION
|
9
|
+
spec.authors = ["Colin Soleim"]
|
10
|
+
spec.email = ["colin@brandnewship.com"]
|
11
|
+
spec.summary = %q{Rails asset pipeline integration for rateyo}
|
12
|
+
spec.description = %q{rateYo is a simple and flexible jQuery star rating Plugin. This gem allows for its easy inclusion into the rails asset pipeline.}
|
13
|
+
spec.homepage = "https://github.com/colinsoleim/rateyo-rails"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rateyo-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Colin Soleim
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-08-15 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: rateYo is a simple and flexible jQuery star rating Plugin. This gem allows
|
14
|
+
for its easy inclusion into the rails asset pipeline.
|
15
|
+
email:
|
16
|
+
- colin@brandnewship.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- Gemfile
|
22
|
+
- LICENSE.txt
|
23
|
+
- README.md
|
24
|
+
- Rakefile
|
25
|
+
- app/assets/javascripts/jquery.rateyo.js
|
26
|
+
- app/assets/stylesheets/jquery.rateyo.css
|
27
|
+
- lib/card-rails.rb
|
28
|
+
- lib/rateyo/rails.rb
|
29
|
+
- lib/rateyo/rails/engine.rb
|
30
|
+
- lib/rateyo/rails/version.rb
|
31
|
+
- rateyo-rails.gemspec
|
32
|
+
homepage: https://github.com/colinsoleim/rateyo-rails
|
33
|
+
licenses:
|
34
|
+
- MIT
|
35
|
+
metadata: {}
|
36
|
+
post_install_message:
|
37
|
+
rdoc_options: []
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ! '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
requirements: []
|
51
|
+
rubyforge_project:
|
52
|
+
rubygems_version: 2.4.8
|
53
|
+
signing_key:
|
54
|
+
specification_version: 4
|
55
|
+
summary: Rails asset pipeline integration for rateyo
|
56
|
+
test_files: []
|