angular-turbolinks 0.0.3 → 0.0.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: cd6b8ef2020d02124d74472c5919f16e5a033c58
4
- data.tar.gz: 5b855413d3f56d8ddd16f64785a9b8817f366ba5
3
+ metadata.gz: 36dbb7b58a7c8bacd11b185dfeda4b89d6cfe4bc
4
+ data.tar.gz: 28185ce5a0343fe6d36c5da8428149eeb14c16e4
5
5
  SHA512:
6
- metadata.gz: 1b3cda9c629dab4d3b25b8f04ea2105f18205492a3fb3c82b23ac1a20ed31c0a02c183f114fa87f7b7c8d848947ae30f4ff97500e659ba59b759aeffa52d3727
7
- data.tar.gz: 7b383624a784b779116cccfe5bc24133185ace2c25f3b68d042ddadc44c71d282567765ea4e5ecff719228f705156c85311a867612fe331a129fbbc932d27de0
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,5 +1,5 @@
1
1
  module Angular
2
2
  module Turbolinks
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
@@ -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
- document.documentElement.replaceChild body, document.body
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.get(url, {
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.3
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-01-28 00:00:00.000000000 Z
11
+ date: 2014-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler