This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/controllers/bulk-notification-level.js.es6
Mark VanLandingham 2ae21e9c35
DEV: Import every instance of Ember.computed function (#8267)
* DEV: Import every instance of Ember.computed function

* export default for Ember.computed
2019-10-30 15:28:29 -05:00

34 lines
970 B
JavaScript

import { empty } from "@ember/object/computed";
import { inject } from "@ember/controller";
import Controller from "@ember/controller";
import computed from "ember-addons/ember-computed-decorators";
import { topicLevels } from "discourse/lib/notification-levels";
// Support for changing the notification level of various topics
export default Controller.extend({
topicBulkActions: inject(),
notificationLevelId: null,
@computed
notificationLevels() {
return topicLevels.map(level => {
return {
id: level.id.toString(),
name: I18n.t(`topic.notifications.${level.key}.title`),
description: I18n.t(`topic.notifications.${level.key}.description`)
};
});
},
disabled: empty("notificationLevelId"),
actions: {
changeNotificationLevel() {
this.topicBulkActions.performAndRefresh({
type: "change_notification_level",
notification_level_id: this.notificationLevelId
});
}
}
});