turbo-rails 0.5.3 → 0.5.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -1
- data/app/assets/javascripts/turbo.js +243 -129
- data/app/helpers/turbo/includes_helper.rb +2 -0
- data/app/helpers/turbo/streams_helper.rb +2 -2
- data/app/models/concerns/turbo/broadcastable.rb +8 -3
- data/lib/install/turbo_with_asset_pipeline.rb +19 -3
- data/lib/install/turbo_with_webpacker.rb +1 -2
- data/lib/turbo/engine.rb +1 -1
- data/lib/turbo/version.rb +1 -1
- metadata +7 -173
- data/.github/workflows/ci.yml +0 -30
- data/.gitignore +0 -2
- data/Gemfile +0 -6
- data/Gemfile.lock +0 -147
- 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.ru +0 -5
- 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/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 -111
- 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/package.json
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "@hotwired/turbo-rails",
|
3
|
-
"version": "7.0.0-beta.3",
|
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.2",
|
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
|