discourse/app/assets/javascripts/select-kit/addon/components/multi-select/format-selected-content.gjs
Jarek Radosz ce6368ca98
DEV: Enable ember/no-classic-components (#33978)
…and apply lint-to-the-future
2025-07-30 14:54:24 +02:00

30 lines
803 B
Text
Vendored

/* eslint-disable ember/no-classic-components */
import Component from "@ember/component";
import { computed } from "@ember/object";
import { tagName } from "@ember-decorators/component";
import { makeArray } from "discourse/lib/helpers";
import selectKitPropUtils from "select-kit/lib/select-kit-prop-utils";
@tagName("")
@selectKitPropUtils
export default class FormatSelectedContent extends Component {
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);
}
}
<template>
<span class="formatted-selection">
{{this.formattedContent}}
</span>
</template>
}