turbolinks_render 0.9.14 → 0.9.21

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1fcbcc1fa09e0051256ce05c25db9b479796feccbf44f708457a99774d97df18
4
- data.tar.gz: 80e2533ddda4ada30a39abef941e65ad0bdce95ae0cf21bd528fdf2ded83842f
3
+ metadata.gz: 18589a2ac08fad8fc9983b88fa3a1e9e9ee96af74cee7997458f76bfc9c93ac8
4
+ data.tar.gz: c4cae927ebff37363bf362e647100f24192a246cbff731ba6109a6b378ccc4b3
5
5
  SHA512:
6
- metadata.gz: 2664e7817e907db81c17b8d07d67442d828ace135114c984cfcbf5f030c642afbe64124802a79b3424aa3da2d557a15162c1f644d6cfc7994a678883bfb422b8
7
- data.tar.gz: c68aa6038320c61c57dd79a84ceec14105d804097b57d80ddb6033e499e28186b6bc6ba17c065d08f18b779d62525c0ad94d70ec66a092ec3a6f406836dd4fe9
6
+ metadata.gz: 493d4cb579510cfbcee12b332a43d10132b7cc4e62bc7a0a2b4973a5733002b6808b3784de2eaa971ebacb6a09afa9424424336a68b399cb2e922a60350305d3
7
+ data.tar.gz: 6a2c7212832a13faf5c716a716faa3de3f80c0411b797cca67710b53adaeb713df43f2377820cb77f836190d7709b1b7918ed5e92450a87e25bc69d6b89f1d97
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.
@@ -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
@@ -58,8 +62,8 @@ module TurbolinksRender
58
62
  Turbolinks.clearCache();
59
63
  Turbolinks.dispatch('turbolinks:before-cache');
60
64
  renderWithTurbolinks("#{escaped_html}");
61
- Turbolinks.dispatch('turbolinks:load');
62
65
  window.scroll(0, 0);
66
+ Turbolinks.dispatch('turbolinks:load');
63
67
  })();
64
68
  JS
65
69
  end
@@ -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
@@ -1,3 +1,3 @@
1
1
  module TurbolinksRender
2
- VERSION = '0.9.14'.freeze
2
+ VERSION = '0.9.21'.freeze
3
3
  end
metadata CHANGED
@@ -1,17 +1,45 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turbolinks_render
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.14
4
+ version: 0.9.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jorge Manrubia
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-16 00:00:00.000000000 Z
11
+ date: 2021-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rails
14
+ name: railties
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 5.2.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 5.2.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: activesupport
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 5.2.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 5.2.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: actionpack
15
43
  requirement: !ruby/object:Gem::Requirement
16
44
  requirements:
17
45
  - - ">="
@@ -53,7 +81,7 @@ dependencies:
53
81
  - !ruby/object:Gem::Version
54
82
  version: '0'
55
83
  - !ruby/object:Gem::Dependency
56
- name: chromedriver-helper
84
+ name: puma
57
85
  requirement: !ruby/object:Gem::Requirement
58
86
  requirements:
59
87
  - - ">="
@@ -67,7 +95,7 @@ dependencies:
67
95
  - !ruby/object:Gem::Version
68
96
  version: '0'
69
97
  - !ruby/object:Gem::Dependency
70
- name: puma
98
+ name: selenium-webdriver
71
99
  requirement: !ruby/object:Gem::Requirement
72
100
  requirements:
73
101
  - - ">="
@@ -81,7 +109,7 @@ dependencies:
81
109
  - !ruby/object:Gem::Version
82
110
  version: '0'
83
111
  - !ruby/object:Gem::Dependency
84
- name: selenium-webdriver
112
+ name: sqlite3
85
113
  requirement: !ruby/object:Gem::Requirement
86
114
  requirements:
87
115
  - - ">="
@@ -95,7 +123,7 @@ dependencies:
95
123
  - !ruby/object:Gem::Version
96
124
  version: '0'
97
125
  - !ruby/object:Gem::Dependency
98
- name: sqlite3
126
+ name: turbolinks
99
127
  requirement: !ruby/object:Gem::Requirement
100
128
  requirements:
101
129
  - - ">="
@@ -109,7 +137,7 @@ dependencies:
109
137
  - !ruby/object:Gem::Version
110
138
  version: '0'
111
139
  - !ruby/object:Gem::Dependency
112
- name: turbolinks
140
+ name: webdrivers
113
141
  requirement: !ruby/object:Gem::Requirement
114
142
  requirements:
115
143
  - - ">="
@@ -141,7 +169,7 @@ homepage: https://github.com/jorgemanrubia/turbolinks_render
141
169
  licenses:
142
170
  - MIT
143
171
  metadata: {}
144
- post_install_message:
172
+ post_install_message:
145
173
  rdoc_options: []
146
174
  require_paths:
147
175
  - lib
@@ -157,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
185
  version: '0'
158
186
  requirements: []
159
187
  rubygems_version: 3.0.3
160
- signing_key:
188
+ signing_key:
161
189
  specification_version: 4
162
190
  summary: Use Rails render with Turbolinks
163
191
  test_files: []