pjax_rails 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pjax.rb +43 -42
  3. metadata +7 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e64970b670dfdbc7ccfbdfeba5c68017592043da6a44dfca4bf802f38488d992
4
- data.tar.gz: 3086bae93e9e83e8205d1f69890abe1e0ff75a99377601feb2661f83a2f275d7
3
+ metadata.gz: 69988a04683ce7ef457d444bc8d18545056663af881d48f1a1d7e8a86cb25b4f
4
+ data.tar.gz: 7584c4c8c9209465ffa96305289bdfb5b5faf5a5e1f32bb463a9ada20e4197b7
5
5
  SHA512:
6
- metadata.gz: cdb57cac74960ca7a13a480866417c960a96e462ea216e5821d0ac696bd5b539f99e30bf930b57c143af75bb176266d9292a0b684d31e7189e5cb8934d1d11b5
7
- data.tar.gz: 6368084ddad6e1ea125b884aff74108f7ae4c418384a5d9137c5607175db33a826a3f199b1f812a65c7b79d469764cfd16e775d8cb666170b0a1868a017848fc
6
+ metadata.gz: d36c0bf69fe436dba9ed05f38ddd074e7a3272924514263750c281914657554c90db636486ac9a5a720af4ec839d8e3ec4789e6b2f6fedaab68d543c19ee3251
7
+ data.tar.gz: 905aaec218e88fa5ac946cc939da0b06154920bee9ab583adad3eb6bf1540c559c52473841698925eec8441ddf32e0073c079a8f122b786d687eb8c157c214fa
@@ -1,4 +1,7 @@
1
1
  module Pjax
2
+ class Error < StandardError; end
3
+ class Unsupported < Error; end
4
+
2
5
  extend ActiveSupport::Concern
3
6
 
4
7
  included do
@@ -16,55 +19,53 @@ module Pjax
16
19
  end
17
20
  end
18
21
 
19
- class Error < StandardError; end
20
- class Unsupported < Error; end
21
-
22
22
  protected
23
- def pjax_request?
24
- request.env['HTTP_X_PJAX'].present?
25
- end
26
23
 
27
- def pjax_layout
28
- false
29
- end
24
+ def pjax_request?
25
+ request.env['HTTP_X_PJAX'].present?
26
+ end
30
27
 
31
- def pjax_container
32
- return unless pjax_request?
33
- request.headers['X-PJAX-Container']
34
- end
28
+ def pjax_layout
29
+ false
30
+ end
35
31
 
36
- def pjax_unsupported
37
- head :not_acceptable
38
- end
32
+ def pjax_container
33
+ return unless pjax_request?
34
+ request.headers['X-PJAX-Container']
35
+ end
39
36
 
40
- # Call in a before_action or in an action to disable pjax on an action.
41
- #
42
- # Examples
43
- #
44
- # before_action :prevent_pjax!
45
- #
46
- # def login
47
- # prevent_pjax!
48
- # # ...
49
- # end
50
- #
51
- def prevent_pjax!
52
- raise Pjax::Unsupported if pjax_request?
53
- end
37
+ def pjax_unsupported
38
+ head :not_acceptable
39
+ end
40
+
41
+ # Call in a before_action or in an action to disable pjax on an action.
42
+ #
43
+ # Examples
44
+ #
45
+ # before_action :prevent_pjax!
46
+ #
47
+ # def login
48
+ # prevent_pjax!
49
+ # # ...
50
+ # end
51
+ #
52
+ def prevent_pjax!
53
+ raise Pjax::Unsupported if pjax_request?
54
+ end
54
55
 
55
- def strip_pjax_param
56
- params.delete(:_pjax)
57
- request.env['QUERY_STRING'] = request.env['QUERY_STRING'].sub(/_pjax=[^&]+&?/, '')
56
+ def strip_pjax_param
57
+ params.delete(:_pjax)
58
+ request.env['QUERY_STRING'] = request.env['QUERY_STRING'].sub(/\A_pjax=[^&]+&?|&_pjax=[^&]+/, '')
58
59
 
59
- request.env.delete('rack.request.query_string')
60
- request.env.delete('rack.request.query_hash')
61
- request.env.delete('action_dispatch.request.query_parameters')
60
+ request.env.delete('rack.request.query_string')
61
+ request.env.delete('rack.request.query_hash')
62
+ request.env.delete('action_dispatch.request.query_parameters')
62
63
 
63
- request.instance_variable_set('@original_fullpath', nil)
64
- request.instance_variable_set('@fullpath', nil)
65
- end
64
+ request.instance_variable_set('@original_fullpath', nil)
65
+ request.instance_variable_set('@fullpath', nil)
66
+ end
66
67
 
67
- def set_pjax_url
68
- response.headers['X-PJAX-URL'] = request.url
69
- end
68
+ def set_pjax_url
69
+ response.headers['X-PJAX-URL'] = request.url
70
+ end
70
71
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pjax_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson (PJAX by Chris Wanstrath)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-27 00:00:00.000000000 Z
11
+ date: 2019-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '3.2'
19
+ version: '4.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '3.2'
26
+ version: '4.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: jquery-rails
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: poltergeist
84
+ name: cuprite
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
@@ -122,9 +122,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  - !ruby/object:Gem::Version
123
123
  version: '0'
124
124
  requirements: []
125
- rubyforge_project:
126
- rubygems_version: 2.7.6
125
+ rubygems_version: 3.0.3
127
126
  signing_key:
128
127
  specification_version: 4
129
- summary: PJAX integration for Rails 3.2+
128
+ summary: PJAX integration for Rails
130
129
  test_files: []