Files
discourse/app/assets/javascripts/select-kit/addon/components/multi-select/format-selected-content.js
David Taylor d1cc60c435 DEV: Convert select-kit components to native class syntax (#28489)
Changes made using the ember-native-class-codemod, plus some manual tweaks
2024-08-23 12:17:07 +01:00

25 lines
632 B
JavaScript

import Component from "@ember/component";
import { computed } from "@ember/object";
import { tagName } from "@ember-decorators/component";
import { makeArray } from "discourse-common/lib/helpers";
import UtilsMixin from "select-kit/mixins/utils";
@tagName("")
export default class FormatSelectedContent extends Component.extend(
UtilsMixin
) {
content = null;
selectKit = null;
@computed("content")
get formattedContent() {
if (this.content) {
return makeArray(this.content)
.map((c) => this.getName(c))
.join(", ");
} else {
return this.getName(this.selectKit.noneItem);
}
}
}