discourse/app/assets/javascripts/select-box-kit/components/notifications-button/notifications-button-header.js.es6

27 lines
942 B
Plaintext
Raw Normal View History

2017-10-20 03:51:08 +08:00
import DropdownSelectBoxHeaderComponent from "select-box-kit/components/dropdown-select-box/dropdown-select-box-header";
import computed from "ember-addons/ember-computed-decorators";
import { iconHTML } from 'discourse-common/lib/icon-library';
import { buttonDetails } from "discourse/lib/notification-levels";
export default DropdownSelectBoxHeaderComponent.extend({
classNames: "notifications-button-header",
i18nPrefix: Ember.computed.alias("options.i18nPrefix"),
shouldDisplaySelectedName: Ember.computed.alias("options.showFullTitle"),
@computed("_selectedDetails.icon", "_selectedDetails.key")
icon(icon, key) {
2017-11-10 02:57:53 +08:00
return iconHTML(icon, { class: key }).htmlSafe();
2017-10-20 03:51:08 +08:00
},
@computed("_selectedDetails.key", "i18nPrefix")
selectedName(key, prefix) {
return I18n.t(`${prefix}.${key}.title`);
},
@computed("selectedContent.firstObject.value")
2017-11-10 02:57:53 +08:00
_selectedDetails(value) {
return buttonDetails(value);
}
2017-10-20 03:51:08 +08:00
});