We shouldn't have to redeclare tab panels in the category edit menu

This commit is contained in:
Robin Ward 2014-06-25 16:34:57 -04:00
parent 386d1e231a
commit 07cb3aff97
4 changed files with 13 additions and 7 deletions

View file

@ -5,6 +5,10 @@ export default Em.Component.extend({
active: Discourse.computed.propertyEqual('selectedTab', 'tab'),
title: Discourse.computed.i18n('tab', 'category.%@'),
_insertInParent: function() {
this.get('parentView.panels').addObject(this.get('tab'));
}.on('didInsertElement'),
actions: {
select: function() {
this.set('selectedTab', this.get('tab'));

View file

@ -8,12 +8,11 @@
</ul>
<div class="modal-body">
{{view 'edit-category-panel' tab="general" className="general-tab"}}
{{#unless isUncategorizedCategory}}
{{view 'edit-category-panel' tab="security" className="options-tab"}}
{{view 'edit-category-panel' tab="settings" className="options-tab"}}
{{/unless}}
{{#each tab in view.panels}}
{{view 'edit-category-panel' tab=tab}}
{{/each}}
</div>
<div class="modal-footer">
<button class='btn btn-primary' {{bind-attr disabled="disabled"}} {{action saveCategory}}>{{buttonTitle}}</button>
{{#if can_delete}}

View file

@ -1,6 +1,5 @@
export default Em.View.extend({
classNameBindings: [':modal-tab', 'invisible'],
invisible: Discourse.computed.propertyNotEqual('controller.selectedTab', 'tab'),
templateName: function() {

View file

@ -1,3 +1,7 @@
export default Discourse.ModalBodyView.extend({
templateName: 'modal/edit-category'
templateName: 'modal/edit-category',
_initializePanels: function() {
this.set('panels', []);
}.on('init')
});