turbo-rails 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +13 -0
- data/app/helpers/turbo/frames_helper.rb +4 -4
- data/app/helpers/turbo/streams/action_helper.rb +2 -2
- data/lib/turbo/engine.rb +3 -1
- data/lib/turbo/version.rb +1 -1
- data/package.json +4 -1
- data/yarn.lock +3 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a04c56491cef79ef30cdf087a1f1e4cd33d7673ac2cc48e239dfdda1d72eba9
|
4
|
+
data.tar.gz: 8c5e1082280c5663717638e3b78c136542b8692d952f2547880140efffc5abea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14d8247c79082e8b6d495492b0b955703f8739247ce39c0604ca384b9b9d43e33d8509e1a5adfa97283cfa9420df3be0bd887b3109ec0784e67d83b2c952eefa
|
7
|
+
data.tar.gz: b8211e86013e1919df5099c830a5fe22964b8f4ef2cd59871da0d08d8152dc88e639992ac26dfedf9bc6e57cae1a62af20577e1dd103c85563e5203f9c27d562
|
data/README.md
CHANGED
@@ -48,7 +48,20 @@ If you use Webpacker, it's:
|
|
48
48
|
```js
|
49
49
|
import { Turbo, cable } from "@hotwired/turbo-rails"
|
50
50
|
```
|
51
|
+
|
52
|
+
Note, if you were using Turbolinks/Rails UJS in your app previously, you should remove them:
|
51
53
|
|
54
|
+
1. Remove the `turbolinks` gem from your Gemfile.
|
55
|
+
2. Run `./bin/bundle install`
|
56
|
+
3. Run `./bin/yarn remove turbolinks @rails/ujs`
|
57
|
+
4. Remove these from your application's JavaScript pack:
|
58
|
+
|
59
|
+
```js
|
60
|
+
import Rails from "@rails/ujs"
|
61
|
+
import Turbolinks from "turbolinks"
|
62
|
+
Rails.start()
|
63
|
+
Turbolinks.start()
|
64
|
+
```
|
52
65
|
|
53
66
|
## Usage
|
54
67
|
|
@@ -4,19 +4,19 @@ module Turbo::FramesHelper
|
|
4
4
|
#
|
5
5
|
# === Examples
|
6
6
|
#
|
7
|
-
# # => turbo-frame id="tray" src="http://example.com/trays/1"></turbo-frame>
|
8
7
|
# <%= turbo_frame_tag "tray", src: tray_path(tray) %>
|
8
|
+
# # => <turbo-frame id="tray" src="http://example.com/trays/1"></turbo-frame>
|
9
9
|
#
|
10
|
-
# # => turbo-frame id="tray" links-target="top" src="http://example.com/trays/1"></turbo-frame>
|
11
10
|
# <%= turbo_frame_tag "tray", src: tray_path(tray), links_target: "top" %>
|
11
|
+
# # => <turbo-frame id="tray" links-target="top" src="http://example.com/trays/1"></turbo-frame>
|
12
12
|
#
|
13
|
-
# # => turbo-frame id="tray" links-target="other_tray"></turbo-frame>
|
14
13
|
# <%= turbo_frame_tag "tray", links_target: "other_tray" %>
|
14
|
+
# # => <turbo-frame id="tray" links-target="other_tray"></turbo-frame>
|
15
15
|
#
|
16
|
-
# # => turbo-frame id="tray"><div>My tray frame!</div></turbo-frame>
|
17
16
|
# <%= turbo_frame_tag "tray" do %>
|
18
17
|
# <div>My tray frame!</div>
|
19
18
|
# <% end %>
|
19
|
+
# # => <turbo-frame id="tray"><div>My tray frame!</div></turbo-frame>
|
20
20
|
def turbo_frame_tag(id, src: nil, target: nil, **attributes, &block)
|
21
21
|
tag.turbo_frame(**attributes.merge(id: id, src: src, target: target).compact, &block)
|
22
22
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
module Turbo::Streams::ActionHelper
|
2
2
|
# Creates a `turbo-stream` tag according to the passed parameters. Examples:
|
3
3
|
#
|
4
|
-
# # => <turbo-stream action="remove" target="message_1"></turbo-stream>
|
5
4
|
# turbo_stream_action_tag "remove", target: "message_1"
|
5
|
+
# # => <turbo-stream action="remove" target="message_1"></turbo-stream>
|
6
6
|
#
|
7
|
-
# # => <turbo-stream action="replace" target="message_1"><template><div id="message_1">Hello!</div></template></turbo-stream>
|
8
7
|
# turbo_stream_action_tag "replace", target: "message_1", template: %(<div id="message_1">Hello!</div>)
|
8
|
+
# # => <turbo-stream action="replace" target="message_1"><template><div id="message_1">Hello!</div></template></turbo-stream>
|
9
9
|
def turbo_stream_action_tag(action, target:, template: nil)
|
10
10
|
target = convert_to_turbo_stream_dom_id(target)
|
11
11
|
template = template ? "<template>#{template}</template>" : ""
|
data/lib/turbo/engine.rb
CHANGED
@@ -8,7 +8,9 @@ module Turbo
|
|
8
8
|
config.turbo = ActiveSupport::OrderedOptions.new
|
9
9
|
|
10
10
|
initializer "turbo.assets" do
|
11
|
-
Rails.application.config.assets
|
11
|
+
if Rails.application.config.respond_to?(:assets)
|
12
|
+
Rails.application.config.assets.precompile += %w( turbo )
|
13
|
+
end
|
12
14
|
end
|
13
15
|
|
14
16
|
initializer "turbo.helpers" do
|
data/lib/turbo/version.rb
CHANGED
data/package.json
CHANGED
data/yarn.lock
CHANGED
@@ -23,9 +23,10 @@
|
|
23
23
|
chalk "^2.0.0"
|
24
24
|
js-tokens "^4.0.0"
|
25
25
|
|
26
|
-
"@hotwired/turbo
|
26
|
+
"@hotwired/turbo@^7.0.0-beta.1":
|
27
27
|
version "7.0.0-beta.1"
|
28
|
-
resolved "
|
28
|
+
resolved "https://registry.yarnpkg.com/@hotwired/turbo/-/turbo-7.0.0-beta.1.tgz#0111db8a80a7bb308c4cfdd2720112d06bf25c33"
|
29
|
+
integrity sha512-V7hhELbDkYUGaHw/Yw4tu9pDUT1WE4t3A7tRs7Zh0Uwtk2vaJnmykNZ2uq20BnLjofufA1+MLJZ6AXJ3B/Il5A==
|
29
30
|
|
30
31
|
"@rails/actioncable@^6.1.0":
|
31
32
|
version "6.1.0"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turbo-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Stephenson
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2020-12-
|
13
|
+
date: 2020-12-23 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|