public inbox for [email protected]  
help / color / mirror / Atom feed
From: Murtuza Zabuawala <[email protected]>
To: Ashesh Vashi <[email protected]>
Cc: pgadmin-hackers <[email protected]>
Subject: Re: PATCH: Select2 control fix [ pgAdmin4 ]
Date: Tue, 12 Jan 2016 10:56:49 +0530
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<CAG7mmoz2koPCZ1HtoQdjLoPiV_6ZofPZ65iJ0faMouKj_BVVLA@mail.gmail.com>
	<[email protected]>
List-Unsubscribe:  <mailto:[email protected]?body=unsub%20pgadmin-hackers>

Hi Ashesh,

Can you please try applying given updated patch, I have manually 
converted file line ending to Unix format.


Regards,
Murtuza

On Tuesday 12 January 2016 10:33 AM, Murtuza Zabuawala wrote:
> 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 
>> <[email protected]> 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
>>     ([email protected])
>>     To make changes to your subscription:
>>     http://www.postgresql.org/mailpref/pgadmin-hackers
>>
>>
>



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


Attachments:

  [text/x-patch] Fix_select2_disabled_property_UPDATED.patch (1.1K, 3-Fix_select2_disabled_property_UPDATED.patch)
  download | inline 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
--- 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


view thread (5+ 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], [email protected]
  Subject: Re: PATCH: Select2 control fix [ pgAdmin4 ]
  In-Reply-To: <[email protected]>

* 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