thin_man 0.6.0 → 0.7.0
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 +32 -6
- data/lib/thin_man/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c78fa7fda7cd7c1a392af814feb0302669c812b0
|
4
|
+
data.tar.gz: b945bb9dc6bd45f6baf3930efff768c09638dee7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab36ac0ec87222b67cf959fe9a4efc2a0a2384f85182e4b9a08030a0b68a24c5561012e75bdffbaf13dfc7fd7e990990d09694c11aa50897d453d47826c9e6c9
|
7
|
+
data.tar.gz: 55deb2c24be04ab2eb04739ec43616edbf4cf515efa03cec9a86bb65c21d6ce6fb4e9001b16ca69700cdcb4a29fef4b6da8be83624286a42469581e68ba1a7e8
|
@@ -142,11 +142,19 @@ var AjaxSubmission = Class.extend({
|
|
142
142
|
// hmmm, the response is not JSON, so there's no flash.
|
143
143
|
}
|
144
144
|
if(typeof response_data.flash_message != 'undefined'){
|
145
|
-
flash_style = this.httpResponseToFlashStyle(jqXHR.status)
|
145
|
+
var flash_style = this.httpResponseToFlashStyle(jqXHR.status);
|
146
|
+
var flash_duration = null;
|
147
|
+
if(typeof response_data.flash_persist != 'undefined'){
|
148
|
+
if(response_data.flash_persist){
|
149
|
+
flash_duration = 'persist'
|
150
|
+
} else {
|
151
|
+
flash_duration = 'fade'
|
152
|
+
}
|
153
|
+
}
|
146
154
|
if(this.target){
|
147
|
-
new AjaxFlash(flash_style, response_data.flash_message,this.target);
|
155
|
+
new AjaxFlash(flash_style, response_data.flash_message,this.target, flash_duration);
|
148
156
|
}else{
|
149
|
-
new AjaxFlash(flash_style, response_data.flash_message,this.jq_obj);
|
157
|
+
new AjaxFlash(flash_style, response_data.flash_message,this.jq_obj, flash_duration);
|
150
158
|
}
|
151
159
|
}
|
152
160
|
if('function' == typeof this.params.on_complete){
|
@@ -241,16 +249,34 @@ var AjaxProgress = Class.extend({
|
|
241
249
|
}
|
242
250
|
});
|
243
251
|
var AjaxFlash = Class.extend({
|
244
|
-
init: function(type,message,elem){
|
252
|
+
init: function(type,message,elem,duration){
|
245
253
|
this.flash_container = $('#thin-man-flash-container').clone();
|
246
254
|
$('body').append(this.flash_container);
|
247
255
|
this.flash_container.css({position:'absolute',visibility: 'hidden'});
|
256
|
+
this.alert_type = type;
|
257
|
+
this.elem = elem;
|
248
258
|
var alert_class = 'alert-' + type;
|
249
259
|
this.flash_container.addClass(alert_class);
|
250
260
|
$('#thin-man-flash-content', this.flash_container).html(message);
|
251
261
|
this.flash_container.show();
|
262
|
+
this.setFadeBehavior(duration);
|
252
263
|
this.reposition(elem);
|
253
264
|
},
|
265
|
+
setFadeBehavior: function(duration){
|
266
|
+
if(duration){
|
267
|
+
if('persist' == duration){
|
268
|
+
this.fade = false
|
269
|
+
} else {
|
270
|
+
this.fade = true
|
271
|
+
}
|
272
|
+
}else{ //default behavior if persist duration is not sent back with message
|
273
|
+
if('error' == this.alert_type || 'warning' == this.alert_type || 'info' == this.alert_type){
|
274
|
+
this.fade = false;
|
275
|
+
} else {
|
276
|
+
this.fade = true;
|
277
|
+
}
|
278
|
+
}
|
279
|
+
},
|
254
280
|
reposition: function(elem){
|
255
281
|
var this_window = {
|
256
282
|
top: $(window).scrollTop(),
|
@@ -270,8 +296,8 @@ var AjaxFlash = Class.extend({
|
|
270
296
|
var new_left = this_window.horiz_middle - this_flash.half_width;
|
271
297
|
this.flash_container.css({left: new_left, top: new_top, visibility: 'visible'});
|
272
298
|
var ajax_flash = this;
|
273
|
-
if (
|
274
|
-
setTimeout(function(){ajax_flash.fadeOut()},
|
299
|
+
if (this.fade) {
|
300
|
+
setTimeout(function(){ajax_flash.fadeOut()},1618);
|
275
301
|
}
|
276
302
|
},
|
277
303
|
fadeOut: function(){
|
data/lib/thin_man/version.rb
CHANGED