discourse/app/assets/javascripts/select-kit/addon/components/notifications-button/notifications-button-row.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

33 lines
1.0 KiB
JavaScript
Raw Normal View History

import { computed } from "@ember/object";
import { readOnly } from "@ember/object/computed";
import { classNames } from "@ember-decorators/component";
import { escapeExpression } from "discourse/lib/utilities";
import { i18n } from "discourse-i18n";
import DropdownSelectBoxRowComponent from "select-kit/components/dropdown-select-box/dropdown-select-box-row";
2017-10-20 03:51:08 +08:00
@classNames("notifications-button-row")
export default class NotificationsButtonRow extends DropdownSelectBoxRowComponent {
@readOnly("selectKit.options.i18nPrefix") i18nPrefix;
@readOnly("selectKit.options.i18nPostfix") i18nPostfix;
2017-10-20 03:51:08 +08:00
@computed("_start")
get label() {
return escapeExpression(i18n(`${this._start}.title`));
}
2017-10-20 03:51:08 +08:00
@computed("item.icon")
get icons() {
return [escapeExpression(this.item.icon)];
}
2017-10-20 03:51:08 +08:00
@computed("_start")
get description() {
return escapeExpression(i18n(`${this._start}.description`));
}
2017-10-20 03:51:08 +08:00
@computed("i18nPrefix", "i18nPostfix", "rowName")
get _start() {
return `${this.i18nPrefix}.${this.rowName}${this.i18nPostfix}`;
}
}