diff options
author | Aleksander Machniak <alec@alec.pl> | 2013-12-05 13:36:02 +0100 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2013-12-05 13:36:02 +0100 |
commit | c50eee4827da18cd4517decfe521e8a32638069b (patch) | |
tree | 743b81565ce845004d05287242b61281d1b4031a | |
parent | 584de9e698aee8f44ac66b5b544be6e2a5ebc8f9 (diff) |
Improved error messages
- display errors only in dialogs (hide original message element),
- fix error when closing dialog on timeout after dialog was closed manually,
- center dialog vertically on the screen,
- use fadeOut effect on close.
-rw-r--r-- | skins/larry/ui.js | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/skins/larry/ui.js b/skins/larry/ui.js index a3c64b437..d203acf57 100644 --- a/skins/larry/ui.js +++ b/skins/larry/ui.js @@ -432,6 +432,9 @@ function rcube_mail_ui() // show a popup dialog on errors if (p.type == 'error' && rcmail.env.task != 'login') { + // hide original message object, we don't want both + rcmail.hide_message(p.object); + if (me.message_timer) { window.clearTimeout(me.message_timer); } @@ -440,8 +443,10 @@ function rcube_mail_ui() } var msg = p.message, - pos = $(p.object).offset(); - pos.top -= (rcmail.env.task == 'login' ? 20 : 160); + dialog_close = function() { + // check if dialog is still displayed, to prevent from js error + me.messagedialog.is(':visible') && me.messagedialog.dialog('destroy').hide(); + }; if (me.messagedialog.is(':visible')) msg = me.messagedialog.html() + '<p>' + p.message + '</p>'; @@ -452,16 +457,14 @@ function rcube_mail_ui() closeOnEscape: true, dialogClass: 'popupmessage ' + p.type, title: env.errortitle, - close: function() { - me.messagedialog.dialog('destroy').hide(); - }, - position: ['center', pos.top], - hide: { effect:'drop', direction:'right' }, + close: dialog_close, + position: ['center', 'center'], + hide: {effect: 'fadeOut'}, width: 420, minHeight: 90 }).show(); - me.message_timer = window.setTimeout(function(){ me.messagedialog.dialog('close'); }, Math.max(3000, p.timeout / 2)); + me.message_timer = window.setTimeout(dialog_close, p.timeout); } } |