Skip to content

Commit c01e541

Browse files
committed
Feature: Global "client.hide_sidebar_sections" will force-hide specific sidebar sections for all users, regardless of their prefs.
1 parent 269458f commit c01e541

4 files changed

Lines changed: 15 additions & 3 deletions

File tree

docs/config.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,11 @@ This string is displayed as part of the copyright message at the bottom-left cor
603603

604604
This path string points to the logo used in the UI header/sidebar and in emails (default: `images/logotype.png`).
605605

606+
### client.hide_sidebar_sections
607+
<!-- Title: Hide Sidebar Sections -->
608+
609+
This array allows you to globally hide specific sidebar sections for all users, regardless of their preferences.
610+
606611
### client.items_per_page
607612
<!-- Title: List Items Per Page -->
608613

htdocs/js/app.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,9 +512,11 @@ app.extend({
512512

513513
// apply user preferences for sidebar sections
514514
var user_sections = app.user.sidebar || config.ui.sidebar_sections.map( section => section.id );
515+
var hidden_sections = config.hide_sidebar_sections || [];
516+
515517
config.ui.sidebar_sections.forEach( function(section) {
516518
var $sect = $('.sidebar .sbs_' + section.id);
517-
if (user_sections.includes(section.id)) $sect.show();
519+
if (user_sections.includes(section.id) && !hidden_sections.includes(section.id)) $sect.show();
518520
else $sect.removeClass('enabled').hide();
519521
} );
520522

htdocs/js/pages/user/MySettings.class.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,18 @@ Page.MySettings = class MySettings extends Page.Base {
158158
html += '<div class="box_content" style="margin-bottom:30px">';
159159

160160
// sidebar sections
161+
var sidebar_sections = config.ui.sidebar_sections.filter( function(section) {
162+
if (!config.hide_sidebar_sections) return true;
163+
return !config.hide_sidebar_sections.includes(section.id);
164+
} );
161165
html += this.getFormRow({
162166
label: 'Sidebar:',
163167
content: this.getFormMenuMulti({
164168
id: 'fe_ms_sidebar',
165169
title: 'Show sidebar sections',
166170
placeholder: 'Select sidebar sections to show...',
167-
options: config.ui.sidebar_sections,
168-
values: user.sidebar || config.ui.sidebar_sections.map( section => section.id ),
171+
options: sidebar_sections,
172+
values: user.sidebar || sidebar_sections.map( section => section.id ),
169173
onChange: '$P().saveChanges()',
170174
'data-hold': 1,
171175
'data-select-all': 1

sample_conf/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@
268268
"name": "xyOps",
269269
"company": "PixlCore LLC",
270270
"logo_url": "/images/logotype.png",
271+
"hide_sidebar_sections": [],
271272

272273
"items_per_page": 50,
273274
"alt_items_per_page": 25,

0 commit comments

Comments
 (0)