doc-turbolinks 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +20 -12
- data/lib/assets/javascripts/jquery.turbolinks.js.coffee +49 -0
- data/lib/turbolinks/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c5793384da6c1abd8b66a04ddcc4712096483cd
|
4
|
+
data.tar.gz: efb8ebad30564c9a7999e2ff4b682436f78f6dfc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f553ff6e1a4f5c2aeb4318a89d30c6814864a090b20911f272aff9023487292216f37d576d930bddaf307ca8e69ce119b704c3f1425208cb7f2a2b44daa48087
|
7
|
+
data.tar.gz: 010e8fc5c066a0f1bbde0eebefb6dbabd581af301e6bc97533c6c8cba5a5ee70306c72159688a9ea09c8669ed2a61b938f908c02f1c46d00d35174600dd4759c
|
data/README.md
CHANGED
@@ -1,7 +1,15 @@
|
|
1
|
-
Turbolinks
|
2
|
-
|
1
|
+
Turbolinks v3.0.0
|
2
|
+
=================
|
3
|
+
|
4
|
+
This fork is only to use unreleased (turbolinks v3.0.0)[https://github.com/turbolinks/turbolinks-classic] gem from [RubyGems](https://rubygems.org/gems/doc-turbolinks). In some environments, for example [AWS Elastic Beanstalk](https://aws.amazon.com/documentation/elastic-beanstalk/), usage of rubygems instead of github drastically reduce deployment time.
|
5
|
+
|
6
|
+
Usage
|
7
|
+
-----
|
8
|
+
Add `gem 'doc-turbolinks', require: 'turbolinks'` to your Gemfile
|
9
|
+
|
10
|
+
Another moment, that `jquery.turbolinks` gem include original `turbolinks` gem as dependency. To resolve this issue `jquery.turbolinks.coffee` placed in this gem. So, please remove, `gem 'jquery-turbolinks'` from your `Gemfile`
|
11
|
+
|
3
12
|
|
4
|
-
Turbolinks 5 is a ground-up rewrite with a new flow, new events, but the same core idea. It's available at [turbolinks/turbolinks](https://github.com/turbolinks/turbolinks). This repository remains available for existing applications built on what we now call Turbolinks Classic.
|
5
13
|
|
6
14
|
Turbolinks
|
7
15
|
----------
|
@@ -37,21 +45,21 @@ Event | Argument `originalEvent.data` | Notes
|
|
37
45
|
`page:restore` | | A cached body element has been loaded into the DOM.
|
38
46
|
`page:after-remove` | `affectedNode` | An element has been removed from the DOM or body evicted from the cache and must be cleaned up. jQuery event listeners are cleaned up automatically.
|
39
47
|
|
40
|
-
**Example: load a fresh version of a page from the server**
|
48
|
+
**Example: load a fresh version of a page from the server**
|
41
49
|
- `page:before-change` link clicked or `Turbolinks.visit()` called (cancellable)
|
42
50
|
- `page:fetch` about to send XHR
|
43
51
|
- `page:receive` received response from server
|
44
52
|
- `page:before-unload` (`[currentBody]`) page has been parsed and is about to be changed
|
45
53
|
- `page:change` (`[newBody]`) new body is in place
|
46
|
-
- `page:update`
|
54
|
+
- `page:update`
|
47
55
|
- `page:load` (`[newBody]`) page has been loaded (progress bar hidden, scroll position updated)
|
48
56
|
- `page:after-remove` (`oldBody`) an old body has been evicted from the cache
|
49
57
|
|
50
|
-
**Example: partial replacement with `Turbolinks.replace()`**
|
58
|
+
**Example: partial replacement with `Turbolinks.replace()`**
|
51
59
|
- `page:before-unload` (`[currentNodes...]`) nodes are about to be changed
|
52
60
|
- `page:after-remove` (`currentNode`) a node has been removed from the DOM and must be cleaned up (fires once per node)
|
53
61
|
- `page:change` (`[newNodes...]`) new nodes are in place
|
54
|
-
- `page:update`
|
62
|
+
- `page:update`
|
55
63
|
- `page:partial-load` (`[newNodes...]`)
|
56
64
|
|
57
65
|
**Example lifecycle setup:**
|
@@ -337,7 +345,7 @@ Partial replacement decisions can also be made server-side by using `redirect_to
|
|
337
345
|
class CommentsController < ActionController::Base
|
338
346
|
def index
|
339
347
|
@comments = Comment.page(params[:page]).per(25)
|
340
|
-
|
348
|
+
|
341
349
|
# Turbolinks appends the nodes in `comment_list`; useful for infinite scrolling
|
342
350
|
render :index, append: ['comment_list']
|
343
351
|
end
|
@@ -440,9 +448,9 @@ Option | Type | Notes
|
|
440
448
|
Function | Arguments | Notes
|
441
449
|
------------------------- | ---------------- | -----
|
442
450
|
`pagesCached()` | None or `Number` | Get or set the maximum number of pages that should be cached.
|
443
|
-
`cacheCurrentPage()` | |
|
444
|
-
`enableTransitionCache()` | |
|
445
|
-
`disableRequestCaching()` | |
|
451
|
+
`cacheCurrentPage()` | |
|
452
|
+
`enableTransitionCache()` | |
|
453
|
+
`disableRequestCaching()` | |
|
446
454
|
`allowLinkExtensions()` | `String`... | Whitelist additional file extensions to be processed by Turbolinks.
|
447
455
|
|
448
456
|
Property | Notes
|
@@ -491,7 +499,7 @@ Known issues
|
|
491
499
|
Installation
|
492
500
|
------------
|
493
501
|
|
494
|
-
1. Add `gem 'turbolinks'` to your Gemfile.
|
502
|
+
1. Add `gem 'doc-turbolinks', require: 'turbolinks'` to your Gemfile.
|
495
503
|
2. Run `bundle install`.
|
496
504
|
3. Add `//= require turbolinks` to your Javascript manifest file (usually found at `app/assets/javascripts/application.js`). If your manifest requires both turbolinks and jQuery, make sure turbolinks is listed *after* jQuery.
|
497
505
|
4. Restart your server and you're now using turbolinks!
|
@@ -0,0 +1,49 @@
|
|
1
|
+
###
|
2
|
+
jQuery.Turbolinks ~ https://github.com/kossnocorp/jquery.turbolinks
|
3
|
+
jQuery plugin for drop-in fix binded events problem caused by Turbolinks
|
4
|
+
|
5
|
+
The MIT License
|
6
|
+
Copyright (c) 2012-2013 Sasha Koss & Rico Sta. Cruz
|
7
|
+
###
|
8
|
+
|
9
|
+
$ = window.jQuery or require?('jquery')
|
10
|
+
$document = $(document)
|
11
|
+
|
12
|
+
$.turbo =
|
13
|
+
version: '2.1.0'
|
14
|
+
|
15
|
+
isReady: false
|
16
|
+
|
17
|
+
# Hook onto the events that Turbolinks triggers.
|
18
|
+
use: (load, fetch) ->
|
19
|
+
$document
|
20
|
+
.off('.turbo')
|
21
|
+
.on("#{load}.turbo", @onLoad)
|
22
|
+
.on("#{fetch}.turbo", @onFetch)
|
23
|
+
|
24
|
+
addCallback: (callback) ->
|
25
|
+
if $.turbo.isReady
|
26
|
+
callback($)
|
27
|
+
$document.on 'turbo:ready', -> callback($)
|
28
|
+
|
29
|
+
onLoad: ->
|
30
|
+
$.turbo.isReady = true
|
31
|
+
$document.trigger('turbo:ready')
|
32
|
+
|
33
|
+
onFetch: ->
|
34
|
+
$.turbo.isReady = false
|
35
|
+
|
36
|
+
# Registers jQuery.Turbolinks by monkey-patching jQuery's
|
37
|
+
# `ready` handler. (Internal)
|
38
|
+
#
|
39
|
+
# [1] Trigger the stored `ready` events on first load.
|
40
|
+
# [2] Override `$(function)` and `$(document).ready(function)` by
|
41
|
+
# registering callbacks under a new event called `turbo:ready`.
|
42
|
+
#
|
43
|
+
register: ->
|
44
|
+
$(@onLoad) #[1]
|
45
|
+
$.fn.ready = @addCallback #[2]
|
46
|
+
|
47
|
+
# Use with Turbolinks.
|
48
|
+
$.turbo.register()
|
49
|
+
$.turbo.use('page:load', 'page:fetch')
|
data/lib/turbolinks/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: doc-turbolinks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
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: 2016-02-
|
11
|
+
date: 2016-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coffee-rails
|
@@ -46,6 +46,7 @@ extra_rdoc_files: []
|
|
46
46
|
files:
|
47
47
|
- MIT-LICENSE
|
48
48
|
- README.md
|
49
|
+
- lib/assets/javascripts/jquery.turbolinks.js.coffee
|
49
50
|
- lib/assets/javascripts/turbolinks.coffee
|
50
51
|
- lib/turbolinks.rb
|
51
52
|
- lib/turbolinks/cookies.rb
|
@@ -70,7 +71,7 @@ files:
|
|
70
71
|
- test/redirect2.html
|
71
72
|
- test/reload.html
|
72
73
|
- test/withoutextension
|
73
|
-
homepage: https://github.com/
|
74
|
+
homepage: https://github.com/pinya/doc-turbolinks
|
74
75
|
licenses:
|
75
76
|
- MIT
|
76
77
|
metadata: {}
|