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