From bdf9761472c215b84e49ed82ee481e237e151b7b Mon Sep 17 00:00:00 2001 From: Murtuza Zabuawala Date: Sun, 8 Jan 2017 16:05:34 +0530 Subject: [PATCH] Improve consistency of dialogue controls offered. Fixes #1364 --- .../servers/templates/servers/servers.js | 2 +- web/pgadmin/browser/static/css/wizard.css | 15 +++++++++++ web/pgadmin/browser/static/js/wizard.js | 27 +++++++++++++++++-- .../templates/preferences/preferences.js | 3 ++- .../templates/grant_wizard/js/grant_wizard.js | 4 ++- 5 files changed, 46 insertions(+), 5 deletions(-) diff --git a/web/pgadmin/browser/server_groups/servers/templates/servers/servers.js b/web/pgadmin/browser/server_groups/servers/templates/servers/servers.js index e6e0f678d..59d9682f6 100644 --- a/web/pgadmin/browser/server_groups/servers/templates/servers/servers.js +++ b/web/pgadmin/browser/server_groups/servers/templates/servers/servers.js @@ -419,7 +419,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { options: { padding : !1, overflow: !1, - model: 0, + modal:false, resizable: true, maximizable: true, pinnable: false, diff --git a/web/pgadmin/browser/static/css/wizard.css b/web/pgadmin/browser/static/css/wizard.css index 5dd247877..214cab29a 100644 --- a/web/pgadmin/browser/static/css/wizard.css +++ b/web/pgadmin/browser/static/css/wizard.css @@ -117,6 +117,21 @@ margin-top: -1px; } + +div.wizard-header.wizard-badge > div > div.col-sm-2 > button.ajs-maximize.wizard-maximize-event.pull-right { + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAZklEQVQ4jcWTuw2AMAxEn5jBs7B/e0gpmAiKEGRS5QDBSS7v+Q8fSsCWQgDTA+DsGgJYuypumTNkWCWZg9q/HIAOSDim/xTUcu0exXXaxQG0teRVWQPLx2Gbe8B55yNqv7C4GV/TDq//J11odoZgAAAAAElFTkSuQmCC) no-repeat center center; + padding: 10px; + margin-top: -1px; + margin-right: 8px; +} + +div.wizard-header.wizard-badge > div > div.col-sm-2 > button.ajs-maximized.ajs-maximize.wizard-maximize-event.pull-right { + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA8klEQVQ4jZ3QMUpDQRCH8V+ewULQE4iERTyCrQiDCpbaCKKljbV4A89gqVgGrCMDWlpaWwVPoFYiIjYv8hBJXjLN7s7u9+3wZ4aKiOWI2IJOi8dHuM7MXxj3WMHe3CRBKeUGvVJKllJG8CrmoNty6jMsYKeGoY/jtgI4bez7OMjMr2oKwaieRzDMIljDRUSgXQZPeG2cv7GOffQ7ETGPcyw2HozWQWY+jLN3M/MzIu4wwNKf+zeMFVSQmY/YbfzeuiqIiAonZgi1quErHNa9F7xPM8FlAx5iA9ttJRVu8VHDm5k5rDNpLRERWxHR+6c/MZMfLIJDwzY66IkAAAAASUVORK5CYII=) no-repeat center center; + padding: 10px; + margin-top: -1px; + margin-right: 8px; +} + /* Wizard Status bar CSS */ .pgadmin-wizard .wizard-description { padding: 1.0em 0.1em; diff --git a/web/pgadmin/browser/static/js/wizard.js b/web/pgadmin/browser/static/js/wizard.js index 862cd58e0..2e65c6bf4 100644 --- a/web/pgadmin/browser/static/js/wizard.js +++ b/web/pgadmin/browser/static/js/wizard.js @@ -43,6 +43,8 @@ function(_, Backbone, pgAdmin, pgBrowser) { disable_finish: false, disable_cancel: false, show_header_cancel_btn: false, /* show cancel button at wizard header */ + show_header_maximize_btn: false, /* show maximize button at wizard header */ + dialog_api: null, height: 400, width: 650, show_left_panel: true, @@ -53,13 +55,16 @@ function(_, Backbone, pgAdmin, pgBrowser) { + " width: <%= this.options.width %>px'>" + "
" + "
" - + "
" + + "
" + "

<%= this.options.title %> -" + " <%= page_title %>

" + "
" + " <% if (this.options.show_header_cancel_btn) { %>" - + "
" + + "
" + " " + + " <% if (this.options.show_header_maximize_btn) { %>" + + " " + + " <% } %>" + "
" + " <% } %>" + "
" @@ -112,6 +117,7 @@ function(_, Backbone, pgAdmin, pgBrowser) { "click button.wizard-back" : "prevPage", "click button.wizard-cancel" : "onCancel", "click button.wizard-cancel-event" : "onCancel", + "click button.wizard-maximize-event" : "onMaximize", "click button.wizard-finish" : "finishWizard", "click button.wizard-help" : "onDialogHelp", }, @@ -233,6 +239,23 @@ function(_, Backbone, pgAdmin, pgBrowser) { this.$el.remove(); return true; }, + onMaximize: function() { + var dialog_api = this.options.dialog_api, + old_classes, _el = this.$el.find('.wizard-maximize-event'); + + // If no dialog api found then return + if(!dialog_api) return; + + if(dialog_api.isMaximized()) { + // toggle the icon + _el.removeClass('ajs-maximized'); + dialog_api.restore(); + } else { + // toggle the icon + _el.addClass('ajs-maximized ' + _el.attr('class')); + dialog_api.maximize(); + } + }, evalASFunc: function(func, ctx) { var self = this; ctx = ctx || self.currPage; diff --git a/web/pgadmin/preferences/templates/preferences/preferences.js b/web/pgadmin/preferences/templates/preferences/preferences.js index e02c92628..9fc17787b 100644 --- a/web/pgadmin/preferences/templates/preferences/preferences.js +++ b/web/pgadmin/preferences/templates/preferences/preferences.js @@ -365,7 +365,8 @@ define( overflow: !1, title: '{{ _('Preferences')|safe }}', closableByDimmer: false, - modal:false + modal:false, + pinnable: false } }; }, diff --git a/web/pgadmin/tools/grant_wizard/templates/grant_wizard/js/grant_wizard.js b/web/pgadmin/tools/grant_wizard/templates/grant_wizard/js/grant_wizard.js index de4b7a38f..db6cfd0f5 100644 --- a/web/pgadmin/tools/grant_wizard/templates/grant_wizard/js/grant_wizard.js +++ b/web/pgadmin/tools/grant_wizard/templates/grant_wizard/js/grant_wizard.js @@ -429,7 +429,7 @@ define([ }, prepare:function() { - + var that = this; $container.empty().append("
"); // Define el for wizard view @@ -1062,7 +1062,9 @@ define([ curr_page: 0, show_left_panel: false, show_header_cancel_btn: true, + show_header_maximize_btn: true, disable_finish: true, + dialog_api: that, wizard_help: "{{ url_for('help.static', filename='grant_wizard.html') }}" },