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.
Files changed (132) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +113 -18
  3. data/Rakefile +19 -2
  4. data/app/assets/javascripts/turbo.js +4143 -1431
  5. data/app/assets/javascripts/turbo.min.js +29 -0
  6. data/app/assets/javascripts/turbo.min.js.map +1 -0
  7. data/app/channels/turbo/streams/broadcasts.rb +58 -22
  8. data/app/channels/turbo/streams/stream_name.rb +7 -0
  9. data/app/channels/turbo/streams_channel.rb +30 -2
  10. data/app/controllers/concerns/turbo/request_id_tracking.rb +12 -0
  11. data/app/controllers/turbo/frames/frame_request.rb +22 -8
  12. data/app/controllers/turbo/native/navigation.rb +19 -9
  13. data/app/helpers/turbo/drive_helper.rb +75 -3
  14. data/app/helpers/turbo/frames_helper.rb +21 -2
  15. data/app/helpers/turbo/includes_helper.rb +2 -0
  16. data/app/helpers/turbo/streams/action_helper.rb +34 -9
  17. data/app/helpers/turbo/streams_helper.rb +20 -7
  18. data/app/javascript/turbo/cable.js +6 -3
  19. data/app/javascript/turbo/cable_stream_source_element.js +19 -3
  20. data/app/javascript/turbo/fetch_requests.js +59 -0
  21. data/app/javascript/turbo/index.js +6 -0
  22. data/app/javascript/turbo/snakeize.js +31 -0
  23. data/app/jobs/turbo/streams/action_broadcast_job.rb +4 -2
  24. data/app/jobs/turbo/streams/broadcast_job.rb +2 -0
  25. data/app/jobs/turbo/streams/broadcast_stream_job.rb +7 -0
  26. data/app/models/concerns/turbo/broadcastable.rb +246 -38
  27. data/app/models/turbo/debouncer.rb +24 -0
  28. data/app/models/turbo/streams/tag_builder.rb +163 -21
  29. data/app/models/turbo/thread_debouncer.rb +28 -0
  30. data/app/views/layouts/turbo_rails/frame.html.erb +8 -0
  31. data/config/routes.rb +1 -2
  32. data/lib/install/turbo_needs_redis.rb +20 -0
  33. data/lib/install/turbo_with_bun.rb +9 -0
  34. data/lib/install/turbo_with_importmap.rb +5 -0
  35. data/lib/install/turbo_with_node.rb +9 -0
  36. data/lib/tasks/turbo_tasks.rake +50 -8
  37. data/lib/turbo/broadcastable/test_helper.rb +172 -0
  38. data/lib/turbo/engine.rb +40 -6
  39. data/lib/turbo/test_assertions/integration_test_assertions.rb +76 -0
  40. data/lib/turbo/test_assertions.rb +69 -8
  41. data/lib/turbo/version.rb +1 -1
  42. data/lib/turbo-rails.rb +12 -0
  43. metadata +48 -173
  44. data/.github/workflows/ci.yml +0 -30
  45. data/.gitignore +0 -2
  46. data/Gemfile +0 -6
  47. data/Gemfile.lock +0 -147
  48. data/lib/install/turbo_with_asset_pipeline.rb +0 -20
  49. data/lib/install/turbo_with_webpacker.rb +0 -24
  50. data/package.json +0 -47
  51. data/rollup.config.js +0 -23
  52. data/test/drive/drive_helper_test.rb +0 -8
  53. data/test/dummy/.babelrc +0 -18
  54. data/test/dummy/.gitignore +0 -3
  55. data/test/dummy/.postcssrc.yml +0 -3
  56. data/test/dummy/Rakefile +0 -6
  57. data/test/dummy/app/assets/config/manifest.js +0 -2
  58. data/test/dummy/app/assets/images/.keep +0 -0
  59. data/test/dummy/app/assets/stylesheets/application.css +0 -15
  60. data/test/dummy/app/assets/stylesheets/scaffold.css +0 -80
  61. data/test/dummy/app/channels/application_cable/channel.rb +0 -4
  62. data/test/dummy/app/channels/application_cable/connection.rb +0 -4
  63. data/test/dummy/app/controllers/application_controller.rb +0 -2
  64. data/test/dummy/app/controllers/concerns/.keep +0 -0
  65. data/test/dummy/app/controllers/messages_controller.rb +0 -12
  66. data/test/dummy/app/controllers/trays_controller.rb +0 -17
  67. data/test/dummy/app/helpers/application_helper.rb +0 -2
  68. data/test/dummy/app/javascript/packs/application.js +0 -0
  69. data/test/dummy/app/jobs/application_job.rb +0 -2
  70. data/test/dummy/app/mailboxes/application_mailbox.rb +0 -2
  71. data/test/dummy/app/mailboxes/messages_mailbox.rb +0 -4
  72. data/test/dummy/app/mailers/application_mailer.rb +0 -4
  73. data/test/dummy/app/models/application_record.rb +0 -3
  74. data/test/dummy/app/models/concerns/.keep +0 -0
  75. data/test/dummy/app/models/message.rb +0 -29
  76. data/test/dummy/app/views/layouts/application.html.erb +0 -14
  77. data/test/dummy/app/views/layouts/mailer.html.erb +0 -13
  78. data/test/dummy/app/views/layouts/mailer.text.erb +0 -1
  79. data/test/dummy/app/views/messages/_message.html.erb +0 -1
  80. data/test/dummy/app/views/messages/_message.turbo_stream.erb +0 -1
  81. data/test/dummy/app/views/messages/show.turbo_stream.erb +0 -9
  82. data/test/dummy/app/views/trays/index.html.erb +0 -3
  83. data/test/dummy/app/views/trays/show.html.erb +0 -3
  84. data/test/dummy/bin/bundle +0 -3
  85. data/test/dummy/bin/rails +0 -4
  86. data/test/dummy/bin/rake +0 -4
  87. data/test/dummy/bin/setup +0 -36
  88. data/test/dummy/bin/update +0 -31
  89. data/test/dummy/bin/yarn +0 -11
  90. data/test/dummy/config/application.rb +0 -22
  91. data/test/dummy/config/boot.rb +0 -5
  92. data/test/dummy/config/cable.yml +0 -10
  93. data/test/dummy/config/environment.rb +0 -5
  94. data/test/dummy/config/environments/development.rb +0 -34
  95. data/test/dummy/config/environments/production.rb +0 -96
  96. data/test/dummy/config/environments/test.rb +0 -38
  97. data/test/dummy/config/initializers/application_controller_renderer.rb +0 -8
  98. data/test/dummy/config/initializers/assets.rb +0 -14
  99. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  100. data/test/dummy/config/initializers/content_security_policy.rb +0 -22
  101. data/test/dummy/config/initializers/cookies_serializer.rb +0 -5
  102. data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  103. data/test/dummy/config/initializers/inflections.rb +0 -16
  104. data/test/dummy/config/initializers/mime_types.rb +0 -4
  105. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  106. data/test/dummy/config/locales/en.yml +0 -33
  107. data/test/dummy/config/puma.rb +0 -34
  108. data/test/dummy/config/routes.rb +0 -4
  109. data/test/dummy/config/spring.rb +0 -6
  110. data/test/dummy/config/webpack/development.js +0 -3
  111. data/test/dummy/config/webpack/environment.js +0 -3
  112. data/test/dummy/config/webpack/production.js +0 -3
  113. data/test/dummy/config/webpack/test.js +0 -3
  114. data/test/dummy/config/webpacker.yml +0 -65
  115. data/test/dummy/config.ru +0 -5
  116. data/test/dummy/lib/assets/.keep +0 -0
  117. data/test/dummy/log/.keep +0 -0
  118. data/test/dummy/public/404.html +0 -67
  119. data/test/dummy/public/422.html +0 -67
  120. data/test/dummy/public/500.html +0 -66
  121. data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
  122. data/test/dummy/public/apple-touch-icon.png +0 -0
  123. data/test/dummy/public/favicon.ico +0 -0
  124. data/test/frames/frame_request_controller_test.rb +0 -21
  125. data/test/frames/frames_helper_test.rb +0 -21
  126. data/test/native/navigation_controller_test.rb +0 -42
  127. data/test/streams/broadcastable_test.rb +0 -80
  128. data/test/streams/streams_channel_test.rb +0 -105
  129. data/test/streams/streams_controller_test.rb +0 -29
  130. data/test/turbo_test.rb +0 -10
  131. data/turbo-rails.gemspec +0 -17
  132. 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
- }
@@ -1,8 +0,0 @@
1
- require "turbo_test"
2
-
3
- class Turbo::DriveHelperTest < ActionDispatch::IntegrationTest
4
- test "opting out of the default cache" do
5
- get trays_path
6
- assert_select "meta", name: "turbo-cache-control", content: "no-cache"
7
- end
8
- end
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
- }
@@ -1,3 +0,0 @@
1
- *.log
2
- *.sqlite3
3
- tmp/*
@@ -1,3 +0,0 @@
1
- plugins:
2
- postcss-import: {}
3
- postcss-cssnext: {}
data/test/dummy/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- # Add your own tasks in files placed in lib/tasks ending in .rake,
2
- # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
-
4
- require_relative 'config/application'
5
-
6
- Rails.application.load_tasks
@@ -1,2 +0,0 @@
1
- //= link_tree ../images
2
- //= link_directory ../stylesheets .css
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
- }
@@ -1,4 +0,0 @@
1
- module ApplicationCable
2
- class Channel < ActionCable::Channel::Base
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- module ApplicationCable
2
- class Connection < ActionCable::Connection::Base
3
- end
4
- end
@@ -1,2 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
- end
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
@@ -1,2 +0,0 @@
1
- module ApplicationHelper
2
- end
File without changes
@@ -1,2 +0,0 @@
1
- class ApplicationJob < ActiveJob::Base
2
- end
@@ -1,2 +0,0 @@
1
- class ApplicationMailbox < ActionMailbox::Base
2
- end
@@ -1,4 +0,0 @@
1
- class MessagesMailbox < ApplicationMailbox
2
- def process
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- class ApplicationMailer < ActionMailer::Base
2
- default from: 'from@example.com'
3
- layout 'mailer'
4
- end
@@ -1,3 +0,0 @@
1
- class ApplicationRecord < ActiveRecord::Base
2
- self.abstract_class = true
3
- end
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,14 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Dummy</title>
5
- <%= csrf_meta_tags %>
6
-
7
- <%= stylesheet_link_tag 'application', media: 'all' %>
8
- <%= yield :head %>
9
- </head>
10
-
11
- <body>
12
- <%= yield %>
13
- </body>
14
- </html>
@@ -1,13 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
- <style>
6
- /* Email styles need to be inline */
7
- </style>
8
- </head>
9
-
10
- <body>
11
- <%= yield %>
12
- </body>
13
- </html>
@@ -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!") } %>
@@ -1,3 +0,0 @@
1
- <% turbo_exempts_page_from_cache %>
2
-
3
- <p>Not in the cache!</p>
@@ -1,3 +0,0 @@
1
- <turbo-frame id="tray">
2
- <div>This is a tray!</div>
3
- </turbo-frame>
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
3
- load Gem.bin_path('bundler', 'bundle')
data/test/dummy/bin/rails DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../config/application', __dir__)
3
- require_relative '../config/boot'
4
- require 'rails/commands'
data/test/dummy/bin/rake DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require_relative '../config/boot'
3
- require 'rake'
4
- Rake.application.run
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