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.

32 lines
1.0 KiB
JavaScript
Raw Normal View History

import { computed } from "@ember/object";
import { readOnly } from "@ember/object/computed";
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
export default DropdownSelectBoxRowComponent.extend({
classNames: ["notifications-button-row"],
i18nPrefix: readOnly("selectKit.options.i18nPrefix"),
i18nPostfix: readOnly("selectKit.options.i18nPostfix"),
2017-10-20 03:51:08 +08:00
label: computed("_start", function () {
return escapeExpression(I18n.t(`${this._start}.title`));
}),
2017-10-20 03:51:08 +08:00
icons: computed("item.icon", function () {
return [escapeExpression(this.item.icon)];
}),
2017-10-20 03:51:08 +08:00
description: computed("_start", function () {
if (this.site && this.site.mobileView) {
return null;
}
return escapeExpression(I18n.t(`${this._start}.description`));
}),
2017-10-20 03:51:08 +08:00
_start: computed("i18nPrefix", "i18nPostfix", "rowName", function () {
return `${this.i18nPrefix}.${this.rowName}${this.i18nPostfix}`;
}),
2017-10-20 03:51:08 +08:00
});