add players controller and start homepage

This commit is contained in:
Ben Harris 2021-08-21 23:43:16 -04:00
parent 819a3edae4
commit 4cc1a2f9dc
12 changed files with 82 additions and 12 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

View File

@ -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%;
}

View File

@ -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/

View File

@ -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/

View File

@ -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

View File

@ -0,0 +1,4 @@
class PagesController < ApplicationController
def index
end
end

View File

@ -39,7 +39,7 @@ class PlayersController < ApplicationController
@player = Player.find(params[:id])
@player.destroy
redirect_to player_path
redirect_to players_path
end
private

View File

@ -10,6 +10,16 @@
</head>
<body>
<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>

View File

@ -0,0 +1,3 @@
<h1>nomi pinball</h1>
<%= image_tag "coinslotlogo.png" %>

View File

@ -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

View File

@ -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

0
vendor/.keep vendored Normal file
View File