/
show.html.erb
40 lines (35 loc) · 1.1 KB
/
show.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<h1>Games / <%= @game.name %></h1>
<section class="action-buttons">
<%= link_to 'Edit', edit_game_path(@game), class: "btn" %>
<% if @game.results.empty? %>
<%= link_to "Delete", game_path(@game), method: :delete, confirm: "Are you sure?", class: "btn btn-danger" %>
<% end %>
</section>
<div class="row-fluid">
<div class="span8">
<h2>Recent Results</h2>
<%= link_to "Add Result", new_game_result_path(@game), class: "btn btn-primary" %>
<% if @game.recent_results.any? %>
<%= render partial: 'shared/results', object: @game.recent_results, locals: {show_game: false} %>
<% else %>
<span>No results, play some games!</span>
<% end %>
</div>
<div class="span4">
<h2>Player Ratings</h2>
<table id='ratings'>
<thead>
<tr>
<th>Player</th>
<th>Rating</th>
<th>W</th>
<th>L</th>
</tr>
</thead>
<tbody>
<%= render partial: 'rating', collection: @game.all_ratings.select(&:active?) %>
</tbody>
</table>
<%= link_to "View All", game_ratings_path(@game) %>
</div>
</div>