2015-02-26 12:52:30 -05:00
|
|
|
import NotificationLevels from 'discourse/lib/notification-levels';
|
|
|
|
|
2014-11-19 14:37:43 -05:00
|
|
|
// Support for changing the notification level of various topics
|
2014-05-04 14:30:17 -04:00
|
|
|
export default Em.Controller.extend({
|
2014-05-27 10:51:03 -04:00
|
|
|
needs: ['topic-bulk-actions'],
|
2014-02-14 17:38:55 -05:00
|
|
|
notificationLevelId: null,
|
|
|
|
|
|
|
|
notificationLevels: function() {
|
|
|
|
var result = [];
|
2015-02-26 12:52:30 -05:00
|
|
|
Object.keys(NotificationLevels).forEach(function(k) {
|
2014-02-14 17:38:55 -05:00
|
|
|
result.push({
|
2015-02-26 12:52:30 -05:00
|
|
|
id: NotificationLevels[k].toString(),
|
2014-02-14 17:38:55 -05:00
|
|
|
name: I18n.t('topic.notifications.' + k.toLowerCase() + ".title"),
|
|
|
|
description: I18n.t('topic.notifications.' + k.toLowerCase() + ".description")
|
|
|
|
});
|
|
|
|
});
|
|
|
|
return result;
|
|
|
|
}.property(),
|
|
|
|
|
|
|
|
disabled: Em.computed.empty("notificationLevelId"),
|
|
|
|
|
|
|
|
actions: {
|
|
|
|
changeNotificationLevel: function() {
|
2014-05-27 10:51:03 -04:00
|
|
|
this.get('controllers.topic-bulk-actions').performAndRefresh({
|
2014-02-14 17:38:55 -05:00
|
|
|
type: 'change_notification_level',
|
|
|
|
notification_level_id: this.get('notificationLevelId')
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|