diff options
Diffstat (limited to 'app/views/players')
-rw-r--r-- | app/views/players/index.html.erb | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/app/views/players/index.html.erb b/app/views/players/index.html.erb index c067483..eb209b0 100644 --- a/app/views/players/index.html.erb +++ b/app/views/players/index.html.erb @@ -1,12 +1,34 @@ -<p style="color: green"><%= notice %></p> +<% if not notice.nil? %><p style="color: green"><%= notice %></p><% end %> <h1>Players</h1> <div id="players"> - <% @players.each do |player| %> - <%= render player %> - <% end %> + <table> + <thead> + <th>Name</th> + <th>Paid</th> + <th>Strikes</th> + <th>Delete</th> + </thead> + <tbody> + <% @players.each do |player| %> + <tr> + <td><%= link_to player.name, player %></td> + <td> + <% if player.paid %>✓ + <% end %></td> + <td><%= player.strikes %></td> + <td><%= link_to "X", player, data: { + turbo_method: :delete, + turbo_confirm: "Are you sure you want to remove #{player.name}?" + } %></td> + </tr> + <% end %> + </tbody> + </table> </div> +<p><%= pluralize(@players.count, 'total player') %></p> + <hr> <%= link_to "Add a player", new_player_path %> |