ajaxify_rails 0.7.8 → 0.8.0

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.7.8"
2
+ VERSION = "0.8.0"
3
3
  end
@@ -87,7 +87,8 @@ ajaxify = ->
87
87
  # (history interface browsers only)
88
88
  $(window).on 'popstate', (e) ->
89
89
  e = e.originalEvent
90
- if e.state and e.state.data and e.state.data.ajaxified
90
+ data = if e.state and e.state.data then url_params_as_object(e.state.data) else null
91
+ if data and data.ajaxified
91
92
  e.state.cache = false
92
93
  load e.state, true
93
94
 
@@ -276,6 +277,9 @@ base_path_regexp = ->
276
277
  is_string = (variable) ->
277
278
  Object.prototype.toString.call(variable) == '[object String]'
278
279
 
280
+ url_params_as_object = (param_string_or_object) ->
281
+ return param_string_or_object unless is_string( param_string_or_object )
282
+ JSON.parse('{"' + decodeURI(param_string_or_object.replace(/&/g, "\",\"").replace(/\=/g,"\":\"")) + '"}')
279
283
 
280
284
  regexp_escape = (str) ->
281
285
  str.replace new RegExp('[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\-]', 'g'), '\\$&'
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.7.8
4
+ version: 0.8.0
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: 2013-05-01 00:00:00.000000000 Z
12
+ date: 2013-05-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -261,7 +261,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
261
261
  version: '0'
262
262
  segments:
263
263
  - 0
264
- hash: 2283778831851444221
264
+ hash: -1863170466468495387
265
265
  required_rubygems_version: !ruby/object:Gem::Requirement
266
266
  none: false
267
267
  requirements:
@@ -270,7 +270,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
270
270
  version: '0'
271
271
  segments:
272
272
  - 0
273
- hash: 2283778831851444221
273
+ hash: -1863170466468495387
274
274
  requirements: []
275
275
  rubyforge_project:
276
276
  rubygems_version: 1.8.25