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.
- checksums.yaml +4 -4
- data/lib/pjax.rb +43 -42
- metadata +7 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69988a04683ce7ef457d444bc8d18545056663af881d48f1a1d7e8a86cb25b4f
|
4
|
+
data.tar.gz: 7584c4c8c9209465ffa96305289bdfb5b5faf5a5e1f32bb463a9ada20e4197b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d36c0bf69fe436dba9ed05f38ddd074e7a3272924514263750c281914657554c90db636486ac9a5a720af4ec839d8e3ec4789e6b2f6fedaab68d543c19ee3251
|
7
|
+
data.tar.gz: 905aaec218e88fa5ac946cc939da0b06154920bee9ab583adad3eb6bf1540c559c52473841698925eec8441ddf32e0073c079a8f122b786d687eb8c157c214fa
|
data/lib/pjax.rb
CHANGED
@@ -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
|
-
|
28
|
-
|
29
|
-
|
24
|
+
def pjax_request?
|
25
|
+
request.env['HTTP_X_PJAX'].present?
|
26
|
+
end
|
30
27
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
end
|
28
|
+
def pjax_layout
|
29
|
+
false
|
30
|
+
end
|
35
31
|
|
36
|
-
|
37
|
-
|
38
|
-
|
32
|
+
def pjax_container
|
33
|
+
return unless pjax_request?
|
34
|
+
request.headers['X-PJAX-Container']
|
35
|
+
end
|
39
36
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
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
|
-
|
56
|
-
|
57
|
-
|
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
|
-
|
60
|
-
|
61
|
-
|
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
|
-
|
64
|
-
|
65
|
-
|
64
|
+
request.instance_variable_set('@original_fullpath', nil)
|
65
|
+
request.instance_variable_set('@fullpath', nil)
|
66
|
+
end
|
66
67
|
|
67
|
-
|
68
|
-
|
69
|
-
|
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.
|
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:
|
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: '
|
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: '
|
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:
|
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
|
-
|
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
|
128
|
+
summary: PJAX integration for Rails
|
130
129
|
test_files: []
|