discourse/app/assets/javascripts/discourse/controllers/bulk-notification-level.js.es6

31 lines
883 B
Plaintext
Raw Normal View History

2016-07-06 03:16:32 +08:00
import computed from 'ember-addons/ember-computed-decorators';
import { topicLevels } from 'discourse/lib/notification-levels';
// Support for changing the notification level of various topics
2016-07-06 03:16:32 +08:00
export default Ember.Controller.extend({
needs: ['topic-bulk-actions'],
notificationLevelId: null,
2016-07-06 03:16:32 +08:00
@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`)
};
});
2016-07-06 03:16:32 +08:00
},
disabled: Em.computed.empty("notificationLevelId"),
actions: {
2016-07-06 03:16:32 +08:00
changeNotificationLevel() {
this.get('controllers.topic-bulk-actions').performAndRefresh({
type: 'change_notification_level',
notification_level_id: this.get('notificationLevelId')
});
}
}
});