Browse Source

add players controller and start homepage

master
Ben Harris 5 months ago
parent
commit
4cc1a2f9dc
  1. BIN
      app/assets/images/coinslotlogo.png
  2. 54
      app/assets/stylesheets/application.css
  3. 3
      app/assets/stylesheets/machines.scss
  4. 3
      app/assets/stylesheets/players.scss
  5. 7
      app/controllers/machines_controller.rb
  6. 4
      app/controllers/pages_controller.rb
  7. 2
      app/controllers/players_controller.rb
  8. 12
      app/views/layouts/application.html.erb
  9. 3
      app/views/pages/index.html.erb
  10. 2
      config/environments/development.rb
  11. 4
      config/routes.rb
  12. 0
      vendor/.keep

BIN
app/assets/images/coinslotlogo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

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

3
app/assets/stylesheets/machines.scss

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

3
app/assets/stylesheets/players.scss

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

7
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

4
app/controllers/pages_controller.rb

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

2
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

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

3
app/views/pages/index.html.erb

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

2
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

4
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

0
vendor/.keep

Loading…
Cancel
Save