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.

34 lines
1.1 KiB
JavaScript
Raw Normal View History

import I18n from "I18n";
import { readOnly } from "@ember/object/computed";
import { computed } from "@ember/object";
import DropdownSelectBoxRowComponent from "select-kit/components/dropdown-select-box/dropdown-select-box-row";
import { escapeExpression } from "discourse/lib/utilities";
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
title: readOnly("label"),
2017-10-20 03:51:08 +08:00
icons: computed("title", "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
});