fix #1647 (add 'View Error Logs...' button to bottom left of error dialog, if applicable)

This commit is contained in:
rolux 2013-07-21 10:29:36 +00:00
parent 6015528f8e
commit d6d44f2878

View file

@ -2,7 +2,8 @@
'use strict'; 'use strict';
pandora.ui.errorDialog = function(data) { pandora.ui.errorDialog = function(data) {
var that, error;
var that, error, showLogsButton;
//dont open dialog on unload or if antoher error is open //dont open dialog on unload or if antoher error is open
//fixme: error dialog should updated instead //fixme: error dialog should updated instead
@ -36,8 +37,22 @@ pandora.ui.errorDialog = function(data) {
// in order to keep the dialog from appearing, delay it // in order to keep the dialog from appearing, delay it
setTimeout(function() { setTimeout(function() {
if ($('.OxErrorDialog').length == 0 && !pandora.isUnloading) { if ($('.OxErrorDialog').length == 0 && !pandora.isUnloading) {
showLogsButton = error == 'error'
&& pandora.site.capabilities.canSeeDebugMenu[pandora.user.level]
that = pandora.ui.iconDialog({ that = pandora.ui.iconDialog({
buttons: [ buttons: (showLogsButton ? [
Ox.Button({
id: 'close',
title: Ox._('View Error Logs...')
})
.bindEvent({
click: function() {
that.close();
pandora.$ui.logsDialog = pandora.ui.logsDialog().open();
}
}),
{}
] : []).concat([
Ox.Button({ Ox.Button({
id: 'close', id: 'close',
title: Ox._('Close') title: Ox._('Close')
@ -47,7 +62,7 @@ pandora.ui.errorDialog = function(data) {
that.close(); that.close();
} }
}) })
], ]),
keys: {enter: 'close', escape: 'close'}, keys: {enter: 'close', escape: 'close'},
text: Ox._('Sorry, a server {0}' text: Ox._('Sorry, a server {0}'
+ ' occured while handling your request.' + ' occured while handling your request.'