ajaxify_rails 0.8.5 → 0.8.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/ajaxify_rails/version.rb +1 -1
- data/vendor/assets/javascripts/ajaxify_rails.js.coffee +9 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba0012c77ba9a8760e3fb98f3dc17b8886a7926b
|
4
|
+
data.tar.gz: aeb1a058cb4635e143fb4a9ca4504b2cd565d388
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebd48960b8abca1fb59949613e3ab34154ba5f4e62ad2f29963ad83b362e6984ff00d1f088fe33382d6bf516c99bfdf13b0804d88fb53c9bd7699589905c4470
|
7
|
+
data.tar.gz: 5bddacac291cd96d987d8a512c930d9a4770677f192efe210654e39f87700c88f2653f0c717a3f5e78ce0340f89c2f9846ab3d472a18cbdde8f7c05f34fe8b83
|
data/README.md
CHANGED
@@ -90,7 +90,7 @@ It's a common use case to have a navigation that needs to change its appearence
|
|
90
90
|
to a different section of the page. Ajaxify provides a success callback that is triggered after successful
|
91
91
|
updates of the page's main content. Just bind to the `ajaxify:content_loaded' event and make your layout changes:
|
92
92
|
|
93
|
-
$(
|
93
|
+
$(document).on 'ajaxify:content_loaded', ->
|
94
94
|
# update navigation and/or other layout elements
|
95
95
|
|
96
96
|
|
@@ -158,7 +158,7 @@ For example you could provide html for a widget in the layout like this:
|
|
158
158
|
|
159
159
|
And then, on the client side bind to the `ajaxify:content_inserted` event and select the widget html via `#ajaxify_content`:
|
160
160
|
|
161
|
-
$(
|
161
|
+
$(document).on 'ajaxify:content_inserted', ->
|
162
162
|
$('#my_fancy_widget').html $('#ajaxify_content #my_fancy_widget_html').html()
|
163
163
|
|
164
164
|
Tip: you can call view helpers to render extra content from within your controller using the view_context:
|
@@ -4,6 +4,7 @@ base_paths = null
|
|
4
4
|
flash_types = ['notice']
|
5
5
|
dont_correct_url = false
|
6
6
|
push_state_enabled = true
|
7
|
+
loader_element = "<div class='ajaxify_loader'></div>"
|
7
8
|
|
8
9
|
ignore_hash_change = null
|
9
10
|
load_page_from_hash = null
|
@@ -31,6 +32,9 @@ get_content_container = ->
|
|
31
32
|
set_content_container = (new_content_container) ->
|
32
33
|
content_container = new_content_container
|
33
34
|
|
35
|
+
set_loader_element = (new_loader_element) ->
|
36
|
+
loader_element = new_loader_element
|
37
|
+
|
34
38
|
|
35
39
|
init = (options = {}) ->
|
36
40
|
base_paths = options.base_paths if 'base_paths' of options
|
@@ -132,7 +136,7 @@ load = (options, pop_state = false) ->
|
|
132
136
|
type: type
|
133
137
|
cache: true
|
134
138
|
beforeSend: (xhr) ->
|
135
|
-
$("##{content_container}").html(
|
139
|
+
$("##{content_container}").html( loader_element )
|
136
140
|
options.scroll_to_top = scroll_to_top unless 'scroll_to_top' of options
|
137
141
|
scroll_page_to_top() if options.scroll_to_top
|
138
142
|
|
@@ -323,7 +327,7 @@ reload_page_if_assets_stale = (url, jqXHR) ->
|
|
323
327
|
# <%= link_to 'test', test_path, :method => :delete %>
|
324
328
|
rails_ujs_fix = ->
|
325
329
|
return false unless 'rails' of jQuery
|
326
|
-
|
330
|
+
|
327
331
|
jQuery.rails.handleMethod = (link) ->
|
328
332
|
href = $.rails.href(link)
|
329
333
|
method = link.data('method')
|
@@ -338,8 +342,8 @@ rails_ujs_fix = ->
|
|
338
342
|
form.addClass('no_ajaxify') if link.hasClass('no_ajaxify')
|
339
343
|
|
340
344
|
if csrf_param != undefined && csrf_token != undefined
|
341
|
-
metadata_input += '<input name="' +
|
342
|
-
csrf_param + '" value="' +
|
345
|
+
metadata_input += '<input name="' +
|
346
|
+
csrf_param + '" value="' +
|
343
347
|
csrf_token + '" type="hidden" />'
|
344
348
|
|
345
349
|
form.attr('target', target) if target
|
@@ -351,7 +355,7 @@ rails_ujs_fix = ->
|
|
351
355
|
# public interface
|
352
356
|
# --------------------------------------------------------------------------------------------------------------------
|
353
357
|
|
354
|
-
@Ajaxify = { init, ajaxify, load, update_url, activate, set_content_container, get_content_container }
|
358
|
+
@Ajaxify = { init, ajaxify, load, update_url, activate, set_content_container, get_content_container, set_loader_element }
|
355
359
|
|
356
360
|
|
357
361
|
# --------------------------------------------------------------------------------------------------------------------
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ajaxify_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nico Ritsche
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|