bind the text entered in the category name text field to the badge
This commit is contained in:
parent
19860bd2c5
commit
a500f6b307
|
@ -1,4 +1,4 @@
|
|||
<div class="modal-body">
|
||||
<div class="modal-body">
|
||||
<form>
|
||||
<label>{{i18n category.name}}</label>
|
||||
{{view Discourse.TextField valueBinding="view.category.name" placeholderKey="category.name_placeholder"}}
|
||||
|
@ -12,7 +12,7 @@
|
|||
<a href="#" {{action showCategoryTopic target="view"}}>{{i18n category.change_in_category_topic}}</a>
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{i18n category.no_description}}
|
||||
{{i18n category.no_description}}
|
||||
{{#if view.category.topic_url}}
|
||||
<a {{action showCategoryTopic target="view"}} href="#">{{i18n category.change_in_category_topic}}</a>
|
||||
{{/if}}}
|
||||
|
@ -23,7 +23,7 @@
|
|||
<label>{{i18n category.badge_colors}}</label>
|
||||
|
||||
<div class="category-color-editor">
|
||||
<span class='badge-category' {{bindAttr style="view.colorStyle"}}>{{i18n preview}}</span>
|
||||
<span class='badge-category' {{bindAttr style="view.colorStyle"}}>{{view.categoryName}}</span>
|
||||
|
||||
<div class='input-prepend input-append' style="margin-top: 10px;">
|
||||
<span class='color-title'>{{i18n category.background_color}}:</span>
|
||||
|
@ -42,4 +42,4 @@
|
|||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class='btn btn-primary' {{bindAttr disabled="view.disabled"}} {{action saveCategory target="view"}}>{{view.buttonTitle}}</button>
|
||||
</div>
|
||||
</div>
|
|
@ -29,6 +29,11 @@ Discourse.EditCategoryView = Discourse.ModalBodyView.extend({
|
|||
return Em.String.i18n("category.create");
|
||||
}).property('category.id'),
|
||||
|
||||
categoryName: (function() {
|
||||
var name = this.get('category.name') || "";
|
||||
return name.trim().length > 0 ? name : Em.String.i18n("preview");
|
||||
}).property('category.name'),
|
||||
|
||||
buttonTitle: (function() {
|
||||
if (this.get('saving')) return Em.String.i18n("saving");
|
||||
return this.get('title');
|
||||
|
@ -69,5 +74,3 @@ Discourse.EditCategoryView = Discourse.ModalBodyView.extend({
|
|||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue