mirror of
https://github.com/flarum/framework.git
synced 2025-02-21 04:31:57 +08:00
Compatibility with core skin changes; allow skin to customize labels
This commit is contained in:
parent
7ab72a5f28
commit
6e470b0c43
4
extensions/tags/js/bootstrap.js
vendored
4
extensions/tags/js/bootstrap.js
vendored
@ -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';
|
||||
}
|
||||
});
|
||||
|
@ -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()),
|
||||
|
@ -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'));
|
||||
}
|
||||
|
@ -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 & {
|
||||
|
Loading…
x
Reference in New Issue
Block a user