From d6dbf4c3448c26ef67d199f43693b6c6c20c06c5 Mon Sep 17 00:00:00 2001 From: rolux Date: Mon, 4 Jun 2012 12:57:55 +0200 Subject: [PATCH] add confirmation dialog when resetting UI settings, add '...' in advanced tab of preferences dialog to indicate that dialogs will open --- static/js/pandora/preferencesDialog.js | 11 +++--- static/js/pandora/resetUIDialog.js | 47 ++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 6 deletions(-) create mode 100644 static/js/pandora/resetUIDialog.js diff --git a/static/js/pandora/preferencesDialog.js b/static/js/pandora/preferencesDialog.js index 0ae406bb2..d323e4d41 100644 --- a/static/js/pandora/preferencesDialog.js +++ b/static/js/pandora/preferencesDialog.js @@ -99,21 +99,20 @@ pandora.ui.preferencesDialog = function() { } else { $content.append( Ox.Button({ - title: 'Reset UI Settings', - width: 128 + title: 'Reset UI Settings...', + width: 160 }) .bindEvent({ click: function() { - pandora.UI.reset(); - pandora.$ui.appPanel.reload(); + pandora.$ui.resetUIDialog = pandora.ui.resetUIDialog().open(); } }) .css({position: 'absolute', left: '96px', top: '16px'}) ); $content.append( Ox.Button({ - title: 'Run Script on Load', - width: 128 + title: 'Run Script on Load...', + width: 160 }) .bindEvent({ click: function() { diff --git a/static/js/pandora/resetUIDialog.js b/static/js/pandora/resetUIDialog.js new file mode 100644 index 000000000..2655411d2 --- /dev/null +++ b/static/js/pandora/resetUIDialog.js @@ -0,0 +1,47 @@ +// vim: et:ts=4:sw=4:sts=4:ft=javascript +'use strict'; + +pandora.ui.resetUIDialog = function(data) { + + var that = Ox.Dialog({ + buttons: [ + Ox.Button({ + id: 'cancel', + title: 'Cancel' + }) + .bindEvent({ + click: function() { + that.close(); + } + }), + Ox.Button({ + id: 'reset', + title: 'Reset' + }).bindEvent({ + click: function() { + that.close(); + pandora.UI.reset(); + pandora.$ui.appPanel.reload(); + } + }) + ], + content: Ox.Element() + .append( + $('') + .attr({src: '/static/png/icon.png'}) + .css({position: 'absolute', left: '16px', top: '16px', width: '64px', height: '64px'}) + ) + .append( + $('
') + .css({position: 'absolute', left: '96px', top: '16px', width: '192px'}) + .html('Are you sure you want to reset all UI settings?') + ), + height: 128, + keys: {enter: 'reset', escape: 'cancel'}, + title: 'Reset UI Settings', + width: 304 + }); + + return that; + +}; \ No newline at end of file