mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:42:07 +08:00
DEV: Add option to only show icons to header widget (#9935)
This commit is contained in:
parent
3106f85983
commit
b6709f0dda
|
@ -20,7 +20,10 @@ export default Component.extend({
|
|||
this._removeClass();
|
||||
|
||||
let classes = [];
|
||||
if (slug) classes.push(`category-${slug}`);
|
||||
if (slug) {
|
||||
classes.push("category");
|
||||
classes.push(`category-${slug}`);
|
||||
}
|
||||
if (tags) tags.forEach(t => classes.push(`tag-${t}`));
|
||||
if (classes.length > 0) $("body").addClass(classes.join(" "));
|
||||
},
|
||||
|
@ -32,7 +35,7 @@ export default Component.extend({
|
|||
|
||||
_removeClass() {
|
||||
$("body").removeClass((_, css) =>
|
||||
(css.match(/\b(?:category|tag)-\S+/g) || []).join(" ")
|
||||
(css.match(/\b(?:category|tag)-\S+|( category )/g) || []).join(" ")
|
||||
);
|
||||
},
|
||||
|
||||
|
|
|
@ -299,17 +299,20 @@ export default createWidget("header", {
|
|||
|
||||
html(attrs, state) {
|
||||
let contents = () => {
|
||||
const panels = [
|
||||
this.attach("header-buttons", attrs),
|
||||
this.attach("header-icons", {
|
||||
hamburgerVisible: state.hamburgerVisible,
|
||||
userVisible: state.userVisible,
|
||||
searchVisible: state.searchVisible,
|
||||
ringBackdrop: state.ringBackdrop,
|
||||
flagCount: attrs.flagCount,
|
||||
user: this.currentUser
|
||||
})
|
||||
];
|
||||
const headerIcons = this.attach("header-icons", {
|
||||
hamburgerVisible: state.hamburgerVisible,
|
||||
userVisible: state.userVisible,
|
||||
searchVisible: state.searchVisible,
|
||||
ringBackdrop: state.ringBackdrop,
|
||||
flagCount: attrs.flagCount,
|
||||
user: this.currentUser
|
||||
});
|
||||
|
||||
if (attrs.onlyIcons) {
|
||||
return headerIcons;
|
||||
}
|
||||
|
||||
const panels = [this.attach("header-buttons", attrs), headerIcons];
|
||||
|
||||
if (state.searchVisible) {
|
||||
const contextType = this.searchContextType();
|
||||
|
|
Loading…
Reference in New Issue
Block a user