From 4cc1a2f9dc215f91e969269002496b611d933e32 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Sat, 21 Aug 2021 23:43:16 -0400 Subject: add players controller and start homepage --- app/assets/images/coinslotlogo.png | Bin 0 -> 71390 bytes app/assets/stylesheets/application.css | 54 +++++++++++++++++++++++++++++++++ app/assets/stylesheets/machines.scss | 3 -- app/assets/stylesheets/players.scss | 3 -- app/controllers/machines_controller.rb | 7 ++++- app/controllers/pages_controller.rb | 4 +++ app/controllers/players_controller.rb | 2 +- app/views/layouts/application.html.erb | 12 +++++++- app/views/pages/index.html.erb | 3 ++ config/environments/development.rb | 2 +- config/routes.rb | 4 +-- vendor/.keep | 0 12 files changed, 82 insertions(+), 12 deletions(-) create mode 100644 app/assets/images/coinslotlogo.png delete mode 100644 app/assets/stylesheets/machines.scss delete mode 100644 app/assets/stylesheets/players.scss create mode 100644 app/controllers/pages_controller.rb create mode 100644 app/views/pages/index.html.erb create mode 100644 vendor/.keep diff --git a/app/assets/images/coinslotlogo.png b/app/assets/images/coinslotlogo.png new file mode 100644 index 0000000..495364c Binary files /dev/null and b/app/assets/images/coinslotlogo.png differ diff --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 @@ - <%= yield %> +
+ +
+ + <%= yield %> +
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 @@ +

nomi pinball

+<%= 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 -- cgit 1.4.1