FIX: Replace modal with an empty view when closed. Fixes the bug where you'd edit a category, close

and then click edit again.
This commit is contained in:
Robin Ward
2013-06-11 16:40:28 -04:00
parent a53f958c78
commit bddc9dd4b8
12 changed files with 58 additions and 40 deletions
@@ -28,20 +28,20 @@ Discourse.SplitTopicController = Discourse.ObjectController.extend(Discourse.Sel
this.set('saving', true);
var postIds = this.get('selectedPosts').map(function(p) { return p.get('id'); });
var moveSelectedView = this;
var splitTopicController = this;
Discourse.Topic.movePosts(this.get('id'), {
title: this.get('topicName'),
post_ids: postIds
}).then(function(result) {
// Posts moved
$('#discourse-modal').modal('hide');
moveSelectedView.get('topicController').toggleMultiSelect();
splitTopicController.send('closeModal');
splitTopicController.get('topicController').toggleMultiSelect();
Em.run.next(function() { Discourse.URL.routeTo(result.url); });
}, function() {
// Error moving posts
moveSelectedView.flash(Em.String.i18n('topic.split_topic.error'));
moveSelectedView.set('saving', false);
splitTopicController.flash(Em.String.i18n('topic.split_topic.error'));
splitTopicController.set('saving', false);
});
return false;
}