switch to turbo
This commit is contained in:
parent
54901541e3
commit
68f5f71701
6
Gemfile
6
Gemfile
|
@ -13,12 +13,12 @@ gem 'puma', '~> 5.4'
|
||||||
gem 'sass-rails', '>= 6'
|
gem 'sass-rails', '>= 6'
|
||||||
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
|
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
|
||||||
gem 'webpacker', '~> 5.4'
|
gem 'webpacker', '~> 5.4'
|
||||||
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
|
# https://github.com/hotwired/turbo-rails
|
||||||
gem 'turbolinks', '~> 5'
|
gem 'turbo-rails'
|
||||||
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
||||||
gem 'jbuilder', '~> 2.11'
|
gem 'jbuilder', '~> 2.11'
|
||||||
# Use Redis adapter to run Action Cable in production
|
# Use Redis adapter to run Action Cable in production
|
||||||
# gem 'redis', '~> 4.0'
|
gem 'redis', '~> 4.0'
|
||||||
# Use Active Model has_secure_password
|
# Use Active Model has_secure_password
|
||||||
# gem 'bcrypt', '~> 3.1.7'
|
# gem 'bcrypt', '~> 3.1.7'
|
||||||
|
|
||||||
|
|
|
@ -147,6 +147,7 @@ GEM
|
||||||
rb-fsevent (0.11.0)
|
rb-fsevent (0.11.0)
|
||||||
rb-inotify (0.10.1)
|
rb-inotify (0.10.1)
|
||||||
ffi (~> 1.0)
|
ffi (~> 1.0)
|
||||||
|
redis (4.4.0)
|
||||||
regexp_parser (2.1.1)
|
regexp_parser (2.1.1)
|
||||||
rubyzip (2.3.2)
|
rubyzip (2.3.2)
|
||||||
sass-rails (6.0.0)
|
sass-rails (6.0.0)
|
||||||
|
@ -177,9 +178,8 @@ GEM
|
||||||
sqlite3 (1.4.2)
|
sqlite3 (1.4.2)
|
||||||
thor (1.1.0)
|
thor (1.1.0)
|
||||||
tilt (2.0.10)
|
tilt (2.0.10)
|
||||||
turbolinks (5.2.1)
|
turbo-rails (0.7.4)
|
||||||
turbolinks-source (~> 5.2)
|
rails (>= 6.0.0)
|
||||||
turbolinks-source (5.2.0)
|
|
||||||
tzinfo (2.0.4)
|
tzinfo (2.0.4)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
web-console (4.1.0)
|
web-console (4.1.0)
|
||||||
|
@ -211,12 +211,13 @@ DEPENDENCIES
|
||||||
pry-rails
|
pry-rails
|
||||||
puma (~> 5.4)
|
puma (~> 5.4)
|
||||||
rails (~> 6.1.4, >= 6.0.3.7)
|
rails (~> 6.1.4, >= 6.0.3.7)
|
||||||
|
redis (~> 4.0)
|
||||||
sass-rails (>= 6)
|
sass-rails (>= 6)
|
||||||
selenium-webdriver
|
selenium-webdriver
|
||||||
spring
|
spring
|
||||||
spring-watcher-listen (~> 2.0.0)
|
spring-watcher-listen (~> 2.0.0)
|
||||||
sqlite3 (~> 1.4)
|
sqlite3 (~> 1.4)
|
||||||
turbolinks (~> 5)
|
turbo-rails
|
||||||
tzinfo-data
|
tzinfo-data
|
||||||
web-console (>= 4.1.0)
|
web-console (>= 4.1.0)
|
||||||
webpacker (~> 5.4)
|
webpacker (~> 5.4)
|
||||||
|
|
|
@ -6,14 +6,14 @@ class PagesController < ApplicationController
|
||||||
def teampicker
|
def teampicker
|
||||||
@groups = maketeams
|
@groups = maketeams
|
||||||
|
|
||||||
@machines = Machine.limit(@groups.count).order(Arel.sql("RANDOM()"))
|
@machines = Machine.limit(@groups.size).order(Arel.sql("RANDOM()"))
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def maketeams
|
def maketeams
|
||||||
r = Player.where("strikes < 4").order(Arel.sql("RANDOM()")).to_a
|
r = Player.where("strikes < 4").order(Arel.sql("RANDOM()")).to_a
|
||||||
|
|
||||||
groups = case r.count
|
groups = case r.size
|
||||||
when 5
|
when 5
|
||||||
[r.shift(3), r.shift(2)]
|
[r.shift(3), r.shift(2)]
|
||||||
when 6
|
when 6
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
// that code so it'll be compiled.
|
// that code so it'll be compiled.
|
||||||
|
|
||||||
require("@rails/ujs").start()
|
require("@rails/ujs").start()
|
||||||
require("turbolinks").start()
|
|
||||||
require("@rails/activestorage").start()
|
require("@rails/activestorage").start()
|
||||||
require("channels")
|
require("channels")
|
||||||
|
|
||||||
|
@ -15,3 +14,5 @@ require("channels")
|
||||||
//
|
//
|
||||||
// const images = require.context('../images', true)
|
// const images = require.context('../images', true)
|
||||||
// const imagePath = (name) => images(name, true)
|
// const imagePath = (name) => images(name, true)
|
||||||
|
|
||||||
|
import "@hotwired/turbo-rails"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<h1>Pinball Machines</h1>
|
<h1>Pinball Machines</h1>
|
||||||
|
|
||||||
<p><%= @machines.count %> available machines</p>
|
<p><%= @machines.size %> available machines</p>
|
||||||
<ul>
|
<ul>
|
||||||
<% @machines.each do |machine| %>
|
<% @machines.each do |machine| %>
|
||||||
<li>
|
<li>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<h1>Pinball Players</h1>
|
<h1>Pinball Players</h1>
|
||||||
|
|
||||||
<p><%= @players.count %> available players</p>
|
<p><%= @players.size %> available players</p>
|
||||||
<ul>
|
<ul>
|
||||||
<% @players.each do |player| %>
|
<% @players.each do |player| %>
|
||||||
<li>
|
<li>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
development:
|
development:
|
||||||
adapter: async
|
adapter: redis
|
||||||
|
url: redis://localhost:6379/1
|
||||||
|
|
||||||
test:
|
test:
|
||||||
adapter: test
|
adapter: test
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
"name": "pinrails",
|
"name": "pinrails",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@hotwired/turbo-rails": "^7.0.0-rc.1",
|
||||||
"@rails/actioncable": "^6.0.0",
|
"@rails/actioncable": "^6.0.0",
|
||||||
"@rails/activestorage": "^6.0.0",
|
"@rails/activestorage": "^6.0.0",
|
||||||
"@rails/ujs": "^6.0.0",
|
"@rails/ujs": "^6.0.0",
|
||||||
"@rails/webpacker": "5.4.2",
|
"@rails/webpacker": "5.4.2",
|
||||||
"turbolinks": "^5.2.0",
|
|
||||||
"webpack": "^4.46.0",
|
"webpack": "^4.46.0",
|
||||||
"webpack-cli": "^3.3.12"
|
"webpack-cli": "^3.3.12"
|
||||||
},
|
},
|
||||||
|
|
13
yarn.lock
13
yarn.lock
|
@ -885,6 +885,19 @@
|
||||||
resolved "https://registry.yarnpkg.com/@csstools/convert-colors/-/convert-colors-1.4.0.tgz#ad495dc41b12e75d588c6db8b9834f08fa131eb7"
|
resolved "https://registry.yarnpkg.com/@csstools/convert-colors/-/convert-colors-1.4.0.tgz#ad495dc41b12e75d588c6db8b9834f08fa131eb7"
|
||||||
integrity sha512-5a6wqoJV/xEdbRNKVo6I4hO3VjyDq//8q2f9I6PBAvMesJHFauXDorcNCsr9RzvsZnaWi5NYCcfyqP1QeFHFbw==
|
integrity sha512-5a6wqoJV/xEdbRNKVo6I4hO3VjyDq//8q2f9I6PBAvMesJHFauXDorcNCsr9RzvsZnaWi5NYCcfyqP1QeFHFbw==
|
||||||
|
|
||||||
|
"@hotwired/turbo-rails@^7.0.0-rc.1":
|
||||||
|
version "7.0.0-rc.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@hotwired/turbo-rails/-/turbo-rails-7.0.0-rc.1.tgz#68cc07b2a1e7d9b29240c525c657722b3f0c3842"
|
||||||
|
integrity sha512-LLOgtHWb/cnz0bXlfJ9khWHapQuCOuUI48yiSVgL3veklvbX1vyQlk/ALn35Z6nHTi7Bf+MHMS9H5W2c/vwKuw==
|
||||||
|
dependencies:
|
||||||
|
"@hotwired/turbo" "^7.0.0-rc.1"
|
||||||
|
"@rails/actioncable" "^6.0.0"
|
||||||
|
|
||||||
|
"@hotwired/turbo@^7.0.0-rc.1":
|
||||||
|
version "7.0.0-rc.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@hotwired/turbo/-/turbo-7.0.0-rc.1.tgz#a5c1be86def1cc39b3011c935c5734b8632af5c3"
|
||||||
|
integrity sha512-niNA68ku4TZYbV3biwTPf1L5CidP50S2xfeb5rGQfodvPB9UAtkqKFFRIA0LL8y0DG4MGIZ/QFlbvlmFea5p4w==
|
||||||
|
|
||||||
"@nodelib/fs.scandir@2.1.5":
|
"@nodelib/fs.scandir@2.1.5":
|
||||||
version "2.1.5"
|
version "2.1.5"
|
||||||
resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5"
|
resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5"
|
||||||
|
|
Loading…
Reference in New Issue