FIX: You shouldn't be able to add a parent to Uncategorized

This commit is contained in:
Robin Ward
2014-07-15 15:19:17 -04:00
parent 6d7531f690
commit c6df00a5cc
6 changed files with 45 additions and 15 deletions
@@ -23,6 +23,8 @@ export default Discourse.ObjectController.extend(Discourse.ModalFunctionality, {
return Discourse.Category.list().filterBy('parent_category_id', this.get('id'));
}.property('model.id'),
canSelectParentCategory: Em.computed.not('isUncategorizedCategory'),
onShow: function() {
this.changeSize();
this.titleChanged();
@@ -4,17 +4,19 @@
{{text-field value=name placeholderKey="category.name_placeholder" maxlength="50"}}
</section>
<section class='field'>
{{#if subCategories}}
<label>{{i18n categories.subcategories}}</label>
{{#each subCategories}}
{{category-badge this}}
{{/each}}
{{else}}
<label>{{i18n category.parent}}</label>
{{category-chooser valueAttribute="id" value=parent_category_id categories=parentCategories rootNone=true}}
{{/if}}
</section>
{{#if canSelectParentCategory}}
<section class='field'>
{{#if subCategories}}
<label>{{i18n categories.subcategories}}</label>
{{#each subCategories}}
{{category-badge this}}
{{/each}}
{{else}}
<label>{{i18n category.parent}}</label>
{{category-chooser valueAttribute="id" value=parent_category_id categories=parentCategories rootNone=true}}
{{/if}}
</section>
{{/if}}
{{#if showDescription}}
<section class='field'>