ajaxify_rails 0.1.0 → 0.1.1
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 +11 -5
- data/lib/ajaxify_rails/version.rb +1 -1
- data/vendor/assets/javascripts/ajaxify_rails.js.coffee +1 -1
- metadata +4 -4
data/README.md
CHANGED
@@ -133,7 +133,7 @@ Important: `Ajaxify.base_paths` need to be set before `Ajaxify.init()` is called
|
|
133
133
|
|
134
134
|
Sometimes you need to do non trivial modifications of the layout whenever the content in the main content area of your site changes.
|
135
135
|
Ajaxify allows you to attach arbitrary html to ajaxified requests. This extra html is then stripped from the main content
|
136
|
-
that is inserted
|
136
|
+
that is inserted into the content area. But before that a callback is triggered which can be used to grab the extra content and do something with it.
|
137
137
|
To use this feature you need to provide a method `ajaxify_extra_content` in your ApplicationController:
|
138
138
|
|
139
139
|
def ajaxify_extra_content
|
@@ -151,21 +151,27 @@ And then, on the client side hook into Ajaxify using the `handle_extra_content`
|
|
151
151
|
Ajaxify.handle_extra_content = ->
|
152
152
|
$('#my_fancy_widget').html $('#ajaxify_content #my_fancy_widget_html').html()
|
153
153
|
|
154
|
+
Tip: you can call view helpers to render extra content from within your controller using the view_context:
|
155
|
+
|
156
|
+
def ajaxify_extra_content
|
157
|
+
view_context.my_fancy_widget
|
158
|
+
end
|
154
159
|
|
155
160
|
### Reference: All Javascript Options and Callbacks
|
156
161
|
|
157
|
-
Here is a reference of all options and callbacks you can set on the client side via
|
162
|
+
Here is a reference of all options and callbacks you can set on the client side via Ajaxify.<i>option_or_callback</i> = :
|
158
163
|
|
159
164
|
Option/Callback Default Description
|
160
165
|
|
161
|
-
active true Switches Ajaxify on or off. Needs to be set before Ajaxify.init()
|
166
|
+
active true Switches Ajaxify on or off. Needs to be set before Ajaxify.init().
|
162
167
|
content_container 'main' Id of the container to insert the main content into ("yield wrapper").
|
163
|
-
base_paths null Base path segments for applications with root url redirects.
|
168
|
+
base_paths null Base path segments for applications with root url redirects.
|
169
|
+
Needs to be set before Ajaxify.init().
|
164
170
|
|
165
171
|
on_before_load null Callback: Called before the ajaxify request is started.
|
166
172
|
on_success null Callback: Called when an ajaxify requests finished successfully.
|
167
173
|
on_success_once null Callback: Like on_success but only called once.
|
168
|
-
handle_extra_content null Callback: Called before extra content is stripped from the
|
174
|
+
handle_extra_content null Callback: Called before extra content is stripped from the Ajax request's response.
|
169
175
|
|
170
176
|
flash_types ['notice'] Flash types your Rails app uses. E.g. ['notice', 'warning', 'error']
|
171
177
|
flash_effect null Callback: Called for each flash type after flash is set.
|
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
|
+
version: 0.1.1
|
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-10-
|
12
|
+
date: 2012-10-05 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:
|
69
|
+
hash: 3508400671122042699
|
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:
|
78
|
+
hash: 3508400671122042699
|
79
79
|
requirements: []
|
80
80
|
rubyforge_project:
|
81
81
|
rubygems_version: 1.8.24
|