Browse files

releasing version 0.0.3

  • Loading branch information...
ncri committed Sep 28, 2012
1 parent de74799 commit d6ab22f45094430da7b759755e036d91e8c7b04e
@@ -36,6 +36,14 @@ In your application.js file add:
## Usage
+Call `Ajaxify.init()` in your layout's javascript.
+Do this as early as possible to ensure Ajaxify's interchangeable url schemes (history api vs. hash based urls)
+work most effectively.
+The later you call `init()`, the later potential redirects from one scheme to another are performed,
+which means the more unnecessary work the browser has to do.
### Content Area
Ajaxify assumes that your app has a content container html tag with the id `main`.
@@ -104,12 +112,15 @@ Sometimes you need to redirect on the root url.
For example you might have a localized application with the locale inside the url.
When a user navigates to `` he/she gets redirected to e.g. ``. This works fine in browsers supporting
the html 5 history api. However, for browsers without the history api like Internet Explorer before version 10, Ajaxify needs hints
-about your url structure to not get confused (it creates endless redirects otherwise!). You need to explicitly supply some regex.
+about your url structure to not get confused (it creates endless redirects otherwise!). You need to explicitly supply all possible root
Example: if your app's root url potentially redirects to `` and ``
you need to hint Ajaxyfiy like this:
- Ajaxify.base_path_regexp = /^(\/en|\/de)/i
+ Ajaxify.base_paths = ['de', 'en']
+Important: `Ajaxify.base_paths` need to be set before `Ajaxify.init()` is called!
### Extra Content
@@ -143,7 +154,7 @@ Here is a reference of all options and callbacks you can set on the client side
active true Toggles link ajaxification.
content_container 'main' Id of the container to insert the main content into ("yield wrapper").
- base_path_regexp null Regex hint for applications with root url redirects.
+ base_paths null Base path segments for applications with root url redirects.
on_before_load null Callback: Called before the ajaxify request is started.
on_success null Callback: Called when an ajaxify requests finished successfully.
@@ -2,8 +2,6 @@
module AjaxifyRails
module Rails
class Engine < ::Rails::Engine
@@ -5,7 +5,7 @@
active: true
content_container: 'main'
handle_extra_content: null
- base_paths: <%= AjaxifyRails::BASE_PATHS.any? ? "[#{{ |p| "'#{p}'" }.join(',') }]" : 'null' %>
+ base_paths: null
# callbacks
@@ -32,7 +32,7 @@
ajaxified: true
- init: ->
+ ajaxify: ->
@@ -264,9 +264,12 @@
if != ''
window.location.href = "#{this.protocol_with_host()}/##{}" # move search behind #
+ init: ->
+ this.correct_url()
is_string: (variable) -> == '[object String]'
jQuery ->
- Ajaxify.init()
+ Ajaxify.ajaxify()

0 comments on commit d6ab22f

Please sign in to comment.