import { iconHTML } from "discourse-common/lib/icon-library"; import { bufferedRender } from "discourse-common/lib/buffered-render"; export default Ember.Component.extend( bufferedRender({ classNameBindings: [":btn-group", "hidden"], rerenderTriggers: ["text", "longDescription"], _bindClick: function() { // If there's a click handler, call it if (this.clicked) { const self = this; this.$().on("click.dropdown-button", "ul li", function(e) { e.preventDefault(); if ($(e.currentTarget).data("id") !== self.get("activeItem")) { self.clicked($(e.currentTarget).data("id")); } self.$(".dropdown-toggle").dropdown("toggle"); return false; }); } }.on("didInsertElement"), _unbindClick: function() { this.$().off("click.dropdown-button", "ul li"); }.on("willDestroyElement"), buildBuffer(buffer) { const title = this.get("title"); if (title) { buffer.push("
"); buffer.push(desc); buffer.push("
"); } } }) );