turbo-router 0.1.4 → 0.2.0
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/lib/turbo-router.rb +1 -0
- data/lib/turbo_router/application_helpers.rb +7 -0
- data/lib/turbo_router/controller.rb +0 -22
- data/lib/turbo_router/railtie.rb +9 -1
- data/lib/turbo_router/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96af1aa120ea0f0746198ea7c2430dedad2a99d141e11c577a04be03c2e62a53
|
4
|
+
data.tar.gz: 7a98a24e2c39af9b79100d1ee377829112b7b2767083bbe5b653f57cc29d1b92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f298ad09d6fcab00b1c8b47e3d9743d408dd29bb76ba55d23eaf12068fbf20e71efd9ca510aacb571c3777110828bef327bf8e6f2df269e24f6706ae28f7d85
|
7
|
+
data.tar.gz: 6cc21f5ba6558823081de5b04bc312b1e04b7448b9791bfe13a193d1b799413f125cead4dabcf6c473b96c5b9dbc8319fa9b81301b3aeec09e3741af3d8d0d4f
|
data/lib/turbo-router.rb
CHANGED
@@ -10,10 +10,6 @@ module TurboRouter
|
|
10
10
|
layout lambda {
|
11
11
|
use_dynamic_layout? ? "layouts/turbo_router_content" : self.class.page_layout
|
12
12
|
}
|
13
|
-
|
14
|
-
before_action :set_turbo_frame_request_variant
|
15
|
-
helper_method :turbo_router_frame_options
|
16
|
-
helper_method :turbo_router_frame_id_for_request
|
17
13
|
end
|
18
14
|
|
19
15
|
class_methods do
|
@@ -40,23 +36,5 @@ module TurboRouter
|
|
40
36
|
def turbo_router_stream(template, id = :turbo_router_content, **options)
|
41
37
|
render turbo_stream: turbo_stream.replace(id, template: template, locals: options)
|
42
38
|
end
|
43
|
-
|
44
|
-
def turbo_router_frame_options
|
45
|
-
@turbo_router_advance ? { turbo_action: "advance", target: request.headers["Turbo-frame"] } : {}
|
46
|
-
end
|
47
|
-
|
48
|
-
def turbo_router_frame_id_for_request
|
49
|
-
request.headers["Turbo-frame"].present? ? request.headers["Turbo-frame"] : "turbo_router_content"
|
50
|
-
end
|
51
|
-
|
52
|
-
private
|
53
|
-
|
54
|
-
def set_turbo_frame_request_variant
|
55
|
-
request.variant = if turbo_frame_request?
|
56
|
-
:turbo_frame
|
57
|
-
else
|
58
|
-
:page
|
59
|
-
end
|
60
|
-
end
|
61
39
|
end
|
62
40
|
end
|
data/lib/turbo_router/railtie.rb
CHANGED
@@ -1,9 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
require "pry"
|
2
3
|
|
3
4
|
module TurboRouter
|
4
5
|
class Railtie < Rails::Railtie
|
5
6
|
initializer "turbo_router.view_helpers" do
|
6
|
-
ActiveSupport.on_load(:action_view)
|
7
|
+
ActiveSupport.on_load(:action_view) do
|
8
|
+
include TurboRouter::ViewHelpers
|
9
|
+
include TurboRouter::ApplicationHelpers
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
initializer 'turbo_router.controller_helpers' do
|
14
|
+
ActiveSupport.on_load(:action_controller) { include TurboRouter::ApplicationHelpers }
|
7
15
|
end
|
8
16
|
end
|
9
17
|
end
|
data/lib/turbo_router/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turbo-router
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryant Morrill
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -111,6 +111,7 @@ files:
|
|
111
111
|
- lib/generators/turbo_router_generator.rb
|
112
112
|
- lib/tasks/turbo_router_tasks.rake
|
113
113
|
- lib/turbo-router.rb
|
114
|
+
- lib/turbo_router/application_helpers.rb
|
114
115
|
- lib/turbo_router/controller.rb
|
115
116
|
- lib/turbo_router/railtie.rb
|
116
117
|
- lib/turbo_router/version.rb
|