Commit 9a7c73f1fcc54f6059aa047b9589c3385bfdf9da

Authored by Victor Costa
1 parent f887eb6b

Display description for points in dashboard

lib/gamification_plugin/dashboard_helper.rb
... ... @@ -11,4 +11,8 @@ module GamificationPlugin::DashboardHelper
11 11 point.num_points > 0 ? 'positive' : 'negative'
12 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 18 end
... ...
lib/merit/point_rules.rb
... ... @@ -8,7 +8,7 @@ module Merit
8 8 :undo_action => 'comment#destroy',
9 9 :to => :author,
10 10 :value => 1,
11   - :description => _('Point weight for comment author'),
  11 + :description => _('Comment author'),
12 12 :default_weight => 150
13 13 },
14 14 :comment_article_author => {
... ... @@ -16,7 +16,7 @@ module Merit
16 16 :undo_action => 'comment#destroy',
17 17 :to => lambda {|comment| comment.source.author},
18 18 :value => 1,
19   - :description => _('Point weight for article author of a comment'),
  19 + :description => _('Article author of a comment'),
20 20 :default_weight => 50
21 21 },
22 22 :comment_article => {
... ... @@ -24,7 +24,7 @@ module Merit
24 24 :undo_action => 'comment#destroy',
25 25 :to => lambda {|comment| comment.source},
26 26 :value => 1,
27   - :description => _('Point weight for source article of a comment'),
  27 + :description => _('Source article of a comment'),
28 28 :default_weight => 50
29 29 },
30 30 :comment_community => {
... ... @@ -32,7 +32,7 @@ module Merit
32 32 :undo_action => 'comment#destroy',
33 33 :to => lambda {|comment| comment.profile},
34 34 :value => 1,
35   - :description => _('Point weight for article community of a comment'),
  35 + :description => _('Article community of a comment'),
36 36 :default_weight => 50,
37 37 :condition => lambda {|target| target.profile.community? }
38 38 },
... ... @@ -41,7 +41,7 @@ module Merit
41 41 :undo_action => 'article#destroy',
42 42 :to => :author,
43 43 :value => 1,
44   - :description => _('Point weight for article author'),
  44 + :description => _('Article author'),
45 45 :default_weight => 500
46 46 },
47 47 :article_community => {
... ... @@ -49,7 +49,7 @@ module Merit
49 49 :undo_action => 'article#destroy',
50 50 :to => :profile,
51 51 :value => 1,
52   - :description => _('Point weight for article community'),
  52 + :description => _('Article community'),
53 53 :default_weight => 600,
54 54 :condition => lambda {|target| target.profile.community? }
55 55 },
... ... @@ -59,7 +59,7 @@ module Merit
59 59 :to => lambda {|vote| vote.voteable.author},
60 60 :profile => lambda {|vote| vote.voteable.profile},
61 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 63 :default_weight => 50,
64 64 },
65 65 :vote_voteable => {
... ... @@ -68,7 +68,7 @@ module Merit
68 68 :to => lambda {|vote| vote.voteable},
69 69 :profile => lambda {|vote| vote.voteable.profile},
70 70 :value => lambda {|vote| vote.vote},
71   - :description => _('Point weight for a voted content'),
  71 + :description => _('Voted content'),
72 72 :default_weight => 50
73 73 },
74 74 :vote_voter => {
... ... @@ -76,7 +76,7 @@ module Merit
76 76 :undo_action => 'vote#destroy',
77 77 :to => lambda {|vote| vote.voter},
78 78 :value => lambda {|vote| 1},
79   - :description => _('Point weight for a voter'),
  79 + :description => _('Voter'),
80 80 :default_weight => 10
81 81 },
82 82 }
... ...
public/style.css
... ... @@ -104,3 +104,7 @@
104 104 text-align: right;
105 105 margin-right: 4px;
106 106 }
  107 +
  108 +.gamification-dashboard .scores .date {
  109 + color: gray;
  110 +}
... ...
views/gamification/dashboard.html.erb
... ... @@ -24,7 +24,7 @@
24 24 <% @target.score_points.order('created_at desc').limit(5).each do |point| %>
25 25 <div class="score <%= point.score.category %> <%= score_point_class(point) %>">
26 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 28 <span class="date timeago" title="<%= point.created_at %>"><%= point.created_at %></span>
29 29 </div>
30 30 <% end %>
... ...