turbolinks 2.5.3 → 2.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/turbolinks.rb +12 -3
- data/lib/turbolinks/redirection.rb +3 -3
- data/lib/turbolinks/version.rb +1 -1
- data/lib/turbolinks/xhr_url_for.rb +11 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0912c3f96e36af55ff15e6090feb8bb5d153c6a2'
|
4
|
+
data.tar.gz: bb11128a5055b2730ddf1133671e7a3975bdad7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d3da852a6f31f86b3b9191ce755fe017450fd663337ab610bca3d3ffd7c31cbdad0d08591df289e30501e91c7076bcbc6e9209e10e768c9b27d00fcf40a9fde
|
7
|
+
data.tar.gz: ec47299dbd6c27caf25b560ed42757fa7006689052fd142ebbb2f4f1f13347bb830d326f847300b806d67d9591f5365126612e9f9b927744716af48f56452f48
|
data/lib/turbolinks.rb
CHANGED
@@ -11,8 +11,13 @@ module Turbolinks
|
|
11
11
|
ActiveSupport.on_load(:action_controller) do
|
12
12
|
ActionController::Base.class_eval do
|
13
13
|
include XHRHeaders, Cookies, XDomainBlocker, Redirection
|
14
|
-
|
15
|
-
|
14
|
+
if respond_to?(:before_action)
|
15
|
+
before_action :set_xhr_redirected_to, :set_request_method_cookie
|
16
|
+
after_action :abort_xdomain_redirect
|
17
|
+
else
|
18
|
+
before_filter :set_xhr_redirected_to, :set_request_method_cookie
|
19
|
+
after_filter :abort_xdomain_redirect
|
20
|
+
end
|
16
21
|
end
|
17
22
|
|
18
23
|
ActionDispatch::Request.class_eval do
|
@@ -25,7 +30,11 @@ module Turbolinks
|
|
25
30
|
|
26
31
|
ActiveSupport.on_load(:action_view) do
|
27
32
|
(ActionView::RoutingUrlFor rescue ActionView::Helpers::UrlHelper).module_eval do
|
28
|
-
|
33
|
+
if defined?(prepend) && Rails.version >= '4'
|
34
|
+
prepend XHRUrlFor
|
35
|
+
else
|
36
|
+
include LegacyXHRUrlFor
|
37
|
+
end
|
29
38
|
end
|
30
39
|
end unless RUBY_VERSION =~ /^1\.8/
|
31
40
|
end
|
@@ -3,13 +3,13 @@ module Turbolinks
|
|
3
3
|
# will respond with a JavaScript call to Turbolinks.visit(url).
|
4
4
|
module Redirection
|
5
5
|
extend ActiveSupport::Concern
|
6
|
-
|
6
|
+
|
7
7
|
def redirect_via_turbolinks_to(url = {}, response_status = {})
|
8
8
|
redirect_to(url, response_status)
|
9
9
|
|
10
10
|
self.status = 200
|
11
11
|
self.response_body = "Turbolinks.visit('#{location}');"
|
12
|
-
response.content_type = Mime
|
12
|
+
response.content_type = Mime[:js]
|
13
13
|
end
|
14
14
|
end
|
15
|
-
end
|
15
|
+
end
|
data/lib/turbolinks/version.rb
CHANGED
@@ -1,15 +1,22 @@
|
|
1
1
|
module Turbolinks
|
2
|
-
# Corrects the behavior of url_for (and link_to, which uses url_for) with the :back
|
3
|
-
# option by using the X-XHR-Referer request header instead of the standard Referer
|
2
|
+
# Corrects the behavior of url_for (and link_to, which uses url_for) with the :back
|
3
|
+
# option by using the X-XHR-Referer request header instead of the standard Referer
|
4
4
|
# request header.
|
5
|
-
module
|
5
|
+
module LegacyXHRUrlFor
|
6
6
|
def self.included(base)
|
7
7
|
base.alias_method_chain :url_for, :xhr_referer
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
def url_for_with_xhr_referer(options = {})
|
11
11
|
options = (controller.request.headers["X-XHR-Referer"] || options) if options == :back
|
12
12
|
url_for_without_xhr_referer options
|
13
13
|
end
|
14
14
|
end
|
15
|
+
|
16
|
+
module XHRUrlFor
|
17
|
+
def url_for(options = {})
|
18
|
+
options = (controller.request.headers["X-XHR-Referer"] || options) if options == :back
|
19
|
+
super options
|
20
|
+
end
|
21
|
+
end
|
15
22
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turbolinks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coffee-rails
|
@@ -70,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
70
|
version: '0'
|
71
71
|
requirements: []
|
72
72
|
rubyforge_project:
|
73
|
-
rubygems_version: 2.
|
73
|
+
rubygems_version: 2.6.12
|
74
74
|
signing_key:
|
75
75
|
specification_version: 4
|
76
76
|
summary: Turbolinks makes following links in your web application faster (use with
|