mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 19:34:09 +08:00
Category badge preview uses new sub-category badge styling in create/edit category modal
This commit is contained in:
parent
497a03fc2c
commit
a40896bb55
|
@ -70,6 +70,19 @@ Discourse.EditCategoryController = Discourse.ObjectController.extend(Discourse.M
|
||||||
return "background-color: #" + (this.get('color')) + "; color: #" + (this.get('text_color')) + ";";
|
return "background-color: #" + (this.get('color')) + "; color: #" + (this.get('text_color')) + ";";
|
||||||
}.property('color', 'text_color'),
|
}.property('color', 'text_color'),
|
||||||
|
|
||||||
|
parentStyle: function() {
|
||||||
|
if (this.get('parent_category_id')) {
|
||||||
|
var parent = Discourse.Category.list().findBy('id', parseInt(this.get('parent_category_id'), 10));
|
||||||
|
if (parent) {
|
||||||
|
return 'background-color: #' + parent.get('color') + ';';
|
||||||
|
} else {
|
||||||
|
return 'display: none';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return 'display: none;';
|
||||||
|
}
|
||||||
|
}.property('parent_category_id'),
|
||||||
|
|
||||||
// background colors are available as a pipe-separated string
|
// background colors are available as a pipe-separated string
|
||||||
backgroundColors: function() {
|
backgroundColors: function() {
|
||||||
var categories = Discourse.Category.list();
|
var categories = Discourse.Category.list();
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
<section class='field'>
|
<section class='field'>
|
||||||
<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' {{bind-attr style="colorStyle"}}>{{categoryName}}</span>
|
<span class='badge-category-parent' {{bind-attr style="parentStyle"}}> </span><span class='badge-category' {{bind-attr style="colorStyle"}}>{{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>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user