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 [email protected] or file a JIRA ticket
with INFRA.
---