discourse/app/assets/javascripts/select-kit/components/topic-footer-mobile-dropdown.js.es6

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-20 03:51:08 +08:00
export default ComboBoxComponent.extend({
pluginApiIdentifiers: ["topic-footer-mobile-dropdown"],
2017-10-20 03:51:08 +08:00
classNames: "topic-footer-mobile-dropdown",
filterable: false,
autoFilterable: false,
allowInitialValueMutation: false,
allowAutoSelectFirst: false,
nameProperty: "label",
isHidden: empty("content"),
2017-10-20 03:51:08 +08:00
computeHeaderContent() {
const content = this._super(...arguments);
content.name = I18n.t("topic.controls");
return content;
2017-10-20 03:51:08 +08:00
},
mutateAttributes() {},
2017-10-20 03:51:08 +08:00
willComputeContent(content) {
content = this._super(content);
2017-10-20 03:51:08 +08: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 23:03:24 +08:00
});
2017-10-20 03:51:08 +08:00
return content;
}
});