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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a749a4fc5671faea374bd9e145ac33f3c6f8842fb5297b0d92a1f7dbf25cd96
4
- data.tar.gz: ea6a5a0db21f629bc1f27feb288f32899f5b51f19de239b83f5bc550231c1c6a
3
+ metadata.gz: 62e93c8c19f846f31f5bcf7232233e3cc4d2c9467f13e8feadf6f0dcd1101020
4
+ data.tar.gz: 5869ef4cde9def3d735f81cd0dcc55934c7af4bc3aa6a37f656f9e7092fc92b5
5
5
  SHA512:
6
- metadata.gz: db98634c1b49fa4389181b1fdbd94feb451c913b0df9685c9538980c014666410c9b18d2708815297734fac280f6ea0afa394f75bd6609e55ac78eb45776cc88
7
- data.tar.gz: 9b8fdef95ccecdb882f09c47f29a1f087a577ef34bc1c37e41d303e98f4863303ec2c1a27c8b300f7569d2248b5d357019abb17f46c5498ebccf3a8ad321c5a8
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.
@@ -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
@@ -1,3 +1,3 @@
1
1
  module TurbolinksRender
2
- VERSION = '0.9.17'.freeze
2
+ VERSION = '0.9.20'.freeze
3
3
  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.17
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: 2019-12-26 00:00:00.000000000 Z
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: webdrivers
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: puma
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: selenium-webdriver
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: sqlite3
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: turbolinks
112
+ name: webdrivers
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ">="