turbograft 0.3.0 → 0.3.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c51f5ed8a155f29814d99f83a20387c3397a29a9
|
4
|
+
data.tar.gz: 92a13dac1c2aadc0526a40c78f5d67097e3a833e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85f28b6d5b0851b2c7d6684418eeccb1baf690d1a71eddc1498f8ce99acea81c7864834f7b7861d6e55888a5b399ae59d19dcdd714b5edd29a5eb9c2122948f4
|
7
|
+
data.tar.gz: 0d8cd7e44378440bffc0883520c0d35408cd9e52262d6f3284324172db8b0a457b27dbb41a8534b0787103f479b0413664133004878a3a9be045c7a802dd19fb
|
@@ -26,8 +26,7 @@ updateScriptTags = (activeDocument, newScripts, callback) ->
|
|
26
26
|
)
|
27
27
|
|
28
28
|
extractTrackedAssets = (doc) ->
|
29
|
-
|
30
|
-
node
|
29
|
+
[].slice.call(doc.querySelectorAll('[data-turbolinks-track]'))
|
31
30
|
|
32
31
|
filterForNodeType = (nodeType) ->
|
33
32
|
(node) -> node.nodeName == nodeType
|
@@ -130,27 +130,33 @@ class window.Turbolinks
|
|
130
130
|
@loadPage: (url, xhr, options = {}) ->
|
131
131
|
triggerEvent 'page:receive'
|
132
132
|
options.updatePushState ?= true
|
133
|
-
if upstreamDocument = processResponse(xhr
|
133
|
+
if upstreamDocument = processResponse(xhr)
|
134
134
|
reflectNewUrl url if options.updatePushState
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
reflectRedirectedUrl(xhr) if options.updatePushState
|
146
|
-
options.onLoadFunction?()
|
147
|
-
triggerEvent 'page:load', nodes
|
148
|
-
,
|
149
|
-
onHeadUpdateError = ->
|
150
|
-
Turbolinks.fullPageNavigate(url.absolute)
|
151
|
-
)
|
135
|
+
if options.partialReplace
|
136
|
+
updateBody(upstreamDocument, xhr, options)
|
137
|
+
else
|
138
|
+
new TurboHead(document, upstreamDocument).update(
|
139
|
+
onHeadUpdateSuccess = ->
|
140
|
+
updateBody(upstreamDocument, xhr, options)
|
141
|
+
,
|
142
|
+
onHeadUpdateError = ->
|
143
|
+
Turbolinks.fullPageNavigate(url.absolute)
|
144
|
+
)
|
152
145
|
else
|
153
|
-
|
146
|
+
triggerEvent 'page:error', xhr
|
147
|
+
Turbolinks.fullPageNavigate(url.absolute) if url?
|
148
|
+
|
149
|
+
updateBody = (upstreamDocument, xhr, options) ->
|
150
|
+
nodes = changePage(
|
151
|
+
upstreamDocument.querySelector('title')?.textContent,
|
152
|
+
removeNoscriptTags(upstreamDocument.querySelector('body')),
|
153
|
+
CSRFToken.get(upstreamDocument).token,
|
154
|
+
'runScripts',
|
155
|
+
options
|
156
|
+
)
|
157
|
+
reflectRedirectedUrl(xhr) if options.updatePushState
|
158
|
+
options.onLoadFunction?()
|
159
|
+
triggerEvent 'page:load', nodes
|
154
160
|
|
155
161
|
changePage = (title, body, csrfToken, runScripts, options = {}) ->
|
156
162
|
document.title = title if title
|
@@ -322,7 +328,7 @@ class window.Turbolinks
|
|
322
328
|
pageChangePrevented = (url) ->
|
323
329
|
!triggerEvent('page:before-change', url)
|
324
330
|
|
325
|
-
processResponse = (xhr
|
331
|
+
processResponse = (xhr) ->
|
326
332
|
clientOrServerError = ->
|
327
333
|
return false if xhr.status == 422 # we want to render form validations
|
328
334
|
400 <= xhr.status < 600
|
data/lib/turbograft/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turbograft
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kristian Plettenberg-Dussault
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2016-08-
|
16
|
+
date: 2016-08-29 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: coffee-rails
|