Merge pull request #474 from ZogStriP/bind-category-text-field-to-category-badge

bind the text entered in the category name text field to the badge
This commit is contained in:
Robin Ward 2013-03-16 08:20:10 -07:00
commit e4dfb0a935
2 changed files with 9 additions and 6 deletions

View File

@ -23,7 +23,7 @@
<label>{{i18n category.badge_colors}}</label> <label>{{i18n category.badge_colors}}</label>
<div class="category-color-editor"> <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;"> <div class='input-prepend input-append' style="margin-top: 10px;">
<span class='color-title'>{{i18n category.background_color}}:</span> <span class='color-title'>{{i18n category.background_color}}:</span>

View File

@ -29,6 +29,11 @@ Discourse.EditCategoryView = Discourse.ModalBodyView.extend({
return Em.String.i18n("category.create"); return Em.String.i18n("category.create");
}).property('category.id'), }).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() { buttonTitle: (function() {
if (this.get('saving')) return Em.String.i18n("saving"); if (this.get('saving')) return Em.String.i18n("saving");
return this.get('title'); return this.get('title');
@ -69,5 +74,3 @@ Discourse.EditCategoryView = Discourse.ModalBodyView.extend({
} }
}); });