Commit 1f2171520eb4719fefc5a32f26ef2a002cd61f0d
1 parent
671de920
Exists in
master
and in
1 other branch
Display last score point on dashboard
Showing
2 changed files
with
27 additions
and
15 deletions
Show diff stats
public/style.css
@@ -71,3 +71,12 @@ | @@ -71,3 +71,12 @@ | ||
71 | position: absolute; | 71 | position: absolute; |
72 | left: 0; | 72 | left: 0; |
73 | } | 73 | } |
74 | + | ||
75 | +.gamification .points .level { | ||
76 | + display: inline-block; | ||
77 | + margin: 0 30px; | ||
78 | + vertical-align: top; | ||
79 | +} | ||
80 | +.gamification .points .scores { | ||
81 | + display: inline-block; | ||
82 | +} |
views/gamification/dashboard.html.erb
@@ -7,24 +7,27 @@ | @@ -7,24 +7,27 @@ | ||
7 | <div class="gamification"> | 7 | <div class="gamification"> |
8 | <h1><%= _('Gamification Dashboard for %s' % @target.identifier) %></h1> | 8 | <h1><%= _('Gamification Dashboard for %s' % @target.identifier) %></h1> |
9 | 9 | ||
10 | - <div> | ||
11 | - <h3> <%= _('Level') %></h3> | ||
12 | - <%= level_chart(@target) %> | ||
13 | - </div> | ||
14 | - | ||
15 | - <div class="scores"> | ||
16 | - <h3><%= _('Score') %></h3> | ||
17 | - <% Merit::PointRules::AVAILABLE_RULES.each do |category, setting| %> | ||
18 | - <div class="score <%= category %>"> | ||
19 | - <span class="label"><%= _('%s: ' % category) %></span> | ||
20 | - <span class="value"><%= @target.points(:category => category) %></span> | 10 | + <div class="points"> |
11 | + <div class="level"> | ||
12 | + <h3> <%= _('Level') %></h3> | ||
13 | + <%= level_chart(@target) %> | ||
14 | + <div class="score total"> | ||
15 | + <span class="label"><%= _('Total: ') %></span> | ||
16 | + <span class="value"><%= @target.points %></span> | ||
21 | </div> | 17 | </div> |
22 | - <% end %> | ||
23 | - <div class="score total"> | ||
24 | - <span class="label"><%= _('Total: ') %></span> | ||
25 | - <span class="value"><%= @target.points %></span> | 18 | + </div> |
19 | + | ||
20 | + <div class="scores"> | ||
21 | + <h3><%= _('Last Score Points') %></h3> | ||
22 | + <% @target.score_points.order('created_at desc').limit(5).each do |point| %> | ||
23 | + <div class="score <%= point.score.category %>"> | ||
24 | + <span class="label"><%= _('%s: ' % point.num_points ) %></span> | ||
25 | + <span class="value"><%= point.created_at %></span> | ||
26 | + </div> | ||
27 | + <% end %> | ||
26 | </div> | 28 | </div> |
27 | </div> | 29 | </div> |
30 | + | ||
28 | <div class="badges"> | 31 | <div class="badges"> |
29 | <h3><%= _('Badges') %></h3> | 32 | <h3><%= _('Badges') %></h3> |
30 | <ul class="badge-list"> | 33 | <ul class="badge-list"> |