ajaxify_rails 0.9.5 → 0.9.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +12 -0
- data/ajaxify_rails.gemspec +1 -1
- data/lib/ajaxify_rails/version.rb +1 -1
- data/vendor/assets/javascripts/ajaxify_rails.js.coffee +12 -1
- metadata +34 -60
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2895a5c9cadb73fcfd2e54bd6a982ee5b0d3301d
|
4
|
+
data.tar.gz: ffb0853af8c2a191105101d351dd0280baa313b6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 82dfba947b9f182d39ae4b9b35a43abf5e9f2ccafe72dd9e0649a814c8f850517ceff5c760dd6bb042548674fbabc7598b80e584c35c3e25ad8c2cdab6261a25
|
7
|
+
data.tar.gz: 104fe8b567333ddce81c3634e40ade4dcbae41e709c7a7b6c5952793873bb0809dbc2ad6365fd915690481d5cc514cc28c5021bdbab5c486e64bb647538e7b17
|
data/README.md
CHANGED
@@ -207,6 +207,18 @@ You can also change the setting for individual links by adding classes:
|
|
207
207
|
= link_to "Scroll to top", scroll_to_top_path, class: 'scroll_to_top'
|
208
208
|
= link_to "Don't scroll", no_scroll_path, class: 'no_scroll_to_top'
|
209
209
|
|
210
|
+
### Loader animation
|
211
|
+
|
212
|
+
By default, ajaxify displays a loader animation when you click on a link or submit a form.
|
213
|
+
You can change this default behavior by setting 'display_loader' to false on init.
|
214
|
+
|
215
|
+
Ajaxify.init
|
216
|
+
display_loader: false
|
217
|
+
|
218
|
+
You can also change the setting for individual links by adding classes:
|
219
|
+
|
220
|
+
= link_to "Display loader", display_loader_path, class: 'display_loader'
|
221
|
+
= link_to "Don't display loader", no_display_loader_path, class: 'no_display_loader'
|
210
222
|
|
211
223
|
## Contributing
|
212
224
|
|
data/ajaxify_rails.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |gem|
|
|
26
26
|
gem.add_development_dependency 'rspec-rails', '2.9.0'
|
27
27
|
gem.add_development_dependency 'rspec-steps', '0.0.8'
|
28
28
|
gem.add_development_dependency 'capybara'
|
29
|
-
gem.add_development_dependency 'selenium-webdriver', '>= 2.
|
29
|
+
gem.add_development_dependency 'selenium-webdriver', '>= 2.42.0'
|
30
30
|
gem.add_development_dependency 'sqlite3'
|
31
31
|
gem.add_development_dependency 'haml', '>= 3.1.5'
|
32
32
|
gem.add_development_dependency 'sass-rails', '~> 3.2.3'
|
@@ -10,6 +10,7 @@ ignore_hash_change = null
|
|
10
10
|
load_page_from_hash = null
|
11
11
|
|
12
12
|
scroll_to_top = true
|
13
|
+
display_loader = true
|
13
14
|
|
14
15
|
initial_history_state =
|
15
16
|
url: window.location.href
|
@@ -44,6 +45,7 @@ init = (options = {}) ->
|
|
44
45
|
content_container = options.content_container if 'content_container' of options
|
45
46
|
correct_url() unless $('meta[name="ajaxify:dont_correct_url"]').length > 0
|
46
47
|
scroll_to_top = options.scroll_to_top if 'scroll_to_top' of options
|
48
|
+
display_loader = options.display_loader if 'display_loader' of options
|
47
49
|
rails_ujs_fix()
|
48
50
|
|
49
51
|
|
@@ -65,6 +67,7 @@ ajaxify = ->
|
|
65
67
|
confirm: $this.data('confirm')
|
66
68
|
element: $this
|
67
69
|
scroll_to_top: set_scroll_to_top($this)
|
70
|
+
display_loader: set_display_loader($this)
|
68
71
|
|
69
72
|
false
|
70
73
|
|
@@ -87,6 +90,7 @@ ajaxify = ->
|
|
87
90
|
confirm: $this.data('confirm')
|
88
91
|
element: $this
|
89
92
|
scroll_to_top: set_scroll_to_top($this)
|
93
|
+
display_loader: set_display_loader($this)
|
90
94
|
|
91
95
|
false
|
92
96
|
|
@@ -108,6 +112,7 @@ ajaxify = ->
|
|
108
112
|
|
109
113
|
load = (options, pop_state = false) ->
|
110
114
|
|
115
|
+
|
111
116
|
unless load_page_from_hash
|
112
117
|
|
113
118
|
data = options.data || { ajaxified: true }
|
@@ -136,7 +141,8 @@ load = (options, pop_state = false) ->
|
|
136
141
|
type: type
|
137
142
|
cache: true
|
138
143
|
beforeSend: (xhr) ->
|
139
|
-
|
144
|
+
options.display_loader = display_loader unless 'display_loader' of options
|
145
|
+
$("##{content_container}").html( loader_element ) if options.display_loader
|
140
146
|
options.scroll_to_top = scroll_to_top unless 'scroll_to_top' of options
|
141
147
|
scroll_page_to_top() if options.scroll_to_top
|
142
148
|
|
@@ -312,6 +318,11 @@ set_scroll_to_top = ($link_or_form) ->
|
|
312
318
|
no_scroll = $link_or_form.hasClass('no_scroll_to_top')
|
313
319
|
if scroll or no_scroll then return (scroll and !no_scroll) else return scroll_to_top
|
314
320
|
|
321
|
+
set_display_loader = ($link_or_form) ->
|
322
|
+
display = $link_or_form.hasClass('display_loader')
|
323
|
+
no_display = $link_or_form.hasClass('no_display_loader')
|
324
|
+
if display or no_display then return (display and !no_display) else return display_loader
|
325
|
+
|
315
326
|
|
316
327
|
scroll_page_to_top = ->
|
317
328
|
$('html, body').animate
|
metadata
CHANGED
@@ -1,52 +1,46 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ajaxify_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
5
|
-
prerelease:
|
4
|
+
version: 0.9.6
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Nico Ritsche
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-09-12 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rails
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 3.2.0
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 3.2.0
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: jquery-rails
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rspec-rails
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - '='
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,7 +48,6 @@ dependencies:
|
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - '='
|
60
53
|
- !ruby/object:Gem::Version
|
@@ -62,7 +55,6 @@ dependencies:
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: rspec-steps
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
59
|
- - '='
|
68
60
|
- !ruby/object:Gem::Version
|
@@ -70,7 +62,6 @@ dependencies:
|
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
66
|
- - '='
|
76
67
|
- !ruby/object:Gem::Version
|
@@ -78,117 +69,102 @@ dependencies:
|
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: capybara
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - ">="
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: '0'
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - ">="
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: '0'
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: selenium-webdriver
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
|
-
- -
|
87
|
+
- - ">="
|
100
88
|
- !ruby/object:Gem::Version
|
101
|
-
version: 2.
|
89
|
+
version: 2.42.0
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
|
-
- -
|
94
|
+
- - ">="
|
108
95
|
- !ruby/object:Gem::Version
|
109
|
-
version: 2.
|
96
|
+
version: 2.42.0
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
98
|
name: sqlite3
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
100
|
requirements:
|
115
|
-
- -
|
101
|
+
- - ">="
|
116
102
|
- !ruby/object:Gem::Version
|
117
103
|
version: '0'
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
107
|
requirements:
|
123
|
-
- -
|
108
|
+
- - ">="
|
124
109
|
- !ruby/object:Gem::Version
|
125
110
|
version: '0'
|
126
111
|
- !ruby/object:Gem::Dependency
|
127
112
|
name: haml
|
128
113
|
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
114
|
requirements:
|
131
|
-
- -
|
115
|
+
- - ">="
|
132
116
|
- !ruby/object:Gem::Version
|
133
117
|
version: 3.1.5
|
134
118
|
type: :development
|
135
119
|
prerelease: false
|
136
120
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
121
|
requirements:
|
139
|
-
- -
|
122
|
+
- - ">="
|
140
123
|
- !ruby/object:Gem::Version
|
141
124
|
version: 3.1.5
|
142
125
|
- !ruby/object:Gem::Dependency
|
143
126
|
name: sass-rails
|
144
127
|
requirement: !ruby/object:Gem::Requirement
|
145
|
-
none: false
|
146
128
|
requirements:
|
147
|
-
- - ~>
|
129
|
+
- - "~>"
|
148
130
|
- !ruby/object:Gem::Version
|
149
131
|
version: 3.2.3
|
150
132
|
type: :development
|
151
133
|
prerelease: false
|
152
134
|
version_requirements: !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
135
|
requirements:
|
155
|
-
- - ~>
|
136
|
+
- - "~>"
|
156
137
|
- !ruby/object:Gem::Version
|
157
138
|
version: 3.2.3
|
158
139
|
- !ruby/object:Gem::Dependency
|
159
140
|
name: coffee-rails
|
160
141
|
requirement: !ruby/object:Gem::Requirement
|
161
|
-
none: false
|
162
142
|
requirements:
|
163
|
-
- - ~>
|
143
|
+
- - "~>"
|
164
144
|
- !ruby/object:Gem::Version
|
165
145
|
version: 3.2.1
|
166
146
|
type: :development
|
167
147
|
prerelease: false
|
168
148
|
version_requirements: !ruby/object:Gem::Requirement
|
169
|
-
none: false
|
170
149
|
requirements:
|
171
|
-
- - ~>
|
150
|
+
- - "~>"
|
172
151
|
- !ruby/object:Gem::Version
|
173
152
|
version: 3.2.1
|
174
|
-
description:
|
175
|
-
via ajax. Works by turning all internal links into
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
approach for browsers without the history interface (like Internet Explorer <10).\n
|
181
|
-
\ Transparently handles redirects and supports flash messages
|
182
|
-
and page titles. Requires Ruby 1.9 and the asset pipeline."
|
153
|
+
description: |-
|
154
|
+
Automatically makes your Rails app loading content in the background via ajax. Works by turning all internal links into
|
155
|
+
ajax links that trigger an update of the page's content area. Also form submissions are automatically turned into ajax requests.
|
156
|
+
Uses the html5 history interface for changing the url and making the browser's back and forward buttons working with ajax.
|
157
|
+
Falls back to a hash based approach for browsers without the history interface (like Internet Explorer <10).
|
158
|
+
Transparently handles redirects and supports flash messages and page titles. Requires Ruby 1.9 and the asset pipeline.
|
183
159
|
email:
|
184
160
|
- ncrdevmail@gmail.com
|
185
161
|
executables: []
|
186
162
|
extensions: []
|
187
163
|
extra_rdoc_files: []
|
188
164
|
files:
|
189
|
-
- .gitignore
|
190
|
-
- .rspec
|
191
|
-
- .travis.yml
|
165
|
+
- ".gitignore"
|
166
|
+
- ".rspec"
|
167
|
+
- ".travis.yml"
|
192
168
|
- Gemfile
|
193
169
|
- LICENSE
|
194
170
|
- README.md
|
@@ -250,27 +226,26 @@ files:
|
|
250
226
|
homepage: https://github.com/ncri/ajaxify_rails
|
251
227
|
licenses:
|
252
228
|
- MIT
|
229
|
+
metadata: {}
|
253
230
|
post_install_message:
|
254
231
|
rdoc_options: []
|
255
232
|
require_paths:
|
256
233
|
- lib
|
257
234
|
required_ruby_version: !ruby/object:Gem::Requirement
|
258
|
-
none: false
|
259
235
|
requirements:
|
260
|
-
- -
|
236
|
+
- - ">="
|
261
237
|
- !ruby/object:Gem::Version
|
262
238
|
version: '0'
|
263
239
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
264
|
-
none: false
|
265
240
|
requirements:
|
266
|
-
- -
|
241
|
+
- - ">="
|
267
242
|
- !ruby/object:Gem::Version
|
268
243
|
version: '0'
|
269
244
|
requirements: []
|
270
245
|
rubyforge_project:
|
271
|
-
rubygems_version: 1.
|
246
|
+
rubygems_version: 2.1.11
|
272
247
|
signing_key:
|
273
|
-
specification_version:
|
248
|
+
specification_version: 4
|
274
249
|
summary: Rails gem for automatically turning internal links/forms into ajax links/forms
|
275
250
|
that load content without a full page reload.
|
276
251
|
test_files:
|
@@ -322,4 +297,3 @@ test_files:
|
|
322
297
|
- spec/ajaxify_test/script/rails
|
323
298
|
- spec/integration/ajaxify_rails_spec.rb
|
324
299
|
- spec/spec_helper.rb
|
325
|
-
has_rdoc:
|