ajaxify_rails 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
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 in the content area. But before that a callback is triggered which can be used to grab the extra content and do something with it.
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 `Ajaxify.<i>option_or_callback</i> =` :
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() is called.
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 ajax request's response.
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.
@@ -1,3 +1,3 @@
1
1
  module AjaxifyRails
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -227,7 +227,7 @@
227
227
  self = this
228
228
  new RegExp("^\/(#{ $.map(this.base_paths, (el) ->
229
229
  el = self.regexp_escape el
230
- "#{el}$|#{el}\/|#{el}\\?"
230
+ "##{el}($|\/|\\?)"
231
231
  ).join('|')})", 'i')
232
232
 
233
233
 
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.0
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-01 00:00:00.000000000 Z
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: -633676263999916189
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: -633676263999916189
78
+ hash: 3508400671122042699
79
79
  requirements: []
80
80
  rubyforge_project:
81
81
  rubygems_version: 1.8.24