turbolinks 2.5.2 → 2.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9b00e79da70fa234720d97cb476bd21e237261fb
4
- data.tar.gz: 84e4fbdd8d4949206833fc226a74609d511ee4ae
3
+ metadata.gz: '0912c3f96e36af55ff15e6090feb8bb5d153c6a2'
4
+ data.tar.gz: bb11128a5055b2730ddf1133671e7a3975bdad7d
5
5
  SHA512:
6
- metadata.gz: 891313ccf4e64d39db45b2a92a2f4c5e95a93f55aeedb33c085501c2a631d4e1142eca5dcdf8bb463c363224280f5e4b10a64be3e2fb0cc84a7ad360a179ac37
7
- data.tar.gz: 2a10327848e32dad567b76c1a4c653c979a5018805a56a1ed3f3d1f6e0913aeb8f25e56f1984b72fe2d892c2ca1c9b24b262c8c6e5f567aacbf4d529bb509481
6
+ metadata.gz: 9d3da852a6f31f86b3b9191ce755fe017450fd663337ab610bca3d3ffd7c31cbdad0d08591df289e30501e91c7076bcbc6e9209e10e768c9b27d00fcf40a9fde
7
+ data.tar.gz: ec47299dbd6c27caf25b560ed42757fa7006689052fd142ebbb2f4f1f13347bb830d326f847300b806d67d9591f5365126612e9f9b927744716af48f56452f48
data/README.md CHANGED
@@ -68,7 +68,13 @@ $(document).on("page:fetch", startSpinner);
68
68
  $(document).on("page:receive", stopSpinner);
69
69
  ```
70
70
 
71
- DOM transformations that are idempotent are best. If you have transformations that are not, hook them to happen only on `page:load` instead of `page:change` (as that would run them again on the cached pages).
71
+ DOM transformations that are idempotent are best. If you have transformations that are not, bind them to `page:load` (in addition to the initial page load) instead of `page:change` (as that would run them again on the cached pages):
72
+
73
+ ```javascript
74
+ // using jQuery for simplicity
75
+
76
+ $(document).on("ready page:load", nonIdempotentFunction);
77
+ ```
72
78
 
73
79
  Transition Cache: A Speed Boost
74
80
  -------------------------------
@@ -82,7 +88,7 @@ To enable Transition Cache, include the following in your javascript:
82
88
  Turbolinks.enableTransitionCache();
83
89
  ```
84
90
 
85
- The one drawback is that dramatic differences in appearence between a cached copy and new copy may lead to a jarring affect for the end-user. This will be especially true for pages that have many moving parts (expandable sections, sortable tables, infinite scrolling, etc.).
91
+ The one drawback is that dramatic differences in appearance between a cached copy and new copy may lead to a jarring affect for the end-user. This will be especially true for pages that have many moving parts (expandable sections, sortable tables, infinite scrolling, etc.).
86
92
 
87
93
  If you find that a page is causing problems, you can have Turbolinks skip displaying the cached copy by adding `data-no-transition-cache` to any DOM element on the offending page.
88
94
 
@@ -149,7 +155,7 @@ Also, Turbolinks is installed as the last click handler for links. So if you ins
149
155
  jquery.turbolinks
150
156
  -----------------
151
157
 
152
- If you have a lot of existing JavaScript that binds elements on jQuery.ready(), you can pull the [jquery.turbolinks](https://github.com/kossnocorp/jquery.turbolinks) library into your project that will trigger ready() when Turbolinks triggers the the `page:load` event. It may restore functionality of some libraries.
158
+ If you have a lot of existing JavaScript that binds elements on jQuery.ready(), you can pull the [jquery.turbolinks](https://github.com/kossnocorp/jquery.turbolinks) library into your project that will trigger ready() when Turbolinks triggers the `page:load` event. It may restore functionality of some libraries.
153
159
 
154
160
  Add the gem to your project, then add the following line to your JavaScript manifest file, after `jquery.js` but before `turbolinks.js`:
155
161
 
@@ -227,6 +233,7 @@ Language Ports
227
233
  * [ASP.NET MVC Turbolinks](https://github.com/kazimanzurrashid/aspnetmvcturbolinks)
228
234
  * [PHP Turbolinks Component](https://github.com/helthe/Turbolinks) (Symfony Component)
229
235
  * [PHP Turbolinks Package](https://github.com/frenzyapp/turbolinks) (Laravel Package)
236
+ * [Grails Turbolinks](http://grails.org/plugin/turbolinks) (Grails Plugin)
230
237
 
231
238
  Credits
232
239
  -------
@@ -378,9 +378,11 @@ class ProgressBar
378
378
 
379
379
  constructor: (@elementSelector) ->
380
380
  @value = 0
381
- @opacity = 1
382
381
  @content = ''
383
382
  @speed = 300
383
+ # Setting the opacity to a value < 1 fixes a display issue in Safari 6 and
384
+ # iOS 6 where the progress bar would fill the entire page.
385
+ @opacity = 0.99
384
386
  @install()
385
387
 
386
388
  install: ->
@@ -413,6 +415,8 @@ class ProgressBar
413
415
  @_reset()
414
416
 
415
417
  _reset: ->
418
+ originalOpacity = @opacity
419
+
416
420
  setTimeout =>
417
421
  @opacity = 0
418
422
  @_updateStyle()
@@ -420,7 +424,7 @@ class ProgressBar
420
424
 
421
425
  setTimeout =>
422
426
  @value = 0
423
- @opacity = 1
427
+ @opacity = originalOpacity
424
428
  @_withSpeed(0, => @_updateStyle(true))
425
429
  , @speed
426
430
 
@@ -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.2'
3
- end
2
+ VERSION = '2.5.4'
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
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
- 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
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.2
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-11-10 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