DEV: Add option to only show icons to header widget (#9935)

This commit is contained in:
Mark VanLandingham 2020-06-01 12:26:59 -05:00 committed by GitHub
parent 3106f85983
commit b6709f0dda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 13 deletions

View File

@ -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(" ")
); );
}, },

View File

@ -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();