Hi Ashesh,

I am not sure what's wrong here as I'm able to apply the given patch with latest pull.

murtuza@debian ~/PROJECT/pgadmin4 $ git pull
Already up-to-date.
murtuza@debian ~/PROJECT/pgadmin4 $ patch -p1 < Fix_select2_disabled_property.patch
patching file web/pgadmin/browser/static/js/node.ui.js
murtuza@debian ~/PROJECT/pgadmin4 $ git diff
diff --git a/web/pgadmin/browser/static/js/node.ui.js b/web/pgadmin/browser/static/js/node.ui.js
index 76839c6..b5fa3e2 100644


And here are my git settings,

murtuza@debian ~/PROJECT/pgadmin4 $ git config -l
core.editor=vim
core.autocrlf=input
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.url=http://git.postgresql.org/git/pgadmin4.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master


Regards,
Murtuza



On Monday 11 January 2016 09:36 PM, Ashesh Vashi wrote:
Hi Murtuza,

I am not able to apply the patch.
Can you please rebase the patch?

(Also -  please set the proper line endings in your git repository.)

--

Thanks & Regards,

Ashesh Vashi
EnterpriseDB INDIA: Enterprise PostgreSQL Company <http://www.enterprisedb.com>


/http://www.linkedin.com/in/asheshvashi/


On Mon, Jan 11, 2016 at 5:48 PM, Murtuza Zabuawala <murtuza.zabuaw...@enterprisedb.com <mailto:murtuza.zabuaw...@enterprisedb.com>> wrote:

    Hi,

    Please find minor patch to fix issue in select2 control.

    Issue: We were not able to apply 'disabled' property from schema
    model on select2 control.


    Regards,
    Murtuza


    --
    Sent via pgadmin-hackers mailing list
    (pgadmin-hackers@postgresql.org
    <mailto:pgadmin-hackers@postgresql.org>)
    To make changes to your subscription:
    http://www.postgresql.org/mailpref/pgadmin-hackers



diff --git a/web/pgadmin/browser/static/js/node.ui.js b/web/pgadmin/browser/static/js/node.ui.js
index 76839c6..b5fa3e2 100644
--- a/web/pgadmin/browser/static/js/node.ui.js
+++ b/web/pgadmin/browser/static/js/node.ui.js
@@ -139,7 +139,21 @@ function($, _, pgAdmin, Backbone, Backform, Alertify, Node) {
       Backform.SelectControl.prototype.render.apply(this, arguments);
 
       var d = this.field.toJSON(),
-          select2_opts = _.defaults({}, d.select2, this.defaults.select2);
+          select2_opts = _.defaults({}, d.select2, this.defaults.select2),
+          evalF = function(f, d, m) {
+            return (_.isFunction(f) ? !!f.apply(d, [m]) : !!f);
+          };
+
+      /*
+       * If select2 options do not have any disabled property on this field
+       * and schema has disabled property then we need to apply it
+       */
+
+      if(!_.has(select2_opts, 'disabled') && (d && d.disabled)) {
+        _.extend(select2_opts, {
+          disabled: evalF(d.disabled, d, this.model)
+        });
+      }
 
       /*
        * Add empty option as Select2 requires any empty '<option><option>' for
-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers

Reply via email to