couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From benkeen <...@git.apache.org>
Subject [GitHub] couchdb-fauxton pull request: Add Option tray now uses generic com...
Date Mon, 17 Nov 2014 18:03:39 GMT
Github user benkeen commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/145#discussion_r20452262
  
    --- Diff: app/addons/config/views.js ---
    @@ -149,31 +149,15 @@ function(app, FauxtonAPI, Config, Components) {
       });
     
     
    -  Views.AddConfigOptionsButton = FauxtonAPI.View.extend({
    +  Views.AddConfigOptionsButton = Components.Tray.extend({
         template: 'addons/config/templates/add_config_option',
     
         events: {
    -      'click #add-new-section': 'toggleTray',
           'click #js-create-config-section': 'createConfigOption'
         },
     
         initialize: function () {
    -      var hideTray = _.bind(this.hideTray, this),
    -        trayVisible = _.bind(this.trayVisible, this);
    -
    -      $('body').on('click.add-new-section', function(e) {
    -        var $clickEl = $(e.target);
    -
    -        if (!trayVisible()) { return; }
    -        if ($clickEl.closest('.add-new-section').length) { return; }
    -        if (!$clickEl.closest('.add-section-tray').length) {
    -          hideTray();
    -        }
    -      });
    -    },
    -
    -    cleanup: function () {
    -      $('body').off('click.add-new-section');
    +      this.initTray({ toggleTrayBtnSelector: '#add-new-section' });
    --- End diff --
    
    Hey @garrensmith, thanks! That looks promising, but I don't quite follow... When you say
passing that value on standard construction, do you mean whatever code is instantiating the
Tray instance (e.g. `Views.AddConfigOptionsButton`)? Since the selector is particular to that
particular View, I wouldn't want whatever code is instantiating it to have to know about it
to pass it along with the Views.AddConfigOptionsButton instantiation, you know? 
    
    I'll cc @robertkowalski on this because we were chatting about it too. :)


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

Mime
View raw message