/** This view handles rendering of a button with an associated drop down @class DropdownButtonView @extends Discourse.View @namespace Discourse @module Discourse **/ Discourse.DropdownButtonView = Discourse.View.extend({ classNameBindings: [':btn-group', 'hidden'], shouldRerender: Discourse.View.renderIfChanged('text', 'longDescription'), didInsertElement: function(e) { // If there's a click handler, call it if (this.clicked) { var dropDownButtonView = this; this.$('ul li').on('click.dropdown-button', function(e) { e.preventDefault(); dropDownButtonView.clicked($(e.currentTarget).data('id')); return false; }); } }, willDestroyElement: function(e) { this.$('ul li').off('click.dropdown-button'); }, render: function(buffer) { buffer.push("
"); buffer.push(desc); buffer.push("
"); } } });