thin_man 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/ajax_bindings.js +22 -2
- data/lib/thin_man/version.rb +1 -1
- metadata +2 -3
- data/README.rdoc +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d00329ddfe51a637f6088d3b89b079785f96712
|
4
|
+
data.tar.gz: 086eabbc3e3e40ac4f47c66283a437d8fa34b346
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d326aab5823d229956a95ed9b25f3ccce815882b4bc9beffe49cce10bbcceaf7fe3a389c1e7a11b8026f3193d5ee247baad6e28520f6e02cf19e040d9ddfb9ab
|
7
|
+
data.tar.gz: f514f44a1af282a4f440d7ecc10563f23b76745ead1e26fbf9d14f52a853e577b062e7a163f41b048bba7275a0cdaae2ab8e6a1816fcd6c3972ecfb063163ce5
|
@@ -112,11 +112,18 @@ var AjaxSubmission = Class.extend({
|
|
112
112
|
$(form_map[step]).ScrollTo();
|
113
113
|
}
|
114
114
|
},
|
115
|
-
ajaxComplete: function(
|
115
|
+
ajaxComplete: function(jqXHR) {
|
116
|
+
response_data = JSON.parse(jqXHR.responseText)
|
116
117
|
this.showTrigger();
|
117
118
|
if(this.progress_indicator){
|
118
119
|
this.progress_indicator.stop();
|
119
120
|
}
|
121
|
+
if(typeof response_data.flash_message != 'undefined'){
|
122
|
+
console.log('got a flash')
|
123
|
+
flash_style = this.httpResponseToFlashStyle(jqXHR.status)
|
124
|
+
console.log(flash_style)
|
125
|
+
new AjaxFlash(flash_style, response_data.flash_message,this.target);
|
126
|
+
}
|
120
127
|
},
|
121
128
|
ajaxBefore: function(jqXHr) {
|
122
129
|
this.toggleLoading();
|
@@ -125,7 +132,7 @@ var AjaxSubmission = Class.extend({
|
|
125
132
|
ajaxError: function(jqXHR) {
|
126
133
|
if(jqXHR.status == 409){
|
127
134
|
this.error_target.html(jqXHR.responseText);
|
128
|
-
}else{
|
135
|
+
}else if(jqXHR.status == 500){
|
129
136
|
alert('There was an error communicating with the server.')
|
130
137
|
}
|
131
138
|
},
|
@@ -141,6 +148,15 @@ var AjaxSubmission = Class.extend({
|
|
141
148
|
this.target.find('[data-loading-visible="true"]').removeClass('hidden');
|
142
149
|
}
|
143
150
|
}
|
151
|
+
},
|
152
|
+
httpResponseToFlashStyle: function(response_code){
|
153
|
+
if([403,409,500].indexOf(response_code) > -1){
|
154
|
+
return 'error'
|
155
|
+
}
|
156
|
+
if([200].indexOf(response_code) > -1){
|
157
|
+
return 'success'
|
158
|
+
}
|
159
|
+
return 'error'
|
144
160
|
}
|
145
161
|
});
|
146
162
|
|
@@ -195,6 +211,10 @@ var AjaxProgress = Class.extend({
|
|
195
211
|
});
|
196
212
|
var AjaxFlash = Class.extend({
|
197
213
|
init: function(type,message,elem){
|
214
|
+
console.log('ajaxflash:')
|
215
|
+
console.log(type)
|
216
|
+
console.log(message)
|
217
|
+
console.log(elem)
|
198
218
|
this.flash_container = $('#ajax_flash_container').clone();
|
199
219
|
$('body').append(this.flash_container);
|
200
220
|
this.flash_container.css({position:'absolute',visibility: 'hidden'});
|
data/lib/thin_man/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thin_man
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Draut, Adam Bialek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -47,7 +47,6 @@ extensions: []
|
|
47
47
|
extra_rdoc_files: []
|
48
48
|
files:
|
49
49
|
- MIT-LICENSE
|
50
|
-
- README.rdoc
|
51
50
|
- Rakefile
|
52
51
|
- app/assets/javascripts/ajax_bindings.js
|
53
52
|
- lib/tasks/thin_man_tasks.rake
|
data/README.rdoc
DELETED