discourse/app/assets/javascripts/select-kit/components/multi-select/selected-name.js.es6

29 lines
773 B
Plaintext
Raw Normal View History

import computed from "ember-addons/ember-computed-decorators";
2017-11-09 13:57:53 -05:00
export default Ember.Component.extend({
attributeBindings: [
"tabindex",
"content.name:data-name",
"content.value:data-value",
"guid:data-guid"
],
classNames: ["selected-name", "choice"],
2017-11-09 13:57:53 -05:00
classNameBindings: ["isHighlighted", "isLocked"],
layoutName: "select-kit/templates/components/multi-select/selected-name",
tagName: "span",
2017-11-09 13:57:53 -05:00
tabindex: -1,
@computed("content")
guid(content) { return Ember.guidFor(content); },
2017-11-09 13:57:53 -05:00
isLocked: Ember.computed("content.locked", function() {
return this.getWithDefault("content.locked", false);
}),
click() {
if (this.get("isLocked") === true) { return false; }
this.toggleProperty("isHighlighted");
return false;
}
});