lib/assets/javascripts/cartodb/public_common/user_industries/dropdown_view.js
var cdb = require('cartodb.js-v3');
cdb.admin = require('cdb.admin');
var $ = require('jquery-cdb-v3');
/**
* The content of the dropdown menu opened by the industries link in the header, e.g.:
* CartoDB, Industries, Explore, Pricing
* ______/\____
* | |
* | this |
* |____________|
*/
module.exports = cdb.admin.DropdownMenu.extend({
className: 'CDB-Text Dropdown Dropdown--public',
initialize: function() {
this.elder('initialize');
this.template_base = cdb.templates.getTemplate('public_common/user_industries/dropdown_template');
// Necessary to hide dialog on click outside popup, for example.
cdb.god.bind('closeDialogs', this.hide, this);
},
render: function() {
this.$el.html(this.template_base());
// TODO: taken from existing code, how should dropdowns really be added to the DOM?
$('body').append(this.el);
return this;
},
clean: function() {
// Until https://github.com/CartoDB/cartodb.js/issues/238 is resolved:
$(this.options.target).unbind('click', this._handleClick);
this.constructor.__super__.clean.apply(this);
}
});