about summary refs log tree commit diff
path: root/app/views/players
diff options
context:
space:
mode:
authorBen Harris <ben@tilde.team>2021-09-27 01:33:06 -0400
committerBen Harris <ben@tilde.team>2021-09-27 01:33:06 -0400
commit848c59f15e83c0571be956726284d8d9180679b4 (patch)
tree4044505bcf5e89c75e10f94de3690b18c164cc89 /app/views/players
parentf9ea5e999a298f658ef7fb2abc7c13ba3ca412cb (diff)
add delete button to list views
Diffstat (limited to 'app/views/players')
-rw-r--r--app/views/players/edit.html.erb5
-rw-r--r--app/views/players/index.html.erb5
2 files changed, 6 insertions, 4 deletions
diff --git a/app/views/players/edit.html.erb b/app/views/players/edit.html.erb
index 1504b65..fd22922 100644
--- a/app/views/players/edit.html.erb
+++ b/app/views/players/edit.html.erb
@@ -2,7 +2,6 @@
 
 <%= render "form", machine: @player %>
 
-<%= link_to "Delete #{@player.name}", player_path(@player),
+<p><%= link_to "Delete #{@player.name}", player_path(@player),
     method: :delete,
-    data: { confirm: "Are you sure?" } %>
-
+    data: { confirm: "Are you sure?" } %></p>
diff --git a/app/views/players/index.html.erb b/app/views/players/index.html.erb
index aea4252..31a84f1 100644
--- a/app/views/players/index.html.erb
+++ b/app/views/players/index.html.erb
@@ -1,11 +1,11 @@
 <h1>Pinball Players</h1>
 
-
 <table>
   <thead>
     <th>Name</th>
     <th>Paid</th>
     <th>Strikes</th>
+    <th>Delete</th>
   </thead>
   <tbody>
     <% @players.order("strikes").each do |player| %>
@@ -13,6 +13,9 @@
         <td><%= link_to player.name, edit_player_path(player) %></td>
         <td><% if player.paid %>✓<% end %></td>
         <td><%= player.strikes %></td>
+        <td><%= link_to "X", player_path(player),
+          method: :delete,
+          data: { confirm: "Are you sure?" } %></td>
       </tr>
     <% end %>
   </tbody>