about summary refs log tree commit diff
path: root/app/views/players/index.html.erb
diff options
context:
space:
mode:
authorBen Harris <ben@tilde.team>2022-01-31 14:00:13 -0500
committerBen Harris <ben@tilde.team>2022-01-31 14:00:13 -0500
commitc95a61fc056f6a2d7fdb82f9288948a890a3bac5 (patch)
treeac830576036bdc54d742668345680e452af69b99 /app/views/players/index.html.erb
parentc5b9fe77a8a0e1c2e6a051b700c5a5d4b98ff6fb (diff)
switch to table, add total counts
Diffstat (limited to 'app/views/players/index.html.erb')
-rw-r--r--app/views/players/index.html.erb30
1 files changed, 26 insertions, 4 deletions
diff --git a/app/views/players/index.html.erb b/app/views/players/index.html.erb
index c067483..eb209b0 100644
--- a/app/views/players/index.html.erb
+++ b/app/views/players/index.html.erb
@@ -1,12 +1,34 @@
-<p style="color: green"><%= notice %></p>
+<% if not notice.nil? %><p style="color: green"><%= notice %></p><% end %>
 
 <h1>Players</h1>
 
 <div id="players">
-  <% @players.each do |player| %>
-    <%= render player %>
-  <% end %>
+  <table>
+    <thead>
+    <th>Name</th>
+    <th>Paid</th>
+    <th>Strikes</th>
+    <th>Delete</th>
+    </thead>
+    <tbody>
+    <% @players.each do |player| %>
+      <tr>
+        <td><%= link_to player.name, player %></td>
+        <td>
+          <% if player.paid %>✓
+          <% end %></td>
+        <td><%= player.strikes %></td>
+        <td><%= link_to "X", player, data: {
+          turbo_method: :delete,
+          turbo_confirm: "Are you sure you want to remove #{player.name}?"
+        } %></td>
+      </tr>
+    <% end %>
+    </tbody>
+  </table>
 </div>
 
+<p><%= pluralize(@players.count, 'total player') %></p>
+
 <hr>
 <%= link_to "Add a player", new_player_path %>