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/app/controllers/bulk-notification-level.js
Robin Ward eab560fe2a
DEV: import I18n instead of global usage (#9768)
Co-authored-by: Mark VanLandingham <markvanlan@gmail.com>
Co-authored-by: Robin Ward <robin.ward@gmail.com>

Co-authored-by: Mark VanLandingham <markvanlan@gmail.com>
2020-05-13 16:23:41 -04:00

34 lines
994 B
JavaScript

import I18n from "I18n";
import discourseComputed from "discourse-common/utils/decorators";
import { empty } from "@ember/object/computed";
import Controller, { inject as controller } from "@ember/controller";
import { topicLevels } from "discourse/lib/notification-levels";
// Support for changing the notification level of various topics
export default Controller.extend({
topicBulkActions: controller(),
notificationLevelId: null,
@discourseComputed
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
});
}
}
});