diff options
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/machines/_form.html.erb | 2 | ||||
-rw-r--r-- | app/views/machines/edit.html.erb | 4 | ||||
-rw-r--r-- | app/views/machines/index.html.erb | 27 | ||||
-rw-r--r-- | app/views/pages/index.html.erb | 16 | ||||
-rw-r--r-- | app/views/players/_form.html.erb | 2 | ||||
-rw-r--r-- | app/views/players/edit.html.erb | 2 | ||||
-rw-r--r-- | app/views/players/index.html.erb | 30 |
7 files changed, 46 insertions, 37 deletions
diff --git a/app/views/machines/_form.html.erb b/app/views/machines/_form.html.erb index 1f693aa..d7edc05 100644 --- a/app/views/machines/_form.html.erb +++ b/app/views/machines/_form.html.erb @@ -1,4 +1,4 @@ -<%= form_with model: @machine do |form| %> +<%= form_with model: @machine, data: { "turbo" => "false" } do |form| %> <br> <div> <%= form.label :name %><br> diff --git a/app/views/machines/edit.html.erb b/app/views/machines/edit.html.erb index 7fd30ce..477a0ee 100644 --- a/app/views/machines/edit.html.erb +++ b/app/views/machines/edit.html.erb @@ -2,3 +2,7 @@ <%= render "form", machine: @machine %> +<p><%= link_to "Delete #{@machine.name}", machine_path(@machine), + method: :delete, + data: { confirm: "Are you sure?" } %></p> + diff --git a/app/views/machines/index.html.erb b/app/views/machines/index.html.erb index 33e279b..5abd2c2 100644 --- a/app/views/machines/index.html.erb +++ b/app/views/machines/index.html.erb @@ -1,13 +1,22 @@ <h1>Pinball Machines</h1> + +<table> + <thead> + <th>Name</th> + <th>Edition</th> + </thead> + <tbody> + <% @machines.each do |machine| %> + <tr> + <td><%= link_to machine.name, edit_machine_path(machine) %></td> + <td><%= machine.edition %></td> + </tr> + <% end %> + </tbody> +</table> + +<hr> <p><%= @machines.size %> available machines</p> -<ul> - <% @machines.each do |machine| %> - <li> - <%= link_to machine.name, machine %> - </li> - <% end %> -</ul> - -<%= link_to "Add Machine", new_machine_path %> +<%= link_to "+ Add Machine", new_machine_path %> diff --git a/app/views/pages/index.html.erb b/app/views/pages/index.html.erb index 7bac76b..bccab8f 100644 --- a/app/views/pages/index.html.erb +++ b/app/views/pages/index.html.erb @@ -1,19 +1,3 @@ <h1>nomi pinball</h1> <%= image_tag "coinslotlogo.png" %> -<table> - <thead> - <th>Name</th> - <th>Paid</th> - <th>Strikes</th> - </thead> - <tbody> - <% @players.order("strikes").each do |player| %> - <tr> - <td><%= link_to player.name, edit_player_path(player) %></td> - <td><%= player.paid %></td> - <td><%= player.strikes %></td> - </tr> - <% end %> - </tbody> -</table> diff --git a/app/views/players/_form.html.erb b/app/views/players/_form.html.erb index 170b6d3..5e20a27 100644 --- a/app/views/players/_form.html.erb +++ b/app/views/players/_form.html.erb @@ -1,4 +1,4 @@ -<%= form_with model: @player do |form| %> +<%= form_with model: @player, data: { "turbo" => "false" } do |form| %> <br> <div> <%= form.label :name %><br> diff --git a/app/views/players/edit.html.erb b/app/views/players/edit.html.erb index 49cf670..1504b65 100644 --- a/app/views/players/edit.html.erb +++ b/app/views/players/edit.html.erb @@ -2,7 +2,7 @@ <%= render "form", machine: @player %> -<%= link_to "Delete", player_path(@player), +<%= link_to "Delete #{@player.name}", player_path(@player), method: :delete, data: { confirm: "Are you sure?" } %> diff --git a/app/views/players/index.html.erb b/app/views/players/index.html.erb index 7ad7944..aea4252 100644 --- a/app/views/players/index.html.erb +++ b/app/views/players/index.html.erb @@ -1,13 +1,25 @@ <h1>Pinball Players</h1> + +<table> + <thead> + <th>Name</th> + <th>Paid</th> + <th>Strikes</th> + </thead> + <tbody> + <% @players.order("strikes").each do |player| %> + <tr> + <td><%= link_to player.name, edit_player_path(player) %></td> + <td><% if player.paid %>✓<% end %></td> + <td><%= player.strikes %></td> + </tr> + <% end %> + </tbody> +</table> + +<hr> <p><%= @players.size %> available players</p> -<ul> - <% @players.each do |player| %> - <li> - <%= link_to player.name, player %> - </li> - <% end %> -</ul> - -<%= link_to "Add player", new_player_path %> + +<%= link_to "+ Add player", new_player_path %> |