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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 64f0af44179f8e5f1098974870c5d5466f0c55d6
4
- data.tar.gz: 9775690715e3c8ed5a33f8d4d90353b958de4243
3
+ metadata.gz: '0912c3f96e36af55ff15e6090feb8bb5d153c6a2'
4
+ data.tar.gz: bb11128a5055b2730ddf1133671e7a3975bdad7d
5
5
  SHA512:
6
- metadata.gz: a6c14d5b31f559268cc7c9f1324f36a861fca1d61f9edb4aae29c52a5294673f6cb1b2d3a2871bd0d08d80afa1c30c2530ce4416abc28c3145dc616ddea18f55
7
- data.tar.gz: 9a03541795685a494305c00a384513a9fd5a1b251c77650272549beb7897a651d903fc7704d969817640e1b68485398ac58ccc8af89bfb7ac17733d6c822c0c2
6
+ metadata.gz: 9d3da852a6f31f86b3b9191ce755fe017450fd663337ab610bca3d3ffd7c31cbdad0d08591df289e30501e91c7076bcbc6e9209e10e768c9b27d00fcf40a9fde
7
+ data.tar.gz: ec47299dbd6c27caf25b560ed42757fa7006689052fd142ebbb2f4f1f13347bb830d326f847300b806d67d9591f5365126612e9f9b927744716af48f56452f48
@@ -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
- before_filter :set_xhr_redirected_to, :set_request_method_cookie
15
- after_filter :abort_xdomain_redirect
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
- include XHRUrlFor
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::JS
12
+ response.content_type = Mime[:js]
13
13
  end
14
14
  end
15
- end
15
+ end
@@ -1,3 +1,3 @@
1
1
  module Turbolinks
2
- VERSION = '2.5.3'
2
+ VERSION = '2.5.4'
3
3
  end
@@ -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 XHRUrlFor
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.3
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: 2014-12-08 00:00:00.000000000 Z
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.2.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