UX: Support for `none` style of category badge

This commit is contained in:
Robin Ward 2017-08-04 14:12:21 -04:00
parent 4bfb049054
commit 6ecb7cdff4
3 changed files with 15 additions and 6 deletions

View File

@ -43,17 +43,17 @@ export function categoryBadgeHTML(category, opts) {
parentCat = Discourse.Category.findById(get(category, 'parent_category_id')); parentCat = Discourse.Category.findById(get(category, 'parent_category_id'));
} }
const categoryStyle = opts.categoryStyle || Discourse.SiteSettings.category_style;
if (categoryStyle !== "none") {
if (parentCat && parentCat !== category) { if (parentCat && parentCat !== category) {
html += categoryStripe(get(parentCat,'color'), "badge-category-parent-bg"); html += categoryStripe(get(parentCat,'color'), "badge-category-parent-bg");
} }
html += categoryStripe(color, "badge-category-bg"); html += categoryStripe(color, "badge-category-bg");
}
let classNames = "badge-category clear-badge"; let classNames = "badge-category clear-badge";
if (restricted) { classNames += " restricted"; } if (restricted) { classNames += " restricted"; }
const categoryStyle = opts.categoryStyle || Discourse.SiteSettings.category_style;
let style = ""; let style = "";
if (categoryStyle === "box") { if (categoryStyle === "box") {
style = `style="color: #${get(category, 'text_color')};"`; style = `style="color: #${get(category, 'text_color')};"`;

View File

@ -51,6 +51,11 @@
} }
} }
&.none { // no category style
color: $primary;
margin-right: 5px;
}
&.bullet { //bullet category style &.bullet { //bullet category style
display: inline-flex; display: inline-flex;
align-items: baseline; align-items: baseline;
@ -209,6 +214,9 @@
max-width: 100px; max-width: 100px;
} }
} }
&.none {
padding: 5px;
}
&.bullet { &.bullet {
padding: 5px; padding: 5px;
width: 100%; width: 100%;

View File

@ -182,6 +182,7 @@ basic:
- bar - bar
- box - box
- bullet - bullet
- none
enable_mobile_theme: enable_mobile_theme:
client: true client: true
default: true default: true