add delete button to list views

This commit is contained in:
Ben Harris 2021-09-27 01:33:06 -04:00
parent f9ea5e999a
commit 848c59f15e
7 changed files with 15 additions and 17 deletions

View File

@ -21,10 +21,6 @@
<hr> <hr>
<%= yield %> <%= yield %>
<footer>
<center><a href="https://tildegit.org/ben/pinrails">source code here</a></center>
</footer>
</main> </main>
</body> </body>
</html> </html>

View File

@ -1,16 +1,19 @@
<h1>Pinball Machines</h1> <h1>Pinball Machines</h1>
<table> <table>
<thead> <thead>
<th>Name</th> <th>Name</th>
<th>Edition</th> <th>Edition</th>
<th>Delete</th>
</thead> </thead>
<tbody> <tbody>
<% @machines.each do |machine| %> <% @machines.each do |machine| %>
<tr> <tr>
<td><%= link_to machine.name, edit_machine_path(machine) %></td> <td><%= link_to machine.name, edit_machine_path(machine) %></td>
<td><%= machine.edition %></td> <td><%= machine.edition %></td>
<td><%= link_to "X", machine_path(machine),
method: :delete,
data: { confirm: "Are you sure?" } %></td>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>
@ -19,4 +22,3 @@
<hr> <hr>
<p><%= @machines.size %> available machines</p> <p><%= @machines.size %> available machines</p>
<%= link_to "+ Add Machine", new_machine_path %> <%= link_to "+ Add Machine", new_machine_path %>

View File

@ -1,3 +1,6 @@
<h1>nomi pinball</h1> <h1>nomi pinball</h1>
<%= image_tag "coinslotlogo.png" %> <%= image_tag "coinslotlogo.png" %>
<footer>
<center><a href="https://tildegit.org/ben/pinrails">source code here</a></center>
</footer>

View File

@ -3,9 +3,9 @@
<% @groups.each.with_index(1) do |slice, i| %> <% @groups.each.with_index(1) do |slice, i| %>
<h2>Team <%= i %></h2> <h2>Team <%= i %></h2>
<p>Table: <%= @machines[i - 1].name %></p> <p>Table: <%= @machines[i - 1].name %></p>
<ul> <ol>
<% slice.each do |player| %> <% slice.each do |player| %>
<li><%= link_to player.name, edit_player_path(player) %></li> <li><%= link_to player.name, edit_player_path(player) %></li>
<% end %> <% end %>
</ul> </ol>
<% end %> <% end %>

View File

@ -2,7 +2,6 @@
<%= render "form", machine: @player %> <%= render "form", machine: @player %>
<%= link_to "Delete #{@player.name}", player_path(@player), <p><%= link_to "Delete #{@player.name}", player_path(@player),
method: :delete, method: :delete,
data: { confirm: "Are you sure?" } %> data: { confirm: "Are you sure?" } %></p>

View File

@ -1,11 +1,11 @@
<h1>Pinball Players</h1> <h1>Pinball Players</h1>
<table> <table>
<thead> <thead>
<th>Name</th> <th>Name</th>
<th>Paid</th> <th>Paid</th>
<th>Strikes</th> <th>Strikes</th>
<th>Delete</th>
</thead> </thead>
<tbody> <tbody>
<% @players.order("strikes").each do |player| %> <% @players.order("strikes").each do |player| %>
@ -13,6 +13,9 @@
<td><%= link_to player.name, edit_player_path(player) %></td> <td><%= link_to player.name, edit_player_path(player) %></td>
<td><% if player.paid %>✓<% end %></td> <td><% if player.paid %>✓<% end %></td>
<td><%= player.strikes %></td> <td><%= player.strikes %></td>
<td><%= link_to "X", player_path(player),
method: :delete,
data: { confirm: "Are you sure?" } %></td>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>

View File

@ -6583,11 +6583,6 @@ tty-browserify@0.0.0:
resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6" resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6"
integrity sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY= 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: type-is@~1.6.17, type-is@~1.6.18:
version "1.6.18" version "1.6.18"
resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131"