ajaxify_rails 0.9.2 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -12
- data/lib/ajaxify_rails/version.rb +1 -1
- data/vendor/assets/javascripts/ajaxify_rails.js.coffee +3 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1107c11b41b63db1244a65914330e9fcd94ea64c
|
4
|
+
data.tar.gz: f7ee15a6783e57e92571abd11264af80437bf09c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2c55191253da220a9591c9f36afae09152c59a80125737cc0201324215e8fc37d7c5e71a7c6a97da6b8626bb14bb57a4fb09de410a78ec9bf04bc646df708ae
|
7
|
+
data.tar.gz: 924437a6b84adde5d9f787c065d4bbc5ece0bc89652171930ae3de39c5a3a92f81be69d0e2e7ee48f49ab15e2706f980c5f1ba3373b81f3ac60dc9b33d8387bd
|
data/README.md
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# Ajaxify Rails [![Build Status](https://secure.travis-ci.org/ncri/ajaxify_rails.png)](http://travis-ci.org/ncri/ajaxify_rails)
|
2
2
|
|
3
|
-
No more full page reloads for your Rails app! Yay!
|
3
|
+
No more full page reloads for your Rails app! Yay!
|
4
4
|
|
5
5
|
Automatically makes your app loading content in the background via Ajax.
|
6
6
|
|
7
|
-
Works by turning all internal links into Ajax links that trigger an update of the page's content area.
|
7
|
+
Works by turning all internal links into Ajax links that trigger an update of the page's content area.
|
8
8
|
Also form submissions are automatically turned into Ajax requests.
|
9
9
|
|
10
|
-
Features:
|
10
|
+
Features:
|
11
11
|
|
12
12
|
- Uses the html5 history interface for changing the url and making the browser's back and forward buttons work with Ajax.
|
13
13
|
- Falls back to a hash based URL approach for browsers without the history interface (like Internet Explorer version <10).
|
@@ -47,7 +47,7 @@ In your application.js file add:
|
|
47
47
|
|
48
48
|
Call `Ajaxify.init()` in your layout's javascript.
|
49
49
|
Do this as early as possible to ensure Ajaxify's interchangeable url schemes (history api vs. hash based urls)
|
50
|
-
work most effectively.
|
50
|
+
work most effectively.
|
51
51
|
|
52
52
|
The later you call `init()`, the later potential redirects from one scheme to another are performed,
|
53
53
|
which means the more unnecessary work the browser has to do.
|
@@ -63,14 +63,14 @@ If yield doesn't have a wrapper in your app yet, you need to supply one to get a
|
|
63
63
|
|
64
64
|
You can set the content container of your app when initializing Ajaxify:
|
65
65
|
|
66
|
-
Ajaxify.init
|
66
|
+
Ajaxify.init
|
67
67
|
content_container: 'content_container_id'
|
68
68
|
|
69
69
|
or later using `set_content_container`:
|
70
70
|
|
71
71
|
Ajaxify.set_content_container('content_container_id')
|
72
|
-
|
73
|
-
|
72
|
+
|
73
|
+
|
74
74
|
### Loader Animation
|
75
75
|
|
76
76
|
You probably like to have a loader image to be displayed to the user while content loads via Ajax.
|
@@ -100,14 +100,14 @@ Ajaxify correctly displays your flash messages after ajaxified requests.
|
|
100
100
|
By default, only `flash[:notice]` is supported. If you are using for example `flash[:warning]` as well you have to add the flash_types
|
101
101
|
option to the `Ajaxify.init()` call:
|
102
102
|
|
103
|
-
Ajaxify.init
|
103
|
+
Ajaxify.init
|
104
104
|
flash_types: ['notice', 'warning']
|
105
|
-
|
105
|
+
|
106
106
|
Also make sure that you supply invisible wrapper tags in your layout for each flash type you use, with the id set to the type, e.g.:
|
107
107
|
|
108
108
|
#notice{ style: "#{'display:none' unless flash[:notice]}" }
|
109
|
-
= flash[:notice]
|
110
|
-
|
109
|
+
= flash[:notice]
|
110
|
+
|
111
111
|
### Full Page Reloads
|
112
112
|
|
113
113
|
Sometimes requests change the layout of the page so significantly that loading only the main content via Ajax
|
@@ -122,7 +122,7 @@ For these cases you can turn off Ajaxify, by simply adding the class `no_ajaxify
|
|
122
122
|
|
123
123
|
### Root Redirects
|
124
124
|
|
125
|
-
Sometimes you need to redirect on the root url.
|
125
|
+
Sometimes you need to redirect on the root url.
|
126
126
|
|
127
127
|
For example you might have a localized application with the locale inside the url.
|
128
128
|
When a user navigates to `your_domain.com` he/she gets redirected to e.g. `your_domain.com/en/`. This works fine in browsers supporting
|
@@ -175,6 +175,7 @@ Ajaxify provides a few jQuery events you can bind to:
|
|
175
175
|
* `ajaxify:content_loaded` => Triggered after an ajaxify request finished successfully. Params: `data, status, jqXHR, url`.
|
176
176
|
* `ajaxify:content_inserted` => Triggered after an ajaxify request finished but before extra content is stripped from the response.
|
177
177
|
* `ajaxify:flash_displayed` => Triggered after a flash message is displayed. Parameters: `flash_type`.
|
178
|
+
* `ajaxify:load_error` => Triggered if the ajaxify request goes wrong. Parameters: `data, status, jqXHR, url`.
|
178
179
|
|
179
180
|
|
180
181
|
### Javascript
|
@@ -143,6 +143,9 @@ load = (options, pop_state = false) ->
|
|
143
143
|
success: (data, status, jqXHR) ->
|
144
144
|
on_ajaxify_success data, status, jqXHR, pop_state, options
|
145
145
|
|
146
|
+
error: (data, status, jqXHR) ->
|
147
|
+
$(document).trigger('ajaxify:load_error', [data, status, jqXHR, options.url])
|
148
|
+
|
146
149
|
|
147
150
|
# --------------------------------------------------------------------------------------------------------------------
|
148
151
|
# private methods
|
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.9.
|
4
|
+
version: 0.9.3
|
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-10-
|
11
|
+
date: 2013-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -243,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
243
243
|
version: '0'
|
244
244
|
requirements: []
|
245
245
|
rubyforge_project:
|
246
|
-
rubygems_version: 2.
|
246
|
+
rubygems_version: 2.1.10
|
247
247
|
signing_key:
|
248
248
|
specification_version: 4
|
249
249
|
summary: Rails gem for automatically turning internal links/forms into ajax links/forms
|