mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 19:23:37 +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();
|
this._removeClass();
|
||||||
|
|
||||||
let classes = [];
|
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 (tags) tags.forEach(t => classes.push(`tag-${t}`));
|
||||||
if (classes.length > 0) $("body").addClass(classes.join(" "));
|
if (classes.length > 0) $("body").addClass(classes.join(" "));
|
||||||
},
|
},
|
||||||
|
@ -32,7 +35,7 @@ export default Component.extend({
|
||||||
|
|
||||||
_removeClass() {
|
_removeClass() {
|
||||||
$("body").removeClass((_, css) =>
|
$("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) {
|
html(attrs, state) {
|
||||||
let contents = () => {
|
let contents = () => {
|
||||||
const panels = [
|
const headerIcons = this.attach("header-icons", {
|
||||||
this.attach("header-buttons", attrs),
|
hamburgerVisible: state.hamburgerVisible,
|
||||||
this.attach("header-icons", {
|
userVisible: state.userVisible,
|
||||||
hamburgerVisible: state.hamburgerVisible,
|
searchVisible: state.searchVisible,
|
||||||
userVisible: state.userVisible,
|
ringBackdrop: state.ringBackdrop,
|
||||||
searchVisible: state.searchVisible,
|
flagCount: attrs.flagCount,
|
||||||
ringBackdrop: state.ringBackdrop,
|
user: this.currentUser
|
||||||
flagCount: attrs.flagCount,
|
});
|
||||||
user: this.currentUser
|
|
||||||
})
|
if (attrs.onlyIcons) {
|
||||||
];
|
return headerIcons;
|
||||||
|
}
|
||||||
|
|
||||||
|
const panels = [this.attach("header-buttons", attrs), headerIcons];
|
||||||
|
|
||||||
if (state.searchVisible) {
|
if (state.searchVisible) {
|
||||||
const contextType = this.searchContextType();
|
const contextType = this.searchContextType();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user