FIX: Topic drafts weren't showing up properly.

This commit is contained in:
Robin Ward 2014-02-04 12:10:52 -05:00
parent dc77e7e27c
commit 359f03ca73
3 changed files with 14 additions and 4 deletions

View File

@ -333,14 +333,14 @@ Discourse.ComposerController = Discourse.Controller.extend({
cancelComposer: function() {
var self = this;
return Ember.Deferred.promise(function (promise) {
return new Ember.RSVP.Promise(function (resolve) {
if (self.get('model.hasMetaData') || self.get('model.replyDirty')) {
bootbox.confirm(I18n.t("post.abandon"), I18n.t("no_value"), I18n.t("yes_value"), function(result) {
if (result) {
self.destroyDraft();
self.get('model').clearState();
self.close();
promise.resolve();
resolve();
}
});
} else {
@ -348,7 +348,7 @@ Discourse.ComposerController = Discourse.Controller.extend({
self.destroyDraft();
self.get('model').clearState();
self.close();
promise.resolve();
resolve();
}
});
},

View File

@ -31,7 +31,6 @@ Discourse.DiscoveryRoute = Discourse.Route.extend({
this.controllerFor('composer').open({
categoryId: topicsController.get('category.id'),
action: Discourse.Composer.CREATE_TOPIC,
draft: topicsController.get('draft'),
draftKey: topicsController.get('draft_key'),
draftSequence: topicsController.get('draft_sequence')
});

View File

@ -28,6 +28,17 @@ function buildTopicRoute(filter) {
Discourse.set('title', I18n.t('filters.with_topics', {filter: filterText}));
this.controllerFor('discoveryTopics').setProperties({ model: model, category: null, period: period });
// If there's a draft, open the create topic composer
if (model.draft) {
this.controllerFor('composer').open({
action: Discourse.Composer.CREATE_TOPIC,
draft: model.draft,
draftKey: model.draft_key,
draftSequence: model.draft_sequence
});
}
this.controllerFor('navigationDefault').set('canCreateTopic', model.get('can_create_topic'));
},