turbolinks_render 0.9.17 → 0.9.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/lib/turbolinks_render.rb +1 -0
- data/lib/turbolinks_render/middleware.rb +9 -0
- data/lib/turbolinks_render/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62e93c8c19f846f31f5bcf7232233e3cc4d2c9467f13e8feadf6f0dcd1101020
|
4
|
+
data.tar.gz: 5869ef4cde9def3d735f81cd0dcc55934c7af4bc3aa6a37f656f9e7092fc92b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82ede07acf687b0ea73b215768751950b088c4b75d4de9fe2ce2d866d39e9dba43a307ffe1d6491a8ac2ecb6ce9216f8c39c5c50655cbc08e3d38ef9afec24ff
|
7
|
+
data.tar.gz: 73e4aeae4a0583ca422d95b307d4a6b3430ff985b6f188ef8cb290c0709b2c2dd9f049c1072f3dad4bab827415b9d0cc0fa2527ad4775e8849cb5cf7d4086264
|
data/README.md
CHANGED
@@ -53,6 +53,14 @@ In this case, to use turbolinks you should write:
|
|
53
53
|
render turbolinks: true
|
54
54
|
```
|
55
55
|
|
56
|
+
You can also ignore specific paths in your application. This can be useful if you're using an engine and don't have access to its code to change the `render` calls. For instance, to ignore anything that starts with `/admin`:
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
Rails.application.config.turbolinks_render.ignored_paths = [
|
60
|
+
'/admin'
|
61
|
+
]
|
62
|
+
```
|
63
|
+
|
56
64
|
## Implementation notes
|
57
65
|
|
58
66
|
- It configures a rack middleware that intercept requests and modify responses when the expected conditions are met.
|
data/lib/turbolinks_render.rb
CHANGED
@@ -17,6 +17,7 @@ module TurbolinksRender
|
|
17
17
|
class Engine < ::Rails::Railtie
|
18
18
|
config.turbolinks_render = ActiveSupport::OrderedOptions.new
|
19
19
|
config.turbolinks_render.render_with_turbolinks_by_default = true
|
20
|
+
config.turbolinks_render.ignored_paths = []
|
20
21
|
|
21
22
|
initializer :turbolinks_render do |app|
|
22
23
|
app.config.app_middleware.insert_before ActionDispatch::ShowExceptions, TurbolinksRender::Middleware
|
@@ -8,6 +8,10 @@ module TurbolinksRender
|
|
8
8
|
def turbolinks_render_option
|
9
9
|
@turbolinks_render_option ||= request.get_header('X-Turbolinks-Render-Option')
|
10
10
|
end
|
11
|
+
|
12
|
+
def fullpath
|
13
|
+
request.fullpath
|
14
|
+
end
|
11
15
|
end
|
12
16
|
|
13
17
|
Response = Struct.new(:status, :headers, :response) do
|
@@ -89,11 +93,16 @@ module TurbolinksRender
|
|
89
93
|
|
90
94
|
def render_with_turbolinks?(request, response)
|
91
95
|
request.candidate_for_turbolinks? && response.candidate_for_turbolinks? &&
|
96
|
+
ignored_paths.none? { |path| request.fullpath.starts_with?(path) } &&
|
92
97
|
(request.turbolinks_render_option || (render_with_turbolinks_by_default? && request.turbolinks_render_option != false))
|
93
98
|
end
|
94
99
|
|
95
100
|
def render_with_turbolinks_by_default?
|
96
101
|
Rails.application.config.turbolinks_render.render_with_turbolinks_by_default
|
97
102
|
end
|
103
|
+
|
104
|
+
def ignored_paths
|
105
|
+
Rails.application.config.turbolinks_render.ignored_paths
|
106
|
+
end
|
98
107
|
end
|
99
108
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turbolinks_render
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jorge Manrubia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: puma
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: selenium-webdriver
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: sqlite3
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
@@ -95,7 +95,7 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: turbolinks
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: webdrivers
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - ">="
|