Browse Source

add delete button to list views

master
Ben Harris 4 months ago
parent
commit
848c59f15e
  1. 4
      app/views/layouts/application.html.erb
  2. 6
      app/views/machines/index.html.erb
  3. 3
      app/views/pages/index.html.erb
  4. 4
      app/views/pages/teampicker.html.erb
  5. 5
      app/views/players/edit.html.erb
  6. 5
      app/views/players/index.html.erb
  7. 5
      yarn.lock

4
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>

6
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 %>

3
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>

4
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 %>

5
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>

5
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>

5
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"

Loading…
Cancel
Save