From 848c59f15e83c0571be956726284d8d9180679b4 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Mon, 27 Sep 2021 01:33:06 -0400 Subject: add delete button to list views --- app/views/players/edit.html.erb | 5 ++--- app/views/players/index.html.erb | 5 ++++- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'app/views/players') 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), +

<%= link_to "Delete #{@player.name}", player_path(@player), method: :delete, - data: { confirm: "Are you sure?" } %> - + data: { confirm: "Are you sure?" } %>

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

Pinball Players

- + <% @players.order("strikes").each do |player| %> @@ -13,6 +13,9 @@ + <% end %> -- cgit 1.4.1
Name Paid StrikesDelete
<%= link_to player.name, edit_player_path(player) %> <% if player.paid %>✓<% end %> <%= player.strikes %><%= link_to "X", player_path(player), + method: :delete, + data: { confirm: "Are you sure?" } %>