turbo-rails 0.5.2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +113 -18
- data/Rakefile +19 -2
- data/app/assets/javascripts/turbo.js +4143 -1431
- data/app/assets/javascripts/turbo.min.js +29 -0
- data/app/assets/javascripts/turbo.min.js.map +1 -0
- data/app/channels/turbo/streams/broadcasts.rb +58 -22
- data/app/channels/turbo/streams/stream_name.rb +7 -0
- data/app/channels/turbo/streams_channel.rb +30 -2
- data/app/controllers/concerns/turbo/request_id_tracking.rb +12 -0
- data/app/controllers/turbo/frames/frame_request.rb +22 -8
- data/app/controllers/turbo/native/navigation.rb +19 -9
- data/app/helpers/turbo/drive_helper.rb +75 -3
- data/app/helpers/turbo/frames_helper.rb +21 -2
- data/app/helpers/turbo/includes_helper.rb +2 -0
- data/app/helpers/turbo/streams/action_helper.rb +34 -9
- data/app/helpers/turbo/streams_helper.rb +20 -7
- data/app/javascript/turbo/cable.js +6 -3
- data/app/javascript/turbo/cable_stream_source_element.js +19 -3
- data/app/javascript/turbo/fetch_requests.js +59 -0
- data/app/javascript/turbo/index.js +6 -0
- data/app/javascript/turbo/snakeize.js +31 -0
- data/app/jobs/turbo/streams/action_broadcast_job.rb +4 -2
- data/app/jobs/turbo/streams/broadcast_job.rb +2 -0
- data/app/jobs/turbo/streams/broadcast_stream_job.rb +7 -0
- data/app/models/concerns/turbo/broadcastable.rb +246 -38
- data/app/models/turbo/debouncer.rb +24 -0
- data/app/models/turbo/streams/tag_builder.rb +163 -21
- data/app/models/turbo/thread_debouncer.rb +28 -0
- data/app/views/layouts/turbo_rails/frame.html.erb +8 -0
- data/config/routes.rb +1 -2
- data/lib/install/turbo_needs_redis.rb +20 -0
- data/lib/install/turbo_with_bun.rb +9 -0
- data/lib/install/turbo_with_importmap.rb +5 -0
- data/lib/install/turbo_with_node.rb +9 -0
- data/lib/tasks/turbo_tasks.rake +50 -8
- data/lib/turbo/broadcastable/test_helper.rb +172 -0
- data/lib/turbo/engine.rb +40 -6
- data/lib/turbo/test_assertions/integration_test_assertions.rb +76 -0
- data/lib/turbo/test_assertions.rb +69 -8
- data/lib/turbo/version.rb +1 -1
- data/lib/turbo-rails.rb +12 -0
- metadata +48 -173
- data/.github/workflows/ci.yml +0 -30
- data/.gitignore +0 -2
- data/Gemfile +0 -6
- data/Gemfile.lock +0 -147
- data/lib/install/turbo_with_asset_pipeline.rb +0 -20
- data/lib/install/turbo_with_webpacker.rb +0 -24
- data/package.json +0 -47
- data/rollup.config.js +0 -23
- data/test/drive/drive_helper_test.rb +0 -8
- data/test/dummy/.babelrc +0 -18
- data/test/dummy/.gitignore +0 -3
- data/test/dummy/.postcssrc.yml +0 -3
- data/test/dummy/Rakefile +0 -6
- data/test/dummy/app/assets/config/manifest.js +0 -2
- data/test/dummy/app/assets/images/.keep +0 -0
- data/test/dummy/app/assets/stylesheets/application.css +0 -15
- data/test/dummy/app/assets/stylesheets/scaffold.css +0 -80
- data/test/dummy/app/channels/application_cable/channel.rb +0 -4
- data/test/dummy/app/channels/application_cable/connection.rb +0 -4
- data/test/dummy/app/controllers/application_controller.rb +0 -2
- data/test/dummy/app/controllers/concerns/.keep +0 -0
- data/test/dummy/app/controllers/messages_controller.rb +0 -12
- data/test/dummy/app/controllers/trays_controller.rb +0 -17
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/javascript/packs/application.js +0 -0
- data/test/dummy/app/jobs/application_job.rb +0 -2
- data/test/dummy/app/mailboxes/application_mailbox.rb +0 -2
- data/test/dummy/app/mailboxes/messages_mailbox.rb +0 -4
- data/test/dummy/app/mailers/application_mailer.rb +0 -4
- data/test/dummy/app/models/application_record.rb +0 -3
- data/test/dummy/app/models/concerns/.keep +0 -0
- data/test/dummy/app/models/message.rb +0 -29
- data/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/dummy/app/views/layouts/mailer.html.erb +0 -13
- data/test/dummy/app/views/layouts/mailer.text.erb +0 -1
- data/test/dummy/app/views/messages/_message.html.erb +0 -1
- data/test/dummy/app/views/messages/_message.turbo_stream.erb +0 -1
- data/test/dummy/app/views/messages/show.turbo_stream.erb +0 -9
- data/test/dummy/app/views/trays/index.html.erb +0 -3
- data/test/dummy/app/views/trays/show.html.erb +0 -3
- data/test/dummy/bin/bundle +0 -3
- data/test/dummy/bin/rails +0 -4
- data/test/dummy/bin/rake +0 -4
- data/test/dummy/bin/setup +0 -36
- data/test/dummy/bin/update +0 -31
- data/test/dummy/bin/yarn +0 -11
- data/test/dummy/config/application.rb +0 -22
- data/test/dummy/config/boot.rb +0 -5
- data/test/dummy/config/cable.yml +0 -10
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -34
- data/test/dummy/config/environments/production.rb +0 -96
- data/test/dummy/config/environments/test.rb +0 -38
- data/test/dummy/config/initializers/application_controller_renderer.rb +0 -8
- data/test/dummy/config/initializers/assets.rb +0 -14
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/content_security_policy.rb +0 -22
- data/test/dummy/config/initializers/cookies_serializer.rb +0 -5
- data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/test/dummy/config/initializers/inflections.rb +0 -16
- data/test/dummy/config/initializers/mime_types.rb +0 -4
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/locales/en.yml +0 -33
- data/test/dummy/config/puma.rb +0 -34
- data/test/dummy/config/routes.rb +0 -4
- data/test/dummy/config/spring.rb +0 -6
- data/test/dummy/config/webpack/development.js +0 -3
- data/test/dummy/config/webpack/environment.js +0 -3
- data/test/dummy/config/webpack/production.js +0 -3
- data/test/dummy/config/webpack/test.js +0 -3
- data/test/dummy/config/webpacker.yml +0 -65
- data/test/dummy/config.ru +0 -5
- data/test/dummy/lib/assets/.keep +0 -0
- data/test/dummy/log/.keep +0 -0
- data/test/dummy/public/404.html +0 -67
- data/test/dummy/public/422.html +0 -67
- data/test/dummy/public/500.html +0 -66
- data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/test/dummy/public/apple-touch-icon.png +0 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/frames/frame_request_controller_test.rb +0 -21
- data/test/frames/frames_helper_test.rb +0 -21
- data/test/native/navigation_controller_test.rb +0 -42
- data/test/streams/broadcastable_test.rb +0 -80
- data/test/streams/streams_channel_test.rb +0 -105
- data/test/streams/streams_controller_test.rb +0 -29
- data/test/turbo_test.rb +0 -10
- data/turbo-rails.gemspec +0 -17
- data/yarn.lock +0 -283
data/Gemfile.lock
DELETED
@@ -1,147 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
turbo-rails (0.5.1)
|
5
|
-
rails (>= 6.0.0)
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
actioncable (6.1.0)
|
11
|
-
actionpack (= 6.1.0)
|
12
|
-
activesupport (= 6.1.0)
|
13
|
-
nio4r (~> 2.0)
|
14
|
-
websocket-driver (>= 0.6.1)
|
15
|
-
actionmailbox (6.1.0)
|
16
|
-
actionpack (= 6.1.0)
|
17
|
-
activejob (= 6.1.0)
|
18
|
-
activerecord (= 6.1.0)
|
19
|
-
activestorage (= 6.1.0)
|
20
|
-
activesupport (= 6.1.0)
|
21
|
-
mail (>= 2.7.1)
|
22
|
-
actionmailer (6.1.0)
|
23
|
-
actionpack (= 6.1.0)
|
24
|
-
actionview (= 6.1.0)
|
25
|
-
activejob (= 6.1.0)
|
26
|
-
activesupport (= 6.1.0)
|
27
|
-
mail (~> 2.5, >= 2.5.4)
|
28
|
-
rails-dom-testing (~> 2.0)
|
29
|
-
actionpack (6.1.0)
|
30
|
-
actionview (= 6.1.0)
|
31
|
-
activesupport (= 6.1.0)
|
32
|
-
rack (~> 2.0, >= 2.0.9)
|
33
|
-
rack-test (>= 0.6.3)
|
34
|
-
rails-dom-testing (~> 2.0)
|
35
|
-
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
36
|
-
actiontext (6.1.0)
|
37
|
-
actionpack (= 6.1.0)
|
38
|
-
activerecord (= 6.1.0)
|
39
|
-
activestorage (= 6.1.0)
|
40
|
-
activesupport (= 6.1.0)
|
41
|
-
nokogiri (>= 1.8.5)
|
42
|
-
actionview (6.1.0)
|
43
|
-
activesupport (= 6.1.0)
|
44
|
-
builder (~> 3.1)
|
45
|
-
erubi (~> 1.4)
|
46
|
-
rails-dom-testing (~> 2.0)
|
47
|
-
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
48
|
-
activejob (6.1.0)
|
49
|
-
activesupport (= 6.1.0)
|
50
|
-
globalid (>= 0.3.6)
|
51
|
-
activemodel (6.1.0)
|
52
|
-
activesupport (= 6.1.0)
|
53
|
-
activerecord (6.1.0)
|
54
|
-
activemodel (= 6.1.0)
|
55
|
-
activesupport (= 6.1.0)
|
56
|
-
activestorage (6.1.0)
|
57
|
-
actionpack (= 6.1.0)
|
58
|
-
activejob (= 6.1.0)
|
59
|
-
activerecord (= 6.1.0)
|
60
|
-
activesupport (= 6.1.0)
|
61
|
-
marcel (~> 0.3.1)
|
62
|
-
mimemagic (~> 0.3.2)
|
63
|
-
activesupport (6.1.0)
|
64
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
65
|
-
i18n (>= 1.6, < 2)
|
66
|
-
minitest (>= 5.1)
|
67
|
-
tzinfo (~> 2.0)
|
68
|
-
zeitwerk (~> 2.3)
|
69
|
-
builder (3.2.4)
|
70
|
-
byebug (11.0.1)
|
71
|
-
concurrent-ruby (1.1.7)
|
72
|
-
crass (1.0.6)
|
73
|
-
erubi (1.10.0)
|
74
|
-
globalid (0.4.2)
|
75
|
-
activesupport (>= 4.2.0)
|
76
|
-
i18n (1.8.5)
|
77
|
-
concurrent-ruby (~> 1.0)
|
78
|
-
loofah (2.8.0)
|
79
|
-
crass (~> 1.0.2)
|
80
|
-
nokogiri (>= 1.5.9)
|
81
|
-
mail (2.7.1)
|
82
|
-
mini_mime (>= 0.1.1)
|
83
|
-
marcel (0.3.3)
|
84
|
-
mimemagic (~> 0.3.2)
|
85
|
-
method_source (1.0.0)
|
86
|
-
mimemagic (0.3.5)
|
87
|
-
mini_mime (1.0.2)
|
88
|
-
mini_portile2 (2.4.0)
|
89
|
-
minitest (5.14.2)
|
90
|
-
nio4r (2.5.4)
|
91
|
-
nokogiri (1.10.10)
|
92
|
-
mini_portile2 (~> 2.4.0)
|
93
|
-
rack (2.2.3)
|
94
|
-
rack-test (1.1.0)
|
95
|
-
rack (>= 1.0, < 3)
|
96
|
-
rails (6.1.0)
|
97
|
-
actioncable (= 6.1.0)
|
98
|
-
actionmailbox (= 6.1.0)
|
99
|
-
actionmailer (= 6.1.0)
|
100
|
-
actionpack (= 6.1.0)
|
101
|
-
actiontext (= 6.1.0)
|
102
|
-
actionview (= 6.1.0)
|
103
|
-
activejob (= 6.1.0)
|
104
|
-
activemodel (= 6.1.0)
|
105
|
-
activerecord (= 6.1.0)
|
106
|
-
activestorage (= 6.1.0)
|
107
|
-
activesupport (= 6.1.0)
|
108
|
-
bundler (>= 1.15.0)
|
109
|
-
railties (= 6.1.0)
|
110
|
-
sprockets-rails (>= 2.0.0)
|
111
|
-
rails-dom-testing (2.0.3)
|
112
|
-
activesupport (>= 4.2.0)
|
113
|
-
nokogiri (>= 1.6)
|
114
|
-
rails-html-sanitizer (1.3.0)
|
115
|
-
loofah (~> 2.3)
|
116
|
-
railties (6.1.0)
|
117
|
-
actionpack (= 6.1.0)
|
118
|
-
activesupport (= 6.1.0)
|
119
|
-
method_source
|
120
|
-
rake (>= 0.8.7)
|
121
|
-
thor (~> 1.0)
|
122
|
-
rake (13.0.0)
|
123
|
-
sprockets (4.0.2)
|
124
|
-
concurrent-ruby (~> 1.0)
|
125
|
-
rack (> 1, < 3)
|
126
|
-
sprockets-rails (3.2.2)
|
127
|
-
actionpack (>= 4.0)
|
128
|
-
activesupport (>= 4.0)
|
129
|
-
sprockets (>= 3.0.0)
|
130
|
-
thor (1.0.1)
|
131
|
-
tzinfo (2.0.4)
|
132
|
-
concurrent-ruby (~> 1.0)
|
133
|
-
websocket-driver (0.7.3)
|
134
|
-
websocket-extensions (>= 0.1.0)
|
135
|
-
websocket-extensions (0.1.5)
|
136
|
-
zeitwerk (2.4.2)
|
137
|
-
|
138
|
-
PLATFORMS
|
139
|
-
ruby
|
140
|
-
|
141
|
-
DEPENDENCIES
|
142
|
-
byebug
|
143
|
-
rake
|
144
|
-
turbo-rails!
|
145
|
-
|
146
|
-
BUNDLED WITH
|
147
|
-
2.1.4
|
@@ -1,20 +0,0 @@
|
|
1
|
-
APPLICATION_LAYOUT_PATH = Rails.root.join("app/views/layouts/application.html.erb")
|
2
|
-
|
3
|
-
if APPLICATION_LAYOUT_PATH.exist?
|
4
|
-
say "Yield head in application layout for cache helper"
|
5
|
-
insert_into_file APPLICATION_LAYOUT_PATH.to_s, "\n <%= yield :head %>", before: /\s*<\/head>/
|
6
|
-
|
7
|
-
say "Add Turbo include tags in application layout"
|
8
|
-
insert_into_file APPLICATION_LAYOUT_PATH.to_s, "\n <%= turbo_include_tags %>", before: /\s*<\/head>/
|
9
|
-
else
|
10
|
-
say "Default application.html.erb is missing!", :red
|
11
|
-
say " Add <%= turbo_include_tags %> and <%= yield :head %> within the <head> tag in your custom layout."
|
12
|
-
end
|
13
|
-
|
14
|
-
say "Enable redis in bundle"
|
15
|
-
uncomment_lines "Gemfile", %(gem 'redis')
|
16
|
-
|
17
|
-
say "Switch development cable to use redis"
|
18
|
-
gsub_file "config/cable.yml", /development:\n\s+adapter: async/, "development:\n adapter: redis\n url: redis://localhost:6379/1"
|
19
|
-
|
20
|
-
say "Turbo successfully installed ⚡️", :green
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# Some Rails versions use commonJS(require) others use ESM(import).
|
2
|
-
TURBOLINKS_REGEX = /(import .* from "turbolinks".*\n|require\("turbolinks"\).*\n)/.freeze
|
3
|
-
|
4
|
-
abort "❌ Webpacker not found. Exiting." unless defined?(Webpacker::Engine)
|
5
|
-
|
6
|
-
say "Install Turbo"
|
7
|
-
run "yarn add @hotwired/turbo-rails"
|
8
|
-
insert_into_file "#{Webpacker.config.source_entry_path}/application.js",
|
9
|
-
"import \"@hotwired/turbo-rails\"\n", before: TURBOLINKS_REGEX
|
10
|
-
|
11
|
-
say "Remove Turbolinks"
|
12
|
-
gsub_file 'Gemfile', /gem 'turbolinks'.*/, ''
|
13
|
-
run "bin/bundle", capture: true
|
14
|
-
run "bin/yarn remove turbolinks"
|
15
|
-
gsub_file "#{Webpacker.config.source_entry_path}/application.js", TURBOLINKS_REGEX, ''
|
16
|
-
gsub_file "#{Webpacker.config.source_entry_path}/application.js", /Turbolinks.start.*\n/, ''
|
17
|
-
|
18
|
-
say "Enable redis in bundle"
|
19
|
-
uncomment_lines "Gemfile", %(gem 'redis')
|
20
|
-
|
21
|
-
say "Switch development cable to use redis"
|
22
|
-
gsub_file "config/cable.yml", /development:\n\s+adapter: async/, "development:\n adapter: redis\n url: redis://localhost:6379/1"
|
23
|
-
|
24
|
-
say "Turbo successfully installed ⚡️", :green
|
data/package.json
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "@hotwired/turbo-rails",
|
3
|
-
"version": "7.0.0-beta.2",
|
4
|
-
"description": "The speed of a single-page web application without having to write any JavaScript",
|
5
|
-
"module": "app/javascript/turbo/index.js",
|
6
|
-
"main": "app/assets/javascripts/turbo.js",
|
7
|
-
"files": [
|
8
|
-
"app/javascript/turbo"
|
9
|
-
],
|
10
|
-
"scripts": {
|
11
|
-
"build": "rollup -c",
|
12
|
-
"prerelease": "yarn build && git --no-pager diff && echo && npm pack --dry-run && echo && read -n 1 -p \"Look OK? Press any key to publish and commit v$npm_package_version\" && echo",
|
13
|
-
"release": "npm publish && git commit -am \"$npm_package_name v$npm_package_version\" && git push"
|
14
|
-
},
|
15
|
-
"dependencies": {
|
16
|
-
"@hotwired/turbo": "^7.0.0-beta.1",
|
17
|
-
"@rails/actioncable": "^6.1.0"
|
18
|
-
},
|
19
|
-
"devDependencies": {
|
20
|
-
"@rollup/plugin-node-resolve": "^11.0.1",
|
21
|
-
"rollup": "^2.35.1",
|
22
|
-
"rollup-plugin-terser": "^7.0.2"
|
23
|
-
},
|
24
|
-
"license": "MIT",
|
25
|
-
"author": "Basecamp, LLC",
|
26
|
-
"contributors": [
|
27
|
-
"David Heinemeier Hansson <david@basecamp.com>",
|
28
|
-
"Javan Makhmali <javan@javan.us>",
|
29
|
-
"Sam Stephenson <sstephenson@gmail.com>"
|
30
|
-
],
|
31
|
-
"keywords": [
|
32
|
-
"hotwire",
|
33
|
-
"turbo",
|
34
|
-
"rails"
|
35
|
-
],
|
36
|
-
"repository": {
|
37
|
-
"type": "git",
|
38
|
-
"url": "git+https://github.com/hotwired/turbo-rails.git"
|
39
|
-
},
|
40
|
-
"bugs": {
|
41
|
-
"url": "https://github.com/hotwired/turbo-rails/issues"
|
42
|
-
},
|
43
|
-
"homepage": "https://github.com/hotwired/turbo-rails",
|
44
|
-
"publishConfig": {
|
45
|
-
"access": "public"
|
46
|
-
}
|
47
|
-
}
|
data/rollup.config.js
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
import resolve from "@rollup/plugin-node-resolve"
|
2
|
-
import { terser } from "rollup-plugin-terser"
|
3
|
-
import pkg from "./package.json"
|
4
|
-
|
5
|
-
export default {
|
6
|
-
input: pkg.module,
|
7
|
-
output: {
|
8
|
-
file: pkg.main,
|
9
|
-
format: "es",
|
10
|
-
inlineDynamicImports: true
|
11
|
-
},
|
12
|
-
plugins: [
|
13
|
-
resolve(),
|
14
|
-
terser({
|
15
|
-
mangle: false,
|
16
|
-
compress: false,
|
17
|
-
format: {
|
18
|
-
beautify: true,
|
19
|
-
indent_level: 2
|
20
|
-
}
|
21
|
-
})
|
22
|
-
]
|
23
|
-
}
|
data/test/dummy/.babelrc
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"presets": [
|
3
|
-
["env", {
|
4
|
-
"modules": false,
|
5
|
-
"targets": {
|
6
|
-
"browsers": "> 1%",
|
7
|
-
"uglify": true
|
8
|
-
},
|
9
|
-
"useBuiltIns": true
|
10
|
-
}]
|
11
|
-
],
|
12
|
-
|
13
|
-
"plugins": [
|
14
|
-
"syntax-dynamic-import",
|
15
|
-
"transform-object-rest-spread",
|
16
|
-
["transform-class-properties", { "spec": true }]
|
17
|
-
]
|
18
|
-
}
|
data/test/dummy/.gitignore
DELETED
data/test/dummy/.postcssrc.yml
DELETED
data/test/dummy/Rakefile
DELETED
File without changes
|
@@ -1,15 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
-
* listed below.
|
4
|
-
*
|
5
|
-
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
-
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
-
*
|
8
|
-
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
-
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
-
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
-
* It is generally better to create a new file per style scope.
|
12
|
-
*
|
13
|
-
*= require_tree .
|
14
|
-
*= require_self
|
15
|
-
*/
|
@@ -1,80 +0,0 @@
|
|
1
|
-
body {
|
2
|
-
background-color: #fff;
|
3
|
-
color: #333;
|
4
|
-
margin: 33px;
|
5
|
-
}
|
6
|
-
|
7
|
-
body, p, ol, ul, td {
|
8
|
-
font-family: verdana, arial, helvetica, sans-serif;
|
9
|
-
font-size: 13px;
|
10
|
-
line-height: 18px;
|
11
|
-
}
|
12
|
-
|
13
|
-
pre {
|
14
|
-
background-color: #eee;
|
15
|
-
padding: 10px;
|
16
|
-
font-size: 11px;
|
17
|
-
}
|
18
|
-
|
19
|
-
a {
|
20
|
-
color: #000;
|
21
|
-
}
|
22
|
-
|
23
|
-
a:visited {
|
24
|
-
color: #666;
|
25
|
-
}
|
26
|
-
|
27
|
-
a:hover {
|
28
|
-
color: #fff;
|
29
|
-
background-color: #000;
|
30
|
-
}
|
31
|
-
|
32
|
-
th {
|
33
|
-
padding-bottom: 5px;
|
34
|
-
}
|
35
|
-
|
36
|
-
td {
|
37
|
-
padding: 0 5px 7px;
|
38
|
-
}
|
39
|
-
|
40
|
-
div.field,
|
41
|
-
div.actions {
|
42
|
-
margin-bottom: 10px;
|
43
|
-
}
|
44
|
-
|
45
|
-
#notice {
|
46
|
-
color: green;
|
47
|
-
}
|
48
|
-
|
49
|
-
.field_with_errors {
|
50
|
-
padding: 2px;
|
51
|
-
background-color: red;
|
52
|
-
display: table;
|
53
|
-
}
|
54
|
-
|
55
|
-
#error_explanation {
|
56
|
-
width: 450px;
|
57
|
-
border: 2px solid red;
|
58
|
-
padding: 7px 7px 0;
|
59
|
-
margin-bottom: 20px;
|
60
|
-
background-color: #f0f0f0;
|
61
|
-
}
|
62
|
-
|
63
|
-
#error_explanation h2 {
|
64
|
-
text-align: left;
|
65
|
-
font-weight: bold;
|
66
|
-
padding: 5px 5px 5px 15px;
|
67
|
-
font-size: 12px;
|
68
|
-
margin: -7px -7px 0;
|
69
|
-
background-color: #c00;
|
70
|
-
color: #fff;
|
71
|
-
}
|
72
|
-
|
73
|
-
#error_explanation ul li {
|
74
|
-
font-size: 12px;
|
75
|
-
list-style: square;
|
76
|
-
}
|
77
|
-
|
78
|
-
label {
|
79
|
-
display: block;
|
80
|
-
}
|
File without changes
|
@@ -1,12 +0,0 @@
|
|
1
|
-
class MessagesController < ApplicationController
|
2
|
-
def show
|
3
|
-
@message = Message.new(record_id: 1, content: "My message")
|
4
|
-
end
|
5
|
-
|
6
|
-
def create
|
7
|
-
respond_to do |format|
|
8
|
-
format.html { redirect_to message_url(id: 1) }
|
9
|
-
format.turbo_stream { render turbo_stream: turbo_stream.append(:messages, "message_1") }
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
class TraysController < ApplicationController
|
2
|
-
def show
|
3
|
-
end
|
4
|
-
|
5
|
-
def create
|
6
|
-
case params[:return_to]
|
7
|
-
when "recede_or_redirect" then recede_or_redirect_to tray_url(id: 1)
|
8
|
-
when "resume_or_redirect" then resume_or_redirect_to tray_url(id: 1)
|
9
|
-
when "refresh_or_redirect" then refresh_or_redirect_to tray_url(id: 1)
|
10
|
-
when "recede_or_redirect_back" then recede_or_redirect_back_or_to tray_url(id: 5)
|
11
|
-
when "resume_or_redirect_back" then resume_or_redirect_back_or_to tray_url(id: 5)
|
12
|
-
when "refresh_or_redirect_back" then refresh_or_redirect_back_or_to tray_url(id: 5)
|
13
|
-
else
|
14
|
-
raise "Supply return_to to direct response"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
File without changes
|
File without changes
|
@@ -1,29 +0,0 @@
|
|
1
|
-
class Message
|
2
|
-
include Turbo::Broadcastable
|
3
|
-
|
4
|
-
attr_reader :record_id, :content
|
5
|
-
|
6
|
-
def initialize(record_id:, content:)
|
7
|
-
@record_id, @content = record_id, content
|
8
|
-
end
|
9
|
-
|
10
|
-
def to_key
|
11
|
-
[ record_id ]
|
12
|
-
end
|
13
|
-
|
14
|
-
def to_param
|
15
|
-
"message:#{record_id}"
|
16
|
-
end
|
17
|
-
|
18
|
-
def to_partial_path
|
19
|
-
"messages/message"
|
20
|
-
end
|
21
|
-
|
22
|
-
def to_s
|
23
|
-
content
|
24
|
-
end
|
25
|
-
|
26
|
-
def model_name
|
27
|
-
ActiveModel::Name.new(self.class)
|
28
|
-
end
|
29
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= yield %>
|
@@ -1 +0,0 @@
|
|
1
|
-
<p><%= message %></p>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= turbo_stream.replace "message_1" do %>Goodbye!<% end %>
|
@@ -1,9 +0,0 @@
|
|
1
|
-
<%= turbo_stream.remove @message %>
|
2
|
-
<%= turbo_stream.replace @message %>
|
3
|
-
<%= turbo_stream.replace @message, "Something else" %>
|
4
|
-
<%= turbo_stream.replace "message_5", "Something fifth" %>
|
5
|
-
<%= turbo_stream.replace "message_5", partial: "messages/message", locals: { message: Message.new(record_id: 5, content: "OLLA!") } %>
|
6
|
-
<%= turbo_stream.append "messages", @message %>
|
7
|
-
<%= turbo_stream.append "messages", partial: "messages/message", locals: { message: Message.new(record_id: 5, content: "OLLA!") } %>
|
8
|
-
<%= turbo_stream.prepend "messages", @message %>
|
9
|
-
<%= turbo_stream.prepend "messages", partial: "messages/message", locals: { message: Message.new(record_id: 5, content: "OLLA!") } %>
|
data/test/dummy/bin/bundle
DELETED
data/test/dummy/bin/rails
DELETED
data/test/dummy/bin/rake
DELETED
data/test/dummy/bin/setup
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require 'fileutils'
|
3
|
-
include FileUtils
|
4
|
-
|
5
|
-
# path to your application root.
|
6
|
-
APP_ROOT = File.expand_path('..', __dir__)
|
7
|
-
|
8
|
-
def system!(*args)
|
9
|
-
system(*args) || abort("\n== Command #{args} failed ==")
|
10
|
-
end
|
11
|
-
|
12
|
-
chdir APP_ROOT do
|
13
|
-
# This script is a starting point to setup your application.
|
14
|
-
# Add necessary setup steps to this file.
|
15
|
-
|
16
|
-
puts '== Installing dependencies =='
|
17
|
-
system! 'gem install bundler --conservative'
|
18
|
-
system('bundle check') || system!('bundle install')
|
19
|
-
|
20
|
-
# Install JavaScript dependencies if using Yarn
|
21
|
-
# system('bin/yarn')
|
22
|
-
|
23
|
-
# puts "\n== Copying sample files =="
|
24
|
-
# unless File.exist?('config/database.yml')
|
25
|
-
# cp 'config/database.yml.sample', 'config/database.yml'
|
26
|
-
# end
|
27
|
-
|
28
|
-
puts "\n== Preparing database =="
|
29
|
-
system! 'bin/rails db:setup'
|
30
|
-
|
31
|
-
puts "\n== Removing old logs and tempfiles =="
|
32
|
-
system! 'bin/rails log:clear tmp:clear'
|
33
|
-
|
34
|
-
puts "\n== Restarting application server =="
|
35
|
-
system! 'bin/rails restart'
|
36
|
-
end
|