Return-Path: X-Original-To: apmail-couchdb-dev-archive@www.apache.org Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A8A3FFD0C for ; Thu, 13 Nov 2014 10:48:35 +0000 (UTC) Received: (qmail 12865 invoked by uid 500); 13 Nov 2014 10:48:35 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 12800 invoked by uid 500); 13 Nov 2014 10:48:35 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 12788 invoked by uid 99); 13 Nov 2014 10:48:35 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Nov 2014 10:48:35 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id BFE6CA13B43; Thu, 13 Nov 2014 10:48:34 +0000 (UTC) From: robertkowalski To: dev@couchdb.apache.org Reply-To: dev@couchdb.apache.org References: In-Reply-To: Subject: [GitHub] couchdb-fauxton pull request: Add Option tray now uses generic com... Content-Type: text/plain Message-Id: <20141113104834.BFE6CA13B43@tyr.zones.apache.org> Date: Thu, 13 Nov 2014 10:48:34 +0000 (UTC) Github user robertkowalski commented on a diff in the pull request: https://github.com/apache/couchdb-fauxton/pull/145#discussion_r20283214 --- 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 -- still not a big fan of calling a custom-built constructor instead of just passing the options to the extend, like in every other backbone application. main reason is that it is a custom-workaround where there is already a solution provided by the framework and every backbone-dev which is coming from another application has to learn that we build our own custom constructors/initialize --- 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. ---