From 6ecb7cdff46445ed450b9e0b0cca843bd034af28 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Fri, 4 Aug 2017 14:12:21 -0400 Subject: [PATCH] UX: Support for `none` style of category badge --- .../discourse/helpers/category-link.js.es6 | 12 ++++++------ app/assets/stylesheets/common/components/badges.scss | 8 ++++++++ config/site_settings.yml | 1 + 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/discourse/helpers/category-link.js.es6 b/app/assets/javascripts/discourse/helpers/category-link.js.es6 index 41683207ee8..d02254e31c7 100644 --- a/app/assets/javascripts/discourse/helpers/category-link.js.es6 +++ b/app/assets/javascripts/discourse/helpers/category-link.js.es6 @@ -43,17 +43,17 @@ export function categoryBadgeHTML(category, opts) { parentCat = Discourse.Category.findById(get(category, 'parent_category_id')); } - if (parentCat && parentCat !== category) { - html += categoryStripe(get(parentCat,'color'), "badge-category-parent-bg"); + const categoryStyle = opts.categoryStyle || Discourse.SiteSettings.category_style; + if (categoryStyle !== "none") { + if (parentCat && parentCat !== category) { + 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"; if (restricted) { classNames += " restricted"; } - const categoryStyle = opts.categoryStyle || Discourse.SiteSettings.category_style; - let style = ""; if (categoryStyle === "box") { style = `style="color: #${get(category, 'text_color')};"`; diff --git a/app/assets/stylesheets/common/components/badges.scss b/app/assets/stylesheets/common/components/badges.scss index c26997e4d9c..1a42c171a32 100644 --- a/app/assets/stylesheets/common/components/badges.scss +++ b/app/assets/stylesheets/common/components/badges.scss @@ -51,6 +51,11 @@ } } + &.none { // no category style + color: $primary; + margin-right: 5px; + } + &.bullet { //bullet category style display: inline-flex; align-items: baseline; @@ -209,6 +214,9 @@ max-width: 100px; } } + &.none { + padding: 5px; + } &.bullet { padding: 5px; width: 100%; diff --git a/config/site_settings.yml b/config/site_settings.yml index 3f85d1e1aa1..802f5747a0f 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -182,6 +182,7 @@ basic: - bar - box - bullet + - none enable_mobile_theme: client: true default: true