Change category by editing first post updates topic title

This commit is contained in:
Neil Lalonde 2013-08-01 10:56:03 -04:00
parent 4f0713b9da
commit 361f158b27
2 changed files with 4 additions and 2 deletions

View File

@ -392,10 +392,12 @@ Discourse.Composer = Discourse.Model.extend({
// Update the title if we've changed it
if (this.get('title') && post.get('post_number') === 1) {
var topic = this.get('topic');
var category = Discourse.Category.list().findProperty('name', this.get('categoryName'));
topic.setProperties({
title: this.get('title'),
fancy_title: this.get('title'),
categoryName: this.get('categoryName')
categoryName: category.get('name'),
category_id: category.get('id')
});
topic.save();
}

View File

@ -21,7 +21,7 @@
{{topicStatus topic=model}}
<a href='{{unbound url}}'>{{{fancy_title}}}</a>
{{/if}}
{{categoryLink category}}
{{boundCategoryLink category}}
{{#if details.can_edit}}
<a href='#' {{action editTopic}} class='edit-topic' title='{{i18n edit}}'><i class="icon-pencil"></i></a>