angular-turbolinks 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/angular/turbolinks/version.rb +1 -1
- data/lib/assets/javascripts/angular-turbolinks.js.coffee +8 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36dbb7b58a7c8bacd11b185dfeda4b89d6cfe4bc
|
4
|
+
data.tar.gz: 28185ce5a0343fe6d36c5da8428149eeb14c16e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa00aba2bd9948ce2e4d2b8b4f147e32e7f8988efdb479517c22eeea489fbcfd7ba6cc43fc6e170d263975808580b1d2f0f761143b29e03d234b6ac7c3e4f5bb
|
7
|
+
data.tar.gz: 911f8342208a72a2b973d3ed377d944f970311f3a9611b9aeed8d76cc566bc84da9fb6bb9570d724bb780b8746e645c291f49f15c78e264148c1e7075b2bbfeb
|
data/README.md
CHANGED
@@ -36,6 +36,7 @@ $(document).on('ready page:load', ->
|
|
36
36
|
|
37
37
|
##### TODO
|
38
38
|
* add support for turbolinks redirection logic
|
39
|
+
* referer not working properly (ie. redirect_to :back)
|
39
40
|
|
40
41
|
##### Caveats
|
41
42
|
* This is a first stab just to try to get around the '10 $digest() iterations reached using $locationWatch' errors I was receiving when using turbolinks with angular
|
@@ -1,9 +1,8 @@
|
|
1
|
-
angular.module('ngTurbolinks', []).run(($location, $rootScope, $http, $q)->
|
1
|
+
angular.module('ngTurbolinks', []).run(($location, $rootScope, $http, $q, $compile)->
|
2
2
|
|
3
3
|
loadedAssets = null
|
4
4
|
createDocument = null
|
5
5
|
xhr_req = null
|
6
|
-
referer = null
|
7
6
|
|
8
7
|
triggerEvent = (name, data) ->
|
9
8
|
event = document.createEvent 'Events'
|
@@ -17,7 +16,7 @@ angular.module('ngTurbolinks', []).run(($location, $rootScope, $http, $q)->
|
|
17
16
|
value
|
18
17
|
|
19
18
|
rememberReferer = ->
|
20
|
-
referer = document.location.href
|
19
|
+
window.referer = document.location.href
|
21
20
|
|
22
21
|
processResponse = (responseText, status, headers)->
|
23
22
|
clientOrServerError = ->
|
@@ -97,7 +96,7 @@ angular.module('ngTurbolinks', []).run(($location, $rootScope, $http, $q)->
|
|
97
96
|
|
98
97
|
changePage = (title, body, csrfToken, runScripts) ->
|
99
98
|
document.title = title
|
100
|
-
|
99
|
+
angular.element("body").html($compile("<div id=\"turbolinks_content\">"+body.innerHTML+"</div>")($rootScope))
|
101
100
|
CSRFToken.update csrfToken if csrfToken?
|
102
101
|
executeScriptTags() if runScripts
|
103
102
|
currentState = window.history.state
|
@@ -126,10 +125,12 @@ angular.module('ngTurbolinks', []).run(($location, $rootScope, $http, $q)->
|
|
126
125
|
xhr_req = $q.defer()
|
127
126
|
|
128
127
|
triggerEvent 'page:fetch', url: url
|
129
|
-
$http
|
128
|
+
$http({
|
129
|
+
url: url,
|
130
|
+
method: 'GET',
|
130
131
|
headers: {
|
131
|
-
'Accept' : 'text/html, application/xhtml+xml, application/xml'
|
132
|
-
'X-XHR-Referer' : referer
|
132
|
+
'Accept' : 'text/html, application/xhtml+xml, application/xml',
|
133
|
+
'X-XHR-Referer' : window.referer
|
133
134
|
},
|
134
135
|
timeout: xhr_req.promise
|
135
136
|
}).success((data, status, headers)->
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: angular-turbolinks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cary Dunn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|