You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by benkeen <gi...@git.apache.org> on 2014/11/07 22:47:15 UTC

[GitHub] couchdb-fauxton pull request: Create generic Tray component

GitHub user benkeen opened a pull request:

    https://github.com/apache/couchdb-fauxton/pull/141

    Create generic Tray component

    This moves a lot of the logic from the individual trays (Add Database,
    Query Options, API Url) and into a generic Tray component.
    
    *** Note: the trays should function exactly as before. ***
    
    Closes COUCHDB-2401

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/benkeen/couchdb-fauxton 2401-create-generic-tray-component

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/couchdb-fauxton/pull/141.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #141
    
----
commit 129610d69a24c1e1cc0d1bab5901ba5619121131
Author: Benjamin Keen <be...@gmail.com>
Date:   2014-11-07T21:43:58Z

    Create generic Tray component
    
    This moves a lot of the logic from the individual trays (Add Database,
    Query Options, API Url) and into a generic Tray component.
    
    Closes COUCHDB-2401

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Create generic Tray component

Posted by benkeen <gi...@git.apache.org>.
Github user benkeen commented on the pull request:

    https://github.com/apache/couchdb-fauxton/pull/141#issuecomment-62579626
  
    Thanks @robertkowalski, that was a great suggestion. It feels much cleaner now.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Create generic Tray component

Posted by benkeen <gi...@git.apache.org>.
Github user benkeen commented on the pull request:

    https://github.com/apache/couchdb-fauxton/pull/141#issuecomment-62594787
  
    Merged as 25ea5bdf0ee3f73a499d943ddcb92bcc414d0363


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Create generic Tray component

Posted by benkeen <gi...@git.apache.org>.
Github user benkeen closed the pull request at:

    https://github.com/apache/couchdb-fauxton/pull/141


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Create generic Tray component

Posted by benkeen <gi...@git.apache.org>.
Github user benkeen commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/141#discussion_r20158802
  
    --- Diff: app/addons/databases/views.js ---
    @@ -184,32 +184,17 @@ function(app, Components, FauxtonAPI, Databases) {
         }
       });
     
    -  var NewDatabaseView = FauxtonAPI.View.extend({
    +  var NewDatabaseView = Components.Tray.extend({
         template: 'addons/databases/templates/newdatabase',
         events: {
    -      'click #add-new-database': 'toggleTray',
           'click #js-create-database': 'createDatabase',
           'keyup #js-new-database-name': 'processKey'
         },
     
         initialize: function () {
    -      var hideTray = _.bind(this.hideTray, this),
    -        trayVisible = _.bind(this.trayVisible, this);
     
    -      $('body').on('click.add-new-database', function(e) {
    -        var $clickEl = $(e.target);
    -
    -        if (!trayVisible()) { return; }
    -        if ($clickEl.closest('.add-new-database-btn').length) { return; }
    -
    -        if (!$clickEl.closest('.new-database-tray').length) {
    -          hideTray();
    -        }
    -      });
    -    },
    -
    -    cleanup: function() {
    -      $('body').off('click.add-new-database');
    +      // lame, but we need to explicitly call the parent initialize() method
    --- End diff --
    
    Yeah, that may well work, I think you're right. 
    
    Perhaps a more elegant way to do this would be to define a custom `initialize` on the parent, like `trayInit` then call that on `this`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Create generic Tray component

Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/141#discussion_r20141749
  
    --- Diff: app/addons/databases/views.js ---
    @@ -184,32 +184,17 @@ function(app, Components, FauxtonAPI, Databases) {
         }
       });
     
    -  var NewDatabaseView = FauxtonAPI.View.extend({
    +  var NewDatabaseView = Components.Tray.extend({
         template: 'addons/databases/templates/newdatabase',
         events: {
    -      'click #add-new-database': 'toggleTray',
           'click #js-create-database': 'createDatabase',
           'keyup #js-new-database-name': 'processKey'
         },
     
         initialize: function () {
    -      var hideTray = _.bind(this.hideTray, this),
    -        trayVisible = _.bind(this.trayVisible, this);
     
    -      $('body').on('click.add-new-database', function(e) {
    -        var $clickEl = $(e.target);
    -
    -        if (!trayVisible()) { return; }
    -        if ($clickEl.closest('.add-new-database-btn').length) { return; }
    -
    -        if (!$clickEl.closest('.new-database-tray').length) {
    -          hideTray();
    -        }
    -      });
    -    },
    -
    -    cleanup: function() {
    -      $('body').off('click.add-new-database');
    +      // lame, but we need to explicitly call the parent initialize() method
    --- End diff --
    
    also if you remove the initialize function and don't overwrite it?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Create generic Tray component

Posted by benkeen <gi...@git.apache.org>.
Github user benkeen commented on the pull request:

    https://github.com/apache/couchdb-fauxton/pull/141#issuecomment-62588032
  
    Got the thumbs up from @robertkowalski on this, so will merge.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---