about summary refs log tree commit diff
path: root/app/views
diff options
context:
space:
mode:
Diffstat (limited to 'app/views')
-rw-r--r--app/views/layouts/application.html.erb9
-rw-r--r--app/views/machines/index.html.erb4
-rw-r--r--app/views/pages/index.html.erb1
-rw-r--r--app/views/players/index.html.erb30
4 files changed, 34 insertions, 10 deletions
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index cc2f6c2..7795f10 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -12,12 +12,11 @@
 
   <body>
     <nav>
-      <%= link_to 'Home', '/' %>
-      <%= link_to 'Pins', machines_url %>
-      <%= link_to 'Players', players_url %>
-      <%= link_to 'Randomize', controller: 'pages', action: 'randomize' %>
+      <%= link_to 'Home', root_path, class: "#{"current" if current_page?(root_path)}" %>
+      <%= link_to 'Pins', machines_path, class: "#{"current" if current_page?(machines_path)}" %>
+      <%= link_to 'Players', players_path, class: "#{"current" if current_page?(players_path)}" %>
+      <%= link_to 'Randomize', {controller: 'pages', action: 'randomize'}, class: "#{"current" if current_page?(controller: 'pages', action: 'randomize')}" %>
     </nav>
-
     <%= yield %>
   </body>
 </html>
diff --git a/app/views/machines/index.html.erb b/app/views/machines/index.html.erb
index 8237518..3791f6c 100644
--- a/app/views/machines/index.html.erb
+++ b/app/views/machines/index.html.erb
@@ -1,4 +1,4 @@
-<p style="color: green"><%= notice %></p>
+<% if not notice.nil? %><p style="color: green"><%= notice %></p><% end %>
 
 <h1>Pins</h1>
 
@@ -8,5 +8,7 @@
   <% end %>
 </div>
 
+<p><%= pluralize(@machines.count, 'total pin') %></p>
+
 <hr>
 <%= link_to "Add a pin", new_machine_path %>
diff --git a/app/views/pages/index.html.erb b/app/views/pages/index.html.erb
index 809ea04..ddfa22f 100644
--- a/app/views/pages/index.html.erb
+++ b/app/views/pages/index.html.erb
@@ -1,2 +1,3 @@
 <h1>Knockout</h1>
 <p>To start the tournament, add players and make sure that the pins are up to date. Then hit randomize to automatically pick teams!</p>
+<p>The source code for this app can be found <a href="https://tildegit.org/ben/pinrails">here</a>.</p>
\ No newline at end of file
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 %>