ajaxify_rails 0.7.6 → 0.7.7

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.
data/README.md CHANGED
@@ -187,6 +187,10 @@ loaded via Ajaxify.
187
187
  ### Toggle Ajaxify
188
188
 
189
189
  You can temporarily deactivate Ajaxify by calling `Ajaxify.activate(false)`. You can switch it on again with `Ajaxify.activate()`.
190
+ Note that `Ajaxify.activate` has to be called before the DOM is ready. Alternatively, you can set the `active` option to false when initializing Ajaxify to temporarily disable ajaxification, e.g.
191
+
192
+ Ajaxify.init
193
+ active: false
190
194
 
191
195
 
192
196
  ### Scrolling
@@ -1,3 +1,3 @@
1
1
  module AjaxifyRails
2
- VERSION = "0.7.6"
2
+ VERSION = "0.7.7"
3
3
  end
@@ -173,32 +173,33 @@ update_url = (options, pop_state = false) ->
173
173
  on_ajaxify_success = (data, status, jqXHR, pop_state, options) ->
174
174
  $("##{content_container}").html data
175
175
 
176
- title = $('#ajaxify_content').data('page-title')
177
- flashes = $('#ajaxify_content').data('flashes')
176
+ if $('#ajaxify_content').length > 0 # it can happen that #ajaxify_content is not present at this point, on ajaxify redirects for example
177
+ title = $('#ajaxify_content').data('page-title')
178
+ flashes = $('#ajaxify_content').data('flashes')
178
179
 
179
- # Correct the url after a redirect and when it has the ajaxify param in it.
180
- # The latter can happen e.g. for pagination links that are auto generated.
181
- original_request_type = options.type
182
- current_url = $('#ajaxify_content #ajaxify_location').html()
183
- if options.url != current_url
184
- options.url = current_url.replace(/(&|&|\?)ajaxify_redirect=true/,'')
185
- options.type = 'GET'
180
+ # Correct the url after a redirect and when it has the ajaxify param in it.
181
+ # The latter can happen e.g. for pagination links that are auto generated.
182
+ original_request_type = options.type
183
+ current_url = $('#ajaxify_content #ajaxify_location').html()
184
+ if options.url != current_url
185
+ options.url = current_url.replace(/(&|&|\?)ajaxify_redirect=true/,'')
186
+ options.type = 'GET'
186
187
 
187
- unless original_request_type and original_request_type.toLowerCase() == 'post'
188
- reload_page_if_assets_stale options.url, jqXHR
188
+ unless original_request_type and original_request_type.toLowerCase() == 'post'
189
+ reload_page_if_assets_stale options.url, jqXHR
189
190
 
190
- update_url options, pop_state
191
+ update_url options, pop_state
191
192
 
192
- $(document).trigger 'ajaxify:content_inserted'
193
+ $(document).trigger 'ajaxify:content_inserted'
193
194
 
194
- $("##{content_container} #ajaxify_content").remove()
195
+ $("##{content_container} #ajaxify_content").remove()
195
196
 
196
- if title
197
- document.title = title.replace /&/, '&' # Todo: need to figure out what else needs to be unescaped
197
+ if title
198
+ document.title = title.replace /&/, '&' # Todo: need to figure out what else needs to be unescaped
198
199
 
199
- show_flashes(flashes)
200
+ show_flashes(flashes)
200
201
 
201
- $(document).trigger('ajaxify:content_loaded', [data, status, jqXHR, options.url])
202
+ $(document).trigger('ajaxify:content_loaded', [data, status, jqXHR, options.url])
202
203
 
203
204
 
204
205
  correct_url = ->
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.6
4
+ version: 0.7.7
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-04-04 00:00:00.000000000 Z
12
+ date: 2013-04-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails