Revert "Merge pull request #1215 from Elegios/composer_use_category_id"

This reverts commit 763859d439, reversing
changes made to b62caf80fb.
This commit is contained in:
Robin Ward
2013-09-06 18:00:57 -04:00
parent a9f3489237
commit c8ad977c8a
5 changed files with 18 additions and 18 deletions
@@ -328,7 +328,7 @@ Discourse.Composer = Discourse.Model.extend({
}
this.setProperties({
categoryId: opts.categoryId || this.get('topic.category.id'),
categoryName: opts.categoryName || this.get('topic.category.name'),
archetypeId: opts.archetypeId || Discourse.Site.currentProp('default_archetype'),
metaData: opts.metaData ? Em.Object.create(opts.metaData) : null,
reply: opts.reply || this.get("reply") || ""
@@ -398,9 +398,16 @@ Discourse.Composer = Discourse.Model.extend({
var topic = this.get('topic');
topic.setProperties({
title: this.get('title'),
fancy_title: this.get('title'),
category_id: parseInt(this.get('categoryId'), 10)
fancy_title: this.get('title')
});
var category = Discourse.Category.list().findProperty('name', this.get('categoryName'));
if (category) {
topic.setProperties({
categoryName: category.get('name'),
category_id: category.get('id')
});
}
topic.save();
}
@@ -440,7 +447,7 @@ Discourse.Composer = Discourse.Model.extend({
var createdPost = Discourse.Post.create({
raw: this.get('reply'),
title: this.get('title'),
category: this.get('categoryId'),
category: this.get('categoryName'),
topic_id: this.get('topic.id'),
reply_to_post_number: post ? post.get('post_number') : null,
imageSizes: opts.imageSizes,
@@ -537,7 +544,7 @@ Discourse.Composer = Discourse.Model.extend({
reply: this.get('reply'),
action: this.get('action'),
title: this.get('title'),
categoryId: this.get('categoryId'),
categoryName: this.get('categoryName'),
postId: this.get('post.id'),
archetypeId: this.get('archetypeId'),
metaData: this.get('metaData'),
@@ -46,7 +46,7 @@
{{#unless model.creatingPrivateMessage}}
<div class="category-input">
{{categoryChooser valueAttribute="id" value=model.categoryId}}
{{categoryChooser valueAttribute="name" value=model.categoryName}}
{{popupInputTip validation=view.categoryValidation shownAt=view.showCategoryTip}}
</div>
{{#if model.archetype.hasOptions}}