discourse/app/assets/javascripts/select-kit/components/topic-footer-mobile-dropdow...

37 lines
910 B
Plaintext
Raw Normal View History

import { empty } from "@ember/object/computed";
import ComboBoxComponent from "select-kit/components/combo-box";
2017-10-19 15:51:08 -04:00
export default ComboBoxComponent.extend({
pluginApiIdentifiers: ["topic-footer-mobile-dropdown"],
2017-10-19 15:51:08 -04:00
classNames: "topic-footer-mobile-dropdown",
filterable: false,
autoFilterable: false,
allowInitialValueMutation: false,
allowAutoSelectFirst: false,
nameProperty: "label",
isHidden: empty("content"),
2017-10-19 15:51:08 -04:00
computeHeaderContent() {
const content = this._super(...arguments);
content.name = I18n.t("topic.controls");
return content;
2017-10-19 15:51:08 -04:00
},
mutateAttributes() {},
2017-10-19 15:51:08 -04:00
willComputeContent(content) {
content = this._super(content);
2017-10-19 15:51:08 -04:00
// TODO: this is for backward compat reasons, should be removed
// when plugins have been updated for long enough
content.forEach(c => {
if (c.name) {
c.label = c.name;
}
2018-06-15 11:03:24 -04:00
});
2017-10-19 15:51:08 -04:00
return content;
}
});