Fix: Multi-Select should close when an operation succeeds. A little refactoring, too.

This commit is contained in:
Robin Ward
2013-05-08 11:46:43 -04:00
parent 2ba08d23cb
commit 0d8c962fdf
6 changed files with 40 additions and 50 deletions
@@ -83,20 +83,20 @@ Discourse.TopicController = Discourse.ObjectController.extend({
if (!modalController) return;
modalController.show(Discourse.MoveSelectedView.create({
topicController: this,
topic: this.get('content'),
selectedPosts: this.get('selectedPosts')
selectedPosts: this.get('selectedPosts'),
}));
},
deleteSelected: function() {
var topicController = this;
return bootbox.confirm(Em.String.i18n("post.delete.confirm", {
count: this.get('selectedCount')
}), function(result) {
return bootbox.confirm(Em.String.i18n("post.delete.confirm", { count: this.get('selectedCount')}), function(result) {
if (result) {
var selectedPosts = topicController.get('selectedPosts');
Discourse.Post.deleteMany(selectedPosts);
topicController.get('content.posts').removeObjects(selectedPosts);
topicController.toggleMultiSelect();
}
});
},