Skip to content

Commit fa5f15f

Browse files
committed
Updated views for stats to partials
1 parent 4387377 commit fa5f15f

File tree

4 files changed

+59
-55
lines changed

4 files changed

+59
-55
lines changed

app/controllers/dashboard_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ class DashboardController < ApplicationController
22
def show
33
@current_user
44
@user_info ||= UserPresenter.new(current_user)
5+
@stats ||= StatsPresenter.new
56
end
67
end

app/views/dashboard/show.html.erb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,12 @@
8282
</div>
8383
</div>
8484

85-
86-
<div class="container">
8785
<div class="col-md-12">
88-
<%= link_to "1507 Statistics", root_path, class: "btn btn-lg btn-default btn-home" %>
89-
</div>
90-
</div>
86+
<br>
87+
<h3 class="home">1507 Git Statistics</h3>
88+
<br>
89+
<button class="btn btn-lg btn-default btn-home button1">See Statistics</button>
90+
<br><br>
91+
</div>
92+
<%= render partial: "layouts/stat_board" %>
93+
</div>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<div class="container commits" id="commits" style="display: none">
2+
3+
<div class="col-md-4" align="center">
4+
<h3 class="home">Leaderboard</h3>
5+
<table class="table home">
6+
<tr>
7+
<td>Name</td>
8+
<td>Commits Since <%= Time.now.month %>/<%= Time.now.day %>/<%= Time.now.year - 1 %></td>
9+
</tr>
10+
<% @stats.ordered_commits.each do |stat| %>
11+
<tr>
12+
<td><%= stat.name %></td>
13+
<td><%= stat.commits %></td>
14+
</tr>
15+
<% end %>
16+
</table>
17+
</div>
18+
19+
<div class="col-md-4" align="center" id="completed-orders">
20+
<h3 class="home">Current Streak</h3>
21+
<table class="table home">
22+
<tr>
23+
<td>Name</td>
24+
<td>Current Streak</td>
25+
</tr>
26+
<% @stats.current_streak.each do |streak| %>
27+
<tr>
28+
<td><%= streak.name %></td>
29+
<td><%= streak.current_streaks %></td>
30+
</tr>
31+
<% end %>
32+
</table>
33+
</div>
34+
35+
<div class="col-md-4" align="center" id="completed-orders">
36+
<h3 class="home">Longest Streak</h3>
37+
<table class="table home">
38+
<tr>
39+
<td>Name</td>
40+
<td>Longest Streak</td>
41+
</tr>
42+
<% @stats.longest_streak.each do |streak| %>
43+
<tr>
44+
<td><%= streak.name %></td>
45+
<td><%= streak.streaks %></td>
46+
</tr>
47+
<% end %>
48+
</table>
49+
</div>

app/views/stats/index.html.erb

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -13,54 +13,5 @@
1313
<button class="btn btn-lg btn-default btn-home button1">See Statistics</button>
1414
<br><br>
1515
</div>
16-
17-
<div class="container commits" id="commits" style="display: none">
18-
19-
<div class="col-md-4" align="center">
20-
<h3 class="home">Leaderboard</h3>
21-
<table class="table home">
22-
<tr>
23-
<td>Name</td>
24-
<td>Commits Since <%= Time.now.month %>/<%= Time.now.day %>/<%= Time.now.year - 1 %></td>
25-
</tr>
26-
<% @stats.ordered_commits.each do |stat| %>
27-
<tr>
28-
<td><%= stat.name %></td>
29-
<td><%= stat.commits %></td>
30-
</tr>
31-
<% end %>
32-
</table>
33-
</div>
34-
35-
<div class="col-md-4" align="center" id="completed-orders">
36-
<h3 class="home">Current Streak</h3>
37-
<table class="table home">
38-
<tr>
39-
<td>Name</td>
40-
<td>Current Streak</td>
41-
</tr>
42-
<% @stats.current_streak.each do |streak| %>
43-
<tr>
44-
<td><%= streak.name %></td>
45-
<td><%= streak.current_streaks %></td>
46-
</tr>
47-
<% end %>
48-
</table>
49-
</div>
50-
51-
<div class="col-md-4" align="center" id="completed-orders">
52-
<h3 class="home">Longest Streak</h3>
53-
<table class="table home">
54-
<tr>
55-
<td>Name</td>
56-
<td>Longest Streak</td>
57-
</tr>
58-
<% @stats.longest_streak.each do |streak| %>
59-
<tr>
60-
<td><%= streak.name %></td>
61-
<td><%= streak.streaks %></td>
62-
</tr>
63-
<% end %>
64-
</table>
65-
</div>
16+
<%= render partial: "layouts/stat_board" %>
6617
</div>

0 commit comments

Comments
 (0)