ratyrate 1.2.0.alpha → 1.2.2.alpha

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,11 +1,14 @@
1
- $.fn.raty.defaults.path = "/assets";
2
- $.fn.raty.defaults.half_show = true;
3
1
  $.fn.raty.defaults.half = false;
2
+ $.fn.raty.defaults.halfShow = true;
3
+ $.fn.raty.defaults.path = "/assets";
4
4
  $.fn.raty.defaults.cancel = false;
5
5
 
6
6
  $(function(){
7
7
  $(".star").each(function() {
8
8
  var $readonly = ($(this).attr('data-readonly') == 'true');
9
+ var $half = ($(this).attr('data-enable-half') == 'true');
10
+ var $halfShow = ($(this).attr('data-half-show') == 'true');
11
+ var $single = ($(this).attr('data-single') == 'true');
9
12
  $(this).raty({
10
13
  score: function() {
11
14
  return $(this).attr('data-rating')
@@ -13,8 +16,9 @@ $(function(){
13
16
  number: function() {
14
17
  return $(this).attr('data-star-count')
15
18
  },
16
- half: $(this).attr('data-enable-half'),
17
- half_show: $(this).attr('data-half-show'),
19
+ half: $half,
20
+ halfShow: $halfShow,
21
+ single: $single,
18
22
  path: $(this).attr('data-star-path'),
19
23
  starOn: $(this).attr('data-star-on'),
20
24
  starOff: $(this).attr('data-star-off'),
@@ -27,7 +31,6 @@ $(function(){
27
31
  noRatedMsg: $(this).attr('data-no-rated-message'),
28
32
  round: $(this).attr('data-round'),
29
33
  space: $(this).attr('data-space'),
30
- // single: $(this).attr('data-single'),
31
34
  target: $(this).attr('data-target'),
32
35
  targetText: $(this).attr('data-target-text'),
33
36
  targetType: $(this).attr('data-target-type'),
@@ -5,7 +5,7 @@ module Helpers
5
5
  avg = cached_average ? cached_average.avg : 0
6
6
 
7
7
  star = options[:star] || 5
8
- enable_half = options[:enable_half] || true
8
+ enable_half = options[:enable_half] || false
9
9
  half_show = options[:half_show] || true
10
10
  star_path = options[:star_path] || "/assets"
11
11
  star_on = options[:star_on] || "star-on.png"
@@ -32,7 +32,7 @@ module Helpers
32
32
  if disable_after_rate
33
33
  readonly = !(current_user && rateable_obj.can_rate?(current_user, dimension))
34
34
  else
35
- readonly = false
35
+ readonly = !current_user || false
36
36
  end
37
37
 
38
38
  if options[:imdb_avg] && readonly
@@ -69,6 +69,7 @@ module Helpers
69
69
  end
70
70
 
71
71
  def imdb_style_rating_for(rateable_obj, user, options = {})
72
+ #TODO: add option to change the star icon
72
73
  overall_avg = rateable_obj.overall_avg(user)
73
74
 
74
75
  content_tag :div, '', :style => "background-image:url(/assets/big-star.png);width:81px;height:81px;margin-top:10px;" do
@@ -78,13 +79,13 @@ module Helpers
78
79
 
79
80
  def rating_for_user(rateable_obj, rating_user, dimension = nil, options = {})
80
81
  @object = rateable_obj
81
- @user = rating_user
82
+ @user = rating_user
82
83
  @rating = Rate.find_by_rater_id_and_rateable_id_and_dimension(@user.id, @object.id, dimension)
83
84
  stars = @rating ? @rating.stars : 0
84
85
 
85
86
  star = options[:star] || 5
86
- enable_half = options[:enable_half] || true
87
- half_show = options[:half_show] || true
87
+ enable_half = options[:enable_half] || false
88
+ half_show = options[:half_show] || true
88
89
  star_path = options[:star_path] || "/assets"
89
90
  star_on = options[:star_on] || "star-on.png"
90
91
  star_off = options[:star_off] || "star-off.png"
@@ -1,3 +1,3 @@
1
1
  module Ratyrate
2
- VERSION = "1.2.0.alpha"
2
+ VERSION = "1.2.2.alpha"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ratyrate
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0.alpha
4
+ version: 1.2.2.alpha
5
5
  platform: ruby
6
6
  authors:
7
7
  - Islam Wazery
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-09 00:00:00.000000000 Z
11
+ date: 2014-08-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A Ruby Gem that provides the same functionality of jQuery Raty library,
14
14
  and adds IMDB style rating.