about summary refs log tree commit diff
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
parentf9ea5e999a298f658ef7fb2abc7c13ba3ca412cb (diff)
add delete button to list views
-rw-r--r--app/views/layouts/application.html.erb4
-rw-r--r--app/views/machines/index.html.erb6
-rw-r--r--app/views/pages/index.html.erb3
-rw-r--r--app/views/pages/teampicker.html.erb4
-rw-r--r--app/views/players/edit.html.erb5
-rw-r--r--app/views/players/index.html.erb5
-rw-r--r--yarn.lock5
7 files changed, 15 insertions, 17 deletions
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index efe387a..d0c5007 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -21,10 +21,6 @@
       <hr>
 
       <%= yield %>
-
-      <footer>
-        <center><a href="https://tildegit.org/ben/pinrails">source code here</a></center>
-      </footer>
     </main>
   </body>
 </html>
diff --git a/app/views/machines/index.html.erb b/app/views/machines/index.html.erb
index 5abd2c2..f099ea6 100644
--- a/app/views/machines/index.html.erb
+++ b/app/views/machines/index.html.erb
@@ -1,16 +1,19 @@
 <h1>Pinball Machines</h1>
 
-
 <table>
   <thead>
     <th>Name</th>
     <th>Edition</th>
+    <th>Delete</th>
   </thead>
   <tbody>
     <% @machines.each do |machine| %>
       <tr>
         <td><%= link_to machine.name, edit_machine_path(machine) %></td>
         <td><%= machine.edition %></td>
+        <td><%= link_to "X", machine_path(machine),
+          method: :delete,
+          data: { confirm: "Are you sure?" } %></td>
       </tr>
     <% end %>
   </tbody>
@@ -19,4 +22,3 @@
 <hr>
 <p><%= @machines.size %> available machines</p>
 <%= link_to "+ Add Machine", new_machine_path %>
-
diff --git a/app/views/pages/index.html.erb b/app/views/pages/index.html.erb
index bccab8f..2611626 100644
--- a/app/views/pages/index.html.erb
+++ b/app/views/pages/index.html.erb
@@ -1,3 +1,6 @@
 <h1>nomi pinball</h1>
 <%= image_tag "coinslotlogo.png" %>
 
+<footer>
+  <center><a href="https://tildegit.org/ben/pinrails">source code here</a></center>
+</footer>
diff --git a/app/views/pages/teampicker.html.erb b/app/views/pages/teampicker.html.erb
index ea0f883..8504ece 100644
--- a/app/views/pages/teampicker.html.erb
+++ b/app/views/pages/teampicker.html.erb
@@ -3,9 +3,9 @@
 <% @groups.each.with_index(1) do |slice, i| %>
   <h2>Team <%= i %></h2>
   <p>Table: <%= @machines[i - 1].name %></p>
-  <ul>
+  <ol>
   <% slice.each do |player| %>
     <li><%= link_to player.name, edit_player_path(player) %></li>
   <% end %>
-  </ul>
+  </ol>
 <% end %>
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>
diff --git a/yarn.lock b/yarn.lock
index d086f29..b7f82b2 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -6583,11 +6583,6 @@ tty-browserify@0.0.0:
   resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6"
   integrity sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=
 
-turbolinks@^5.2.0:
-  version "5.2.0"
-  resolved "https://registry.yarnpkg.com/turbolinks/-/turbolinks-5.2.0.tgz#e6877a55ea5c1cb3bb225f0a4ae303d6d32ff77c"
-  integrity sha512-pMiez3tyBo6uRHFNNZoYMmrES/IaGgMhQQM+VFF36keryjb5ms0XkVpmKHkfW/4Vy96qiGW3K9bz0tF5sK9bBw==
-
 type-is@~1.6.17, type-is@~1.6.18:
   version "1.6.18"
   resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131"