turbograft 0.1.1 → 0.1.2

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: b7336e56e18aa8c8a4fb93ff535072f64ac3dac0
4
- data.tar.gz: bbb57483c734fbaa8a25c7fe2cf9269baccfe54d
3
+ metadata.gz: 98e3fe31660e162654524c5def92b11c1b5b5b8d
4
+ data.tar.gz: 4d8eb07bed2d1a13dcc75807d2e90c73785b6fa5
5
5
  SHA512:
6
- metadata.gz: 8dbe4c68b54a4ff8156b2d713bf751a2f0243115cd76b6f68fc56588cae161f78891a9956ec61f50670f6df11dacd2580db0d992f6031b4248495ae4de643262
7
- data.tar.gz: 0f9a1dc630afc7350709a04b60f7c402e2698f3585441be6910f0bef949f47549dd659c1e3624181cb7325f7f107ab5e1e35aee3a41d53ce04c7910d16867757
6
+ metadata.gz: 0de1bb1cba44e48c36c012e9083ea257d2588f67b9419e2f5e986e4f2878ff9fc2c23dbd8f769fe2be496f5b072a0fca6e63f98332547c599fb44d6139f338fc
7
+ data.tar.gz: 84cabcbb7e4754fffaa0dc986c197262f161c6deebb473bfa39d860e1e518ae8a50660e9a4cfabc0077482210cbf209b713d92666979ff11cbdf5e4c3d07e3e7
@@ -40,9 +40,6 @@ TurboGraft.handlers.remoteMethodHandler = (ev) ->
40
40
  refreshOnError: target.getAttribute('refresh-on-error')
41
41
  refreshOnErrorExcept: target.getAttribute('full-refresh-on-error-except')
42
42
 
43
- if !options.refreshOnSuccess && !options.refreshOnError && !options.refreshOnErrorExcept
44
- options.fullRefresh = true
45
-
46
43
  remote = new TurboGraft.Remote(options, null, target)
47
44
  remote.submit()
48
45
  return
@@ -61,9 +58,6 @@ TurboGraft.handlers.remoteFormHandler = (ev) ->
61
58
  refreshOnError: target.getAttribute('refresh-on-error')
62
59
  refreshOnErrorExcept: target.getAttribute('full-refresh-on-error-except')
63
60
 
64
- if !options.refreshOnSuccess && !options.refreshOnError && !options.refreshOnErrorExcept
65
- options.fullRefresh = true
66
-
67
61
  remote = new TurboGraft.Remote(options, target, target)
68
62
  remote.submit()
69
63
  return
@@ -17,6 +17,10 @@ class TurboGraft.Remote
17
17
  xhr.setRequestHeader('Accept', 'text/html, application/xhtml+xml, application/xml')
18
18
  xhr.setRequestHeader("Content-Type", @contentType) if @contentType
19
19
 
20
+ csrfTokenNode = document.querySelector('meta[name="X-CSRF-Token"]')
21
+ csrfToken = csrfTokenNode?.getAttribute('content')
22
+ xhr.setRequestHeader('X-CSRF-Token', csrfToken) if csrfToken
23
+
20
24
  triggerEventFor('turbograft:remote:init', @initiator, {xhr: xhr, initiator: @initiator})
21
25
 
22
26
  xhr.addEventListener 'loadstart', =>
@@ -91,6 +95,9 @@ class TurboGraft.Remote
91
95
  Page.refresh
92
96
  response: xhr
93
97
  onlyKeys: @refreshOnSuccess
98
+ else
99
+ Page.refresh
100
+ response: xhr
94
101
 
95
102
  onError: (ev) ->
96
103
  @opts.fail?()
@@ -1,3 +1,3 @@
1
1
  module TurboGraft
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
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.1
4
+ version: 0.1.2
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: 2014-12-05 00:00:00.000000000 Z
16
+ date: 2014-12-09 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: coffee-rails