From d6d44f2878482ed7baacbdb4a653244b576bcd85 Mon Sep 17 00:00:00 2001 From: rolux Date: Sun, 21 Jul 2013 10:29:36 +0000 Subject: [PATCH] fix #1647 (add 'View Error Logs...' button to bottom left of error dialog, if applicable) --- static/js/errorDialog.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/static/js/errorDialog.js b/static/js/errorDialog.js index 7d854c5e5..f660f2cd7 100644 --- a/static/js/errorDialog.js +++ b/static/js/errorDialog.js @@ -2,7 +2,8 @@ 'use strict'; pandora.ui.errorDialog = function(data) { - var that, error; + + var that, error, showLogsButton; //dont open dialog on unload or if antoher error is open //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 setTimeout(function() { if ($('.OxErrorDialog').length == 0 && !pandora.isUnloading) { + showLogsButton = error == 'error' + && pandora.site.capabilities.canSeeDebugMenu[pandora.user.level] 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({ id: 'close', title: Ox._('Close') @@ -47,7 +62,7 @@ pandora.ui.errorDialog = function(data) { that.close(); } }) - ], + ]), keys: {enter: 'close', escape: 'close'}, text: Ox._('Sorry, a server {0}' + ' occured while handling your request.'