ajaxify_rails 0.1.4 → 0.1.5

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.
@@ -1,3 +1,3 @@
1
1
  module AjaxifyRails
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
@@ -66,8 +66,9 @@ ajaxify = ->
66
66
 
67
67
 
68
68
  # (history interface browsers only)
69
- window.onpopstate = (e) ->
70
- if e.state
69
+ $(window).on 'popstate', (e) ->
70
+ e = e.originalEvent
71
+ if e.state and e.state.data and e.state.data.ajaxified
71
72
  e.state.cache = false
72
73
  load e.state, true
73
74
 
@@ -195,6 +196,8 @@ update_url = (options, pop_state = false) ->
195
196
  window.history.replaceState initial_history_state, ''
196
197
  initial_history_state = ''
197
198
 
199
+ options.data ||= {}
200
+ options.data.ajaxified = true
198
201
  window.history.pushState
199
202
  url: options.url
200
203
  data: options.data
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ajaxify_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-09 00:00:00.000000000 Z
12
+ date: 2012-11-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -66,7 +66,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
66
66
  version: '0'
67
67
  segments:
68
68
  - 0
69
- hash: 1262153262325448279
69
+ hash: 4265493633309199773
70
70
  required_rubygems_version: !ruby/object:Gem::Requirement
71
71
  none: false
72
72
  requirements:
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  version: '0'
76
76
  segments:
77
77
  - 0
78
- hash: 1262153262325448279
78
+ hash: 4265493633309199773
79
79
  requirements: []
80
80
  rubyforge_project:
81
81
  rubygems_version: 1.8.24