Commit 9a7c73f1fcc54f6059aa047b9589c3385bfdf9da
1 parent
f887eb6b
Exists in
master
and in
1 other branch
Display description for points in dashboard
Showing
4 changed files
with
18 additions
and
10 deletions
Show diff stats
lib/gamification_plugin/dashboard_helper.rb
@@ -11,4 +11,8 @@ module GamificationPlugin::DashboardHelper | @@ -11,4 +11,8 @@ module GamificationPlugin::DashboardHelper | ||
11 | point.num_points > 0 ? 'positive' : 'negative' | 11 | point.num_points > 0 ? 'positive' : 'negative' |
12 | end | 12 | end |
13 | 13 | ||
14 | + def score_point_category(point) | ||
15 | + HashWithIndifferentAccess.new(Merit::PointRules::AVAILABLE_RULES)[point.score.category][:description] | ||
16 | + end | ||
17 | + | ||
14 | end | 18 | end |
lib/merit/point_rules.rb
@@ -8,7 +8,7 @@ module Merit | @@ -8,7 +8,7 @@ module Merit | ||
8 | :undo_action => 'comment#destroy', | 8 | :undo_action => 'comment#destroy', |
9 | :to => :author, | 9 | :to => :author, |
10 | :value => 1, | 10 | :value => 1, |
11 | - :description => _('Point weight for comment author'), | 11 | + :description => _('Comment author'), |
12 | :default_weight => 150 | 12 | :default_weight => 150 |
13 | }, | 13 | }, |
14 | :comment_article_author => { | 14 | :comment_article_author => { |
@@ -16,7 +16,7 @@ module Merit | @@ -16,7 +16,7 @@ module Merit | ||
16 | :undo_action => 'comment#destroy', | 16 | :undo_action => 'comment#destroy', |
17 | :to => lambda {|comment| comment.source.author}, | 17 | :to => lambda {|comment| comment.source.author}, |
18 | :value => 1, | 18 | :value => 1, |
19 | - :description => _('Point weight for article author of a comment'), | 19 | + :description => _('Article author of a comment'), |
20 | :default_weight => 50 | 20 | :default_weight => 50 |
21 | }, | 21 | }, |
22 | :comment_article => { | 22 | :comment_article => { |
@@ -24,7 +24,7 @@ module Merit | @@ -24,7 +24,7 @@ module Merit | ||
24 | :undo_action => 'comment#destroy', | 24 | :undo_action => 'comment#destroy', |
25 | :to => lambda {|comment| comment.source}, | 25 | :to => lambda {|comment| comment.source}, |
26 | :value => 1, | 26 | :value => 1, |
27 | - :description => _('Point weight for source article of a comment'), | 27 | + :description => _('Source article of a comment'), |
28 | :default_weight => 50 | 28 | :default_weight => 50 |
29 | }, | 29 | }, |
30 | :comment_community => { | 30 | :comment_community => { |
@@ -32,7 +32,7 @@ module Merit | @@ -32,7 +32,7 @@ module Merit | ||
32 | :undo_action => 'comment#destroy', | 32 | :undo_action => 'comment#destroy', |
33 | :to => lambda {|comment| comment.profile}, | 33 | :to => lambda {|comment| comment.profile}, |
34 | :value => 1, | 34 | :value => 1, |
35 | - :description => _('Point weight for article community of a comment'), | 35 | + :description => _('Article community of a comment'), |
36 | :default_weight => 50, | 36 | :default_weight => 50, |
37 | :condition => lambda {|target| target.profile.community? } | 37 | :condition => lambda {|target| target.profile.community? } |
38 | }, | 38 | }, |
@@ -41,7 +41,7 @@ module Merit | @@ -41,7 +41,7 @@ module Merit | ||
41 | :undo_action => 'article#destroy', | 41 | :undo_action => 'article#destroy', |
42 | :to => :author, | 42 | :to => :author, |
43 | :value => 1, | 43 | :value => 1, |
44 | - :description => _('Point weight for article author'), | 44 | + :description => _('Article author'), |
45 | :default_weight => 500 | 45 | :default_weight => 500 |
46 | }, | 46 | }, |
47 | :article_community => { | 47 | :article_community => { |
@@ -49,7 +49,7 @@ module Merit | @@ -49,7 +49,7 @@ module Merit | ||
49 | :undo_action => 'article#destroy', | 49 | :undo_action => 'article#destroy', |
50 | :to => :profile, | 50 | :to => :profile, |
51 | :value => 1, | 51 | :value => 1, |
52 | - :description => _('Point weight for article community'), | 52 | + :description => _('Article community'), |
53 | :default_weight => 600, | 53 | :default_weight => 600, |
54 | :condition => lambda {|target| target.profile.community? } | 54 | :condition => lambda {|target| target.profile.community? } |
55 | }, | 55 | }, |
@@ -59,7 +59,7 @@ module Merit | @@ -59,7 +59,7 @@ module Merit | ||
59 | :to => lambda {|vote| vote.voteable.author}, | 59 | :to => lambda {|vote| vote.voteable.author}, |
60 | :profile => lambda {|vote| vote.voteable.profile}, | 60 | :profile => lambda {|vote| vote.voteable.profile}, |
61 | :value => lambda {|vote| vote.vote}, | 61 | :value => lambda {|vote| vote.vote}, |
62 | - :description => _('Point weight for the author of a voted content'), | 62 | + :description => _('Author of a voted content'), |
63 | :default_weight => 50, | 63 | :default_weight => 50, |
64 | }, | 64 | }, |
65 | :vote_voteable => { | 65 | :vote_voteable => { |
@@ -68,7 +68,7 @@ module Merit | @@ -68,7 +68,7 @@ module Merit | ||
68 | :to => lambda {|vote| vote.voteable}, | 68 | :to => lambda {|vote| vote.voteable}, |
69 | :profile => lambda {|vote| vote.voteable.profile}, | 69 | :profile => lambda {|vote| vote.voteable.profile}, |
70 | :value => lambda {|vote| vote.vote}, | 70 | :value => lambda {|vote| vote.vote}, |
71 | - :description => _('Point weight for a voted content'), | 71 | + :description => _('Voted content'), |
72 | :default_weight => 50 | 72 | :default_weight => 50 |
73 | }, | 73 | }, |
74 | :vote_voter => { | 74 | :vote_voter => { |
@@ -76,7 +76,7 @@ module Merit | @@ -76,7 +76,7 @@ module Merit | ||
76 | :undo_action => 'vote#destroy', | 76 | :undo_action => 'vote#destroy', |
77 | :to => lambda {|vote| vote.voter}, | 77 | :to => lambda {|vote| vote.voter}, |
78 | :value => lambda {|vote| 1}, | 78 | :value => lambda {|vote| 1}, |
79 | - :description => _('Point weight for a voter'), | 79 | + :description => _('Voter'), |
80 | :default_weight => 10 | 80 | :default_weight => 10 |
81 | }, | 81 | }, |
82 | } | 82 | } |
public/style.css
views/gamification/dashboard.html.erb
@@ -24,7 +24,7 @@ | @@ -24,7 +24,7 @@ | ||
24 | <% @target.score_points.order('created_at desc').limit(5).each do |point| %> | 24 | <% @target.score_points.order('created_at desc').limit(5).each do |point| %> |
25 | <div class="score <%= point.score.category %> <%= score_point_class(point) %>"> | 25 | <div class="score <%= point.score.category %> <%= score_point_class(point) %>"> |
26 | <span class="value"><%= point.num_points %></span> | 26 | <span class="value"><%= point.num_points %></span> |
27 | - <span class="category"><%= point.score.category %></span> | 27 | + <span class="category"><%= score_point_category(point) %></span> |
28 | <span class="date timeago" title="<%= point.created_at %>"><%= point.created_at %></span> | 28 | <span class="date timeago" title="<%= point.created_at %>"><%= point.created_at %></span> |
29 | </div> | 29 | </div> |
30 | <% end %> | 30 | <% end %> |