turbograft 0.1.9 → 0.1.10

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: 339420a1b56e444a79742242d2869ae2bba8247f
4
- data.tar.gz: 6e0deb25a236353a81614717832c8ebc879faba5
3
+ metadata.gz: 4d6ed5cfa12fb229dbe15a95c663d588fb286968
4
+ data.tar.gz: eb7db0db4ab8e83d2b99c84a734afd249abf976e
5
5
  SHA512:
6
- metadata.gz: 343f99d91124eb41e6b50f9cb46a5ed20bf08e11f29cd10c0ad7bcc86fe1e24db027a5c7e4fdc6ace66a7d3ec951995d667174fafa6a80a5bea4e28a85e58272
7
- data.tar.gz: 0c17a4a20d47a58148d87eed573e130950f39473886e19dcfa0d965921c0dff9d032c764066749b58702ddf2d5fa443506253a708d9c3c4bfd9617f57d166789
6
+ metadata.gz: 139ff3da9750ac52978ab7de428a2da45ff9b506c0a5c42d29a33dfdbd9aafa07535cbf88870ebea0df5309c3d56493f34b45f6bf016cd19f139caa017ea00aa
7
+ data.tar.gz: 63a0480ab0ab39cb02133ab41692745f0ae15a30b742e0869543b28c9094e54bb393a16dd1b7986f92abf45746f7f3950c3e16a8dffe6d52c0115d7f31f3ee08
@@ -119,12 +119,11 @@ class window.Turbolinks
119
119
  changePage = (title, body, csrfToken, runScripts, partialReplace, onlyKeys = [], exceptKeys = []) ->
120
120
  document.title = title if title
121
121
 
122
- refreshedNodes = []
123
- refreshedNodes = refreshRefreshAlwaysNodes(body)
124
122
  if onlyKeys.length
125
- refreshedNodes = refreshedNodes.concat refreshNodesWithKeys(onlyKeys, body)
126
- return refreshedNodes
123
+ nodesToRefresh = [].concat(getNodesWithRefreshAlways(), getNodesMatchingRefreshKeys(onlyKeys))
124
+ return refreshNodes(nodesToRefresh, body)
127
125
  else
126
+ refreshNodes(getNodesWithRefreshAlways(), body)
128
127
  persistStaticElements(body)
129
128
  if exceptKeys.length
130
129
  refreshAllExceptWithKeys(exceptKeys, body)
@@ -141,6 +140,21 @@ class window.Turbolinks
141
140
 
142
141
  return
143
142
 
143
+ getNodesMatchingRefreshKeys = (keys) ->
144
+ matchingNodes = []
145
+ for key in keys
146
+ for node in document.querySelectorAll("[refresh=#{key}]")
147
+ matchingNodes.push(node)
148
+
149
+ return matchingNodes
150
+
151
+ getNodesWithRefreshAlways = ->
152
+ matchingNodes = []
153
+ for node in document.querySelectorAll("[refresh-always]")
154
+ matchingNodes.push(node)
155
+
156
+ return matchingNodes
157
+
144
158
  deleteRefreshNeverNodes = (body) ->
145
159
  for node in body.querySelectorAll('[refresh-never]')
146
160
  node.parentNode.removeChild(node)
@@ -176,21 +190,6 @@ class window.Turbolinks
176
190
 
177
191
  refreshedNodes
178
192
 
179
- refreshRefreshAlwaysNodes = (body) ->
180
- allNodesToBeRefreshed = []
181
- for node in document.querySelectorAll("[refresh-always]")
182
- allNodesToBeRefreshed.push(node)
183
-
184
- return refreshNodes(allNodesToBeRefreshed, body)
185
-
186
- refreshNodesWithKeys = (keys, body) ->
187
- allNodesToBeRefreshed = []
188
- for key in keys
189
- for node in document.querySelectorAll("[refresh=#{key}]")
190
- allNodesToBeRefreshed.push(node)
191
-
192
- return refreshNodes(allNodesToBeRefreshed, body)
193
-
194
193
  keepNodes = (body, allNodesToKeep) ->
195
194
  for existingNode in allNodesToKeep
196
195
  unless nodeId = existingNode.getAttribute('id')
@@ -1,3 +1,3 @@
1
1
  module TurboGraft
2
- VERSION = '0.1.9'
2
+ VERSION = '0.1.10'
3
3
  end
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.1.9
4
+ version: 0.1.10
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: 2015-01-15 00:00:00.000000000 Z
16
+ date: 2015-01-20 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: coffee-rails