about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBen Harris <ben@tilde.team>2021-08-21 23:43:16 -0400
committerBen Harris <ben@tilde.team>2021-08-21 23:43:16 -0400
commit4cc1a2f9dc215f91e969269002496b611d933e32 (patch)
tree3ce174b1f9417a07fda71d7482b38d8ee4138c1b
parent819a3edae405227f11283ad494a7f4ca9c771467 (diff)
add players controller and start homepage
-rw-r--r--app/assets/images/coinslotlogo.pngbin0 -> 71390 bytes
-rw-r--r--app/assets/stylesheets/application.css54
-rw-r--r--app/assets/stylesheets/machines.scss3
-rw-r--r--app/assets/stylesheets/players.scss3
-rw-r--r--app/controllers/machines_controller.rb7
-rw-r--r--app/controllers/pages_controller.rb4
-rw-r--r--app/controllers/players_controller.rb2
-rw-r--r--app/views/layouts/application.html.erb12
-rw-r--r--app/views/pages/index.html.erb3
-rw-r--r--config/environments/development.rb2
-rw-r--r--config/routes.rb4
-rw-r--r--vendor/.keep0
12 files changed, 82 insertions, 12 deletions
diff --git a/app/assets/images/coinslotlogo.png b/app/assets/images/coinslotlogo.png
new file mode 100644
index 0000000..495364c
--- /dev/null
+++ b/app/assets/images/coinslotlogo.png
Binary files differdiff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css
index d05ea0f..61eef33 100644
--- a/app/assets/stylesheets/application.css
+++ b/app/assets/stylesheets/application.css
@@ -13,3 +13,57 @@
  *= require_tree .
  *= require_self
  */
+
+main {
+  -webkit-font-feature-settings: "liga" on, "calt" on;
+  -webkit-font-smoothing: antialiased;
+  text-rendering: optimizeLegibility;
+  font-family: 'JetBrains Mono', 'Input Mono', monospace;
+  max-width: 38rem;
+  padding: 2rem;
+  margin: auto;
+}
+
+@media only screen and (max-device-width: 736px) {
+  main {
+    padding: 0.2rem;
+  }
+}
+
+::selection {
+  background: #9c0018;
+}
+
+body {
+  background: #282828;
+  color:      #ebdbb2;
+}
+
+pre {
+  background-color: #3c3836;
+  padding: 1em;
+  border: 0;
+}
+
+a, a:active, a:visited {
+  color: #e491b6;
+  background-color: #1d2021;
+}
+
+h1, h2, h3, h4, h5 {
+  margin-bottom: .1rem;
+}
+
+blockquote {
+  border-left: 1px solid #bdae93;
+  margin: 0.5em 10px;
+  padding: 0.5em 10px;
+}
+
+footer {
+  align: center;
+}
+
+img {
+  max-width: 100%;
+}
diff --git a/app/assets/stylesheets/machines.scss b/app/assets/stylesheets/machines.scss
deleted file mode 100644
index 1cabf09..0000000
--- a/app/assets/stylesheets/machines.scss
+++ /dev/null
@@ -1,3 +0,0 @@
-// Place all the styles related to the Machines controller here.
-// They will automatically be included in application.css.
-// You can use Sass (SCSS) here: https://sass-lang.com/
diff --git a/app/assets/stylesheets/players.scss b/app/assets/stylesheets/players.scss
deleted file mode 100644
index a74761d..0000000
--- a/app/assets/stylesheets/players.scss
+++ /dev/null
@@ -1,3 +0,0 @@
-// Place all the styles related to the Players controller here.
-// They will automatically be included in application.css.
-// You can use Sass (SCSS) here: https://sass-lang.com/
diff --git a/app/controllers/machines_controller.rb b/app/controllers/machines_controller.rb
index 24c90e7..3145fd1 100644
--- a/app/controllers/machines_controller.rb
+++ b/app/controllers/machines_controller.rb
@@ -1,4 +1,9 @@
 class MachinesController < ApplicationController
+  def random
+    @machine = Machine.order(Arel.sql("RANDOM()")).first
+    render :show
+  end
+
   def index
     @machines = Machine.order("name")
   end
@@ -39,7 +44,7 @@ class MachinesController < ApplicationController
     @machine = Machine.find(params[:id])
     @machine.destroy
 
-    redirect_to root_path
+    redirect_to machines_path
   end
 
   private
diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb
new file mode 100644
index 0000000..39848c6
--- /dev/null
+++ b/app/controllers/pages_controller.rb
@@ -0,0 +1,4 @@
+class PagesController < ApplicationController
+  def index
+  end
+end
diff --git a/app/controllers/players_controller.rb b/app/controllers/players_controller.rb
index e129114..c67e4dd 100644
--- a/app/controllers/players_controller.rb
+++ b/app/controllers/players_controller.rb
@@ -39,7 +39,7 @@ class PlayersController < ApplicationController
     @player = Player.find(params[:id])
     @player.destroy
 
-    redirect_to player_path
+    redirect_to players_path
   end
 
   private
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 4b286d2..47f7f24 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -10,6 +10,16 @@
   </head>
 
   <body>
-    <%= yield %>
+    <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" %>
+      </nav>
+      <hr>
+
+      <%= yield %>
+    </main>
   </body>
 </html>
diff --git a/app/views/pages/index.html.erb b/app/views/pages/index.html.erb
new file mode 100644
index 0000000..bccab8f
--- /dev/null
+++ b/app/views/pages/index.html.erb
@@ -0,0 +1,3 @@
+<h1>nomi pinball</h1>
+<%= image_tag "coinslotlogo.png" %>
+
diff --git a/config/environments/development.rb b/config/environments/development.rb
index c06462a..f3c06d0 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -1,6 +1,6 @@
 Rails.application.configure do
   config.hosts << "odin"
-  config.web_console.permissions = '192.168.1.120'
+  config.web_console.permissions = '192.168.1.1/24'
   # Settings specified here will take precedence over those in config/application.rb.
 
   # In the development environment your application's code is reloaded on
diff --git a/config/routes.rb b/config/routes.rb
index ce59bbe..895a87c 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,6 +1,6 @@
 Rails.application.routes.draw do
-  root "machines#index"
-
+  root 'pages#index'
+  get 'random', to: 'machines#random'
   resources :machines
   resources :players
 end
diff --git a/vendor/.keep b/vendor/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/vendor/.keep