FIX: Updating the category was not updating the UI

This commit is contained in:
Robin Ward
2015-04-16 13:53:30 -04:00
parent b1da9ac875
commit e912b698ac
7 changed files with 60 additions and 21 deletions

View File

@@ -40,18 +40,18 @@ const Topic = RestModel.extend({
return ({ type: 'topic', id: this.get('id') });
}.property('id'),
category: function() {
const categoryId = this.get('category_id');
if (categoryId) {
return Discourse.Category.list().findProperty('id', categoryId);
}
_categoryIdChanged: function() {
this.set('category', Discourse.Category.findById(this.get('category_id')));
}.observes('category_id').on('init'),
_categoryNameChanged: function() {
const categoryName = this.get('categoryName');
let category;
if (categoryName) {
return Discourse.Category.list().findProperty('name', categoryName);
category = Discourse.Category.list().findProperty('name', categoryName);
}
return null;
}.property('category_id', 'categoryName'),
this.set('category', category);
}.observes('categoryName'),
categoryClass: function() {
return 'category-' + this.get('category.fullSlug');
@@ -407,7 +407,6 @@ Topic.reopenClass({
// The title can be cleaned up server side
props.title = result.basic_topic.title;
props.fancy_title = result.basic_topic.fancy_title;
topic.setProperties(props);
});
},

View File

@@ -22,8 +22,8 @@
{{plugin-outlet "edit-topic"}}
{{d-button action="finishedEditingTopic" class="btn-primary btn-small no-text" icon="check"}}
{{d-button action="cancelEditingTopic" class="btn-small no-text" icon="times"}}
{{d-button action="finishedEditingTopic" class="btn-primary btn-small no-text submit-edit" icon="check"}}
{{d-button action="cancelEditingTopic" class="btn-small no-text cancel-edit" icon="times"}}
{{else}}
<h1>
{{#unless is_warning}}
@@ -32,7 +32,7 @@
{{#if details.loaded}}
{{topic-status topic=model}}
<a href='{{unbound url}}' {{action "jumpTop"}}>
<a href='{{unbound url}}' {{action "jumpTop"}} class='fancy-title'>
{{{fancy_title}}}
</a>
{{/if}}