From 56fdf12fd1d7f583e4a07e84b1af4595182c0d15 Mon Sep 17 00:00:00 2001 From: Tulio Casagrande Date: Fri, 24 Mar 2017 15:54:27 -0300 Subject: [#830] Improve timeout of user alerts with @anikarni --- web-ui/app/js/mail_view/ui/send_button.js | 3 ++- web-ui/app/js/user_alerts/ui/user_alerts.js | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'web-ui/app') diff --git a/web-ui/app/js/mail_view/ui/send_button.js b/web-ui/app/js/mail_view/ui/send_button.js index f31f893a..034f472c 100644 --- a/web-ui/app/js/mail_view/ui/send_button.js +++ b/web-ui/app/js/mail_view/ui/send_button.js @@ -91,7 +91,8 @@ define([ this.disableButton(); this.$node.text(viewHelper.i18n.t('sending-mail')); - this.trigger(document, events.ui.userAlerts.displayMessage, {message: viewHelper.i18n.t('sending-mail'), class: 'success'}); + this.trigger(document, events.ui.userAlerts.displayMessage, + {message: viewHelper.i18n.t('sending-mail'), class: 'success', dismissTimeout: 60000}); this.attr.sendingInProgress = true; diff --git a/web-ui/app/js/user_alerts/ui/user_alerts.js b/web-ui/app/js/user_alerts/ui/user_alerts.js index e944a7a5..bef3efcd 100644 --- a/web-ui/app/js/user_alerts/ui/user_alerts.js +++ b/web-ui/app/js/user_alerts/ui/user_alerts.js @@ -29,21 +29,22 @@ define( function userAlerts() { this.defaultAttrs({ - dismissTimeout: 3000 + dismissTimeout: 4000 }); this.render = function(message) { + clearTimeout(this.attr.timeout); this.$node.html(templates.userAlerts.message(message)); this.show(); - setTimeout(this.hide.bind(this), this.attr.dismissTimeout); + this.attr.timeout = setTimeout(this.hide.bind(this), message.dismissTimeout || this.attr.dismissTimeout); }; - this.displayMessage = function(ev, data) { this.render({ message: { content: data.message, - class: 'message-panel__growl--' + (data.class || 'success') + class: 'message-panel__growl--' + (data.class || 'success'), + dismissTimeout: data.dismissTimeout } }); }; @@ -54,4 +55,3 @@ define( } } ); - -- cgit v1.2.3