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.erb6
-rw-r--r--app/views/pages/index.html.erb28
2 files changed, 31 insertions, 3 deletions
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 47f7f24..f5f0f2b 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -13,9 +13,9 @@
     <main>
       <nav>
         <%= link_to "Home", root_path %> ~
-        <%= link_to "Manage Tables", machines_path %> ~
-        <%= link_to "Add Players", players_path %> ~
-        <%= link_to "Pick Random Table", controller: "machines", action: "random" %>
+        <%= link_to "Tables", machines_path %> ~
+        <%= link_to "Players", players_path %> ~
+        <%= link_to "Pick Random", controller: "machines", action: "random" %>
       </nav>
       <hr>
 
diff --git a/app/views/pages/index.html.erb b/app/views/pages/index.html.erb
index bccab8f..e53eece 100644
--- a/app/views/pages/index.html.erb
+++ b/app/views/pages/index.html.erb
@@ -1,3 +1,31 @@
 <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><%= player.name %></td>
+        <td><%= player.paid %></td>
+        <td><%= player.strikes %></td>
+      </tr>
+    <% end %>
+  </tbody>
+</table>
+
+<h2>teampicker</h2>
+
+<% @players.order(Arel.sql("RANDOM()")).each_slice(@players.count % 4 == 0 ? 4 : 3).each.with_index(1) do |slice, i| %>
+  <h3>Team <%= i %></h3>
+  <ul>
+  <% slice.each do |player| %>
+    <li><%= player.name %></li>
+  <% end %>
+  </ul>
+<% end %>
+