mirror of
https://github.com/discourse/discourse.git
synced 2025-02-04 13:25:15 +08:00
bf91532260
- Remove ArrayController - Remove {{view}} from templates - Replace many cases of needs: [‘controller’] with inject - Enable Ember Legacy Views
31 lines
883 B
JavaScript
31 lines
883 B
JavaScript
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 Ember.Controller.extend({
|
|
topicBulkActions: Ember.inject.controller(),
|
|
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: Em.computed.empty("notificationLevelId"),
|
|
|
|
actions: {
|
|
changeNotificationLevel() {
|
|
this.get('topicBulkActions').performAndRefresh({
|
|
type: 'change_notification_level',
|
|
notification_level_id: this.get('notificationLevelId')
|
|
});
|
|
}
|
|
}
|
|
});
|