public inbox for [email protected]  
help / color / mirror / Atom feed
From: Murtuza Zabuawala <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: PATCH: Dialogue control buttons should be consistent (pgAdmin4)
Date: Fri, 6 Jan 2017 19:12:13 +0530
Message-ID: <CAKKotZTSSsps_Zb033pSHg+v_3rvtUunoAZtCWVDnze+uiUv0w@mail.gmail.com> (raw)
List-Unsubscribe:  <mailto:[email protected]?body=unsub%20pgadmin-hackers>

Hi,

PFA patch to fix the issue where  some dialogue control buttons were not
consistent with others dialogs.
RM#1364

Patch fixes,
1) Preferences: Close, Maximise, Pin
- Removed Pin button

2) Wizards: Close
- Added Maximise button, which is can used with 'show_header_maximize_btn'
option.

3) Properties: Close
- N/A, As this is custom wcDocker panel not alertify dialog.

4) User manager: Maximise
- We can't have close button in User Manager as data validation was main
requirement, If user clicks on right top close button while having dirty
data in dialog then we can't stop alertify dialog from closing even with
confirm prompt hence we have removed the button.


--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Attachments:

  [application/octet-stream] RM_1364.patch (6.5K, 3-RM_1364.patch)
  download | inline diff:
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 e6e0f67..59d9682 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 5dd2478..214cab2 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 862cd58..2e65c6b 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'>"
        + "      <div class='wizard-header wizard-badge'>"
        + "        <div class='row'>"
-       + "          <div class='col-sm-9'>"
+       + "          <div class='col-sm-10'>"
        + "              <h3><span id='main-title'><%= this.options.title %></span> -"
        + "              <span id='step-title'><%= page_title %></span></h3>"
        + "          </div>"
        + "          <% if (this.options.show_header_cancel_btn) { %>"
-       + "            <div class='col-sm-3'>"
+       + "            <div class='col-sm-2'>"
        + "              <button class='ajs-close wizard-cancel-event pull-right'></button>"
+       + "              <% if (this.options.show_header_maximize_btn) { %>"
+       + "                <button class='ajs-maximize wizard-maximize-event pull-right'></button>"
+       + "              <% } %>"
        + "            </div>"
        + "          <% } %>"
        + "        </div>"
@@ -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 e02c926..9fc1778 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 de4b7a3..db6cfd0 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("<div class='grant_wizard_container'></div>");
 
                 // 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') }}"
                   },
 


view thread (2+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: PATCH: Dialogue control buttons should be consistent (pgAdmin4)
  In-Reply-To: <CAKKotZTSSsps_Zb033pSHg+v_3rvtUunoAZtCWVDnze+uiUv0w@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox