public inbox for [email protected]  
help / color / mirror / Atom feed
PATCH: Select2 control fix [ pgAdmin4 ]
5+ messages / 2 participants
[nested] [flat]

* PATCH: Select2 control fix [ pgAdmin4 ]
@ 2016-01-11 12:18 Murtuza Zabuawala <[email protected]>
  2016-01-11 16:06 ` Re: PATCH: Select2 control fix [ pgAdmin4 ] Ashesh Vashi <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: Murtuza Zabuawala @ 2016-01-11 12:18 UTC (permalink / raw)
  To: pgadmin-hackers

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


Attachments:

  [text/x-patch] Fix_select2_disabled_property.patch (1.1K, 2-Fix_select2_disabled_property.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


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: PATCH: Select2 control fix [ pgAdmin4 ]
  2016-01-11 12:18 PATCH: Select2 control fix [ pgAdmin4 ] Murtuza Zabuawala <[email protected]>
@ 2016-01-11 16:06 ` Ashesh Vashi <[email protected]>
  2016-01-12 05:03   ` Re: PATCH: Select2 control fix [ pgAdmin4 ] Murtuza Zabuawala <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: Ashesh Vashi @ 2016-01-11 16:06 UTC (permalink / raw)
  To: Murtuza Zabuawala <[email protected]>; +Cc: pgadmin-hackers

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*
<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
>
>


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: PATCH: Select2 control fix [ pgAdmin4 ]
  2016-01-11 12:18 PATCH: Select2 control fix [ pgAdmin4 ] Murtuza Zabuawala <[email protected]>
  2016-01-11 16:06 ` Re: PATCH: Select2 control fix [ pgAdmin4 ] Ashesh Vashi <[email protected]>
@ 2016-01-12 05:03   ` Murtuza Zabuawala <[email protected]>
  2016-01-12 05:26     ` Re: PATCH: Select2 control fix [ pgAdmin4 ] Murtuza Zabuawala <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: Murtuza Zabuawala @ 2016-01-12 05:03 UTC (permalink / raw)
  To: Ashesh Vashi <[email protected]>; +Cc: pgadmin-hackers

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] 
> <mailto:[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]
>     <mailto:[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.patch (1.1K, 3-Fix_select2_disabled_property.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


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: PATCH: Select2 control fix [ pgAdmin4 ]
  2016-01-11 12:18 PATCH: Select2 control fix [ pgAdmin4 ] Murtuza Zabuawala <[email protected]>
  2016-01-11 16:06 ` Re: PATCH: Select2 control fix [ pgAdmin4 ] Ashesh Vashi <[email protected]>
  2016-01-12 05:03   ` Re: PATCH: Select2 control fix [ pgAdmin4 ] Murtuza Zabuawala <[email protected]>
@ 2016-01-12 05:26     ` Murtuza Zabuawala <[email protected]>
  2016-01-12 09:00       ` Re: PATCH: Select2 control fix [ pgAdmin4 ] Ashesh Vashi <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: Murtuza Zabuawala @ 2016-01-12 05:26 UTC (permalink / raw)
  To: Ashesh Vashi <[email protected]>; +Cc: pgadmin-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


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: PATCH: Select2 control fix [ pgAdmin4 ]
  2016-01-11 12:18 PATCH: Select2 control fix [ pgAdmin4 ] Murtuza Zabuawala <[email protected]>
  2016-01-11 16:06 ` Re: PATCH: Select2 control fix [ pgAdmin4 ] Ashesh Vashi <[email protected]>
  2016-01-12 05:03   ` Re: PATCH: Select2 control fix [ pgAdmin4 ] Murtuza Zabuawala <[email protected]>
  2016-01-12 05:26     ` Re: PATCH: Select2 control fix [ pgAdmin4 ] Murtuza Zabuawala <[email protected]>
@ 2016-01-12 09:00       ` Ashesh Vashi <[email protected]>
  0 siblings, 0 replies; 5+ messages in thread

From: Ashesh Vashi @ 2016-01-12 09:00 UTC (permalink / raw)
  To: Murtuza Zabuawala <[email protected]>; +Cc: pgadmin-hackers

Hi Murtuza,

I have applied the patch manually, and committed.

--

Thanks & Regards,

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


*http://www.linkedin.com/in/asheshvashi*
<http://www.linkedin.com/in/asheshvashi;

On Tue, Jan 12, 2016 at 10:56 AM, Murtuza Zabuawala <
[email protected]> wrote:

> 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*
> <http://www.linkedin.com/in/asheshvashi;
>
> On Mon, Jan 11, 2016 at 5:48 PM, Murtuza Zabuawala <
> <[email protected]>[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]>
>> [email protected])
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgadmin-hackers
>>
>>
>
>
>


^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2016-01-12 09:00 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-01-11 12:18 PATCH: Select2 control fix [ pgAdmin4 ] Murtuza Zabuawala <[email protected]>
2016-01-11 16:06 ` Ashesh Vashi <[email protected]>
2016-01-12 05:03   ` Murtuza Zabuawala <[email protected]>
2016-01-12 05:26     ` Murtuza Zabuawala <[email protected]>
2016-01-12 09:00       ` Ashesh Vashi <[email protected]>

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