Revert "ES6: Half a dozen more controllers converted"

This reverts commit bc2d87e5c1b35bd49e62db944d00cf960b16abd9.
This commit is contained in:
Robin Ward
2014-05-05 13:58:40 -04:00
parent b17cd2f251
commit 389c50eb1e
7 changed files with 9 additions and 11 deletions

View File

@ -1,57 +0,0 @@
/**
Modal related to changing the ownership of posts
@class ChangeOwnerController
@extends Discourse.ObjectController
@namespace Discourse
@uses Discourse.ModalFunctionality
@module Discourse
**/
export default Discourse.ObjectController.extend(Discourse.SelectedPostsCount, Discourse.ModalFunctionality, {
needs: ['topic'],
topicController: Em.computed.alias('controllers.topic'),
selectedPosts: Em.computed.alias('topicController.selectedPosts'),
buttonDisabled: function() {
if (this.get('saving')) return true;
return this.blank('new_user');
}.property('saving', 'new_user'),
buttonTitle: function() {
if (this.get('saving')) return I18n.t('saving');
return I18n.t('topic.change_owner.action');
}.property('saving'),
onShow: function() {
this.setProperties({
saving: false,
new_user: ''
});
},
actions: {
changeOwnershipOfPosts: function() {
this.set('saving', true);
var postIds = this.get('selectedPosts').map(function(p) { return p.get('id'); }),
self = this,
saveOpts = {
post_ids: postIds,
username: this.get('new_user')
};
Discourse.Topic.changeOwners(this.get('id'), saveOpts).then(function(result) {
// success
self.send('closeModal');
self.get('topicController').send('toggleMultiSelect');
Em.run.next(function() { Discourse.URL.routeTo(result.url); });
}, function() {
// failure
self.flash(I18n.t('topic.change_owner.error'), 'alert-error');
self.set('saving', false);
});
return false;
}
}
});