From 6e470b0c43570e4daada89c4b76a28ad5865343c Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Thu, 21 May 2015 13:11:09 +0930 Subject: [PATCH] Compatibility with core skin changes; allow skin to customize labels --- extensions/tags/js/bootstrap.js | 4 ++-- extensions/tags/js/src/components/category-hero.js | 2 +- extensions/tags/js/src/helpers/category-label.js | 4 ++-- extensions/tags/less/categories.less | 11 +++++++++-- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/extensions/tags/js/bootstrap.js b/extensions/tags/js/bootstrap.js index 769382d83..785d3fe7a 100644 --- a/extensions/tags/js/bootstrap.js +++ b/extensions/tags/js/bootstrap.js @@ -125,7 +125,7 @@ app.initializers.add('categories', function() { extend(DiscussionHero.prototype, 'view', function(view) { var category = this.props.discussion.category(); if (category) { - view.attrs.style = 'background-color: '+category.color(); + view.attrs.style = 'color: #fff; background-color: '+category.color(); } }); @@ -134,7 +134,7 @@ app.initializers.add('categories', function() { extend(DiscussionHero.prototype, 'items', function(items) { var category = this.props.discussion.category(); if (category) { - items.add('category', categoryLabel(category, {inverted: true}), {before: 'title'}); + items.add('category', categoryLabel(category), {before: 'title'}); items.title.content.wrapperClass = 'block-item'; } }); diff --git a/extensions/tags/js/src/components/category-hero.js b/extensions/tags/js/src/components/category-hero.js index babe90069..3dc0af779 100644 --- a/extensions/tags/js/src/components/category-hero.js +++ b/extensions/tags/js/src/components/category-hero.js @@ -4,7 +4,7 @@ export default class CategoryHero extends Component { view() { var category = this.props.category; - return m('header.hero.category-hero', {style: 'background-color: '+category.color()}, [ + return m('header.hero.category-hero', {style: 'color: #fff; background-color: '+category.color()}, [ m('div.container', [ m('div.container-narrow', [ m('h2', category.title()), diff --git a/extensions/tags/js/src/helpers/category-label.js b/extensions/tags/js/src/helpers/category-label.js index 8b97723b0..dffa257d0 100644 --- a/extensions/tags/js/src/helpers/category-label.js +++ b/extensions/tags/js/src/helpers/category-label.js @@ -3,10 +3,10 @@ export default function categoryLabel(category, attrs) { if (category) { attrs.style = attrs.style || {}; - attrs.style[attrs.inverted ? 'color' : 'backgroundColor'] = category.color(); + attrs.style.backgroundColor = attrs.style.color = category.color(); } else { attrs.className = (attrs.className || '')+' uncategorized'; } - return m('span.category-label', attrs, category ? category.title() : 'Uncategorized'); + return m('span.category-label', attrs, m('span.category-label-text', category ? category.title() : 'Uncategorized')); } diff --git a/extensions/tags/less/categories.less b/extensions/tags/less/categories.less index 9ca4c60d3..f917fec19 100644 --- a/extensions/tags/less/categories.less +++ b/extensions/tags/less/categories.less @@ -3,7 +3,6 @@ font-size: 80%; font-weight: 600; display: inline-block; - color: #fff; padding: 0.1em 0.45em; border-radius: 4px; @@ -12,6 +11,10 @@ color: @fl-body-muted-color; } + & .category-label-text { + color: #fff !important; + } + .discussion-summary & { margin-right: 5px; font-size: 11px; @@ -19,8 +22,12 @@ .discussion-hero & { font-size: 14px; - background: #fff; + background: #fff !important; padding: 2px 6px; + + & .category-label-text { + color: inherit !important; + } } .discussion-moved-post & {