This repository has been archived on 2025-05-04. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
discourse/app/assets/javascripts/discourse/controllers/bulk_notification_level_controller.js
2014-02-21 15:18:45 -05:00

36 lines
1 KiB
JavaScript

/**
Support for changing the notification level of various topics
@class BulkNotificationLevelControler
@extends Ember.Controller
@namespace Discourse
@module Discourse
**/
Discourse.BulkNotificationLevelController = Em.Controller.extend({
needs: ['topicBulkActions'],
notificationLevelId: null,
notificationLevels: function() {
var result = [];
Object.keys(Discourse.Topic.NotificationLevel).forEach(function(k) {
result.push({
id: Discourse.Topic.NotificationLevel[k].toString(),
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() {
this.get('controllers.topicBulkActions').performAndRefresh({
type: 'change_notification_level',
notification_level_id: this.get('notificationLevelId')
});
}
}
});