Skip to content

Commit

Permalink
Merge branch 'main' into BC-7636-keyborad-hidden-sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
bischofmax authored Jul 26, 2024
2 parents 3b9d1d3 + e11c02b commit a771e69
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 243 deletions.
5 changes: 0 additions & 5 deletions config/default.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -611,11 +611,6 @@
"type": "boolean",
"default": false,
"description": "Enables the media shelf feature"
},
"FEATURE_NEW_LAYOUT_ENABLED": {
"type": "boolean",
"default": false,
"description": "Enables the new layout feature"
}
},
"allOf": [
Expand Down
97 changes: 45 additions & 52 deletions helpers/handlebars/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,67 +384,60 @@ module.exports = (req, res, next) => {
],
});

// system group
const systemLinks = [];

// new sidebar

if (Configuration.get('FEATURE_NEW_LAYOUT_ENABLED')) {
// system group
const systemLinks = [];

if (ALERT_STATUS_URL) {
systemLinks.push({
link: ALERT_STATUS_URL,
name: res.$t('lib.global.link.status'),
testId: 'status',
isExternalLink: true,
});
}

if (SC_THEME !== 'default') {
systemLinks.push({
link: res.locals.theme.documents.specificFiles.accessibilityStatement,
name: res.$t('lib.global.link.accessibilityStatement'),
testId: 'accessibility-statement',
isExternalLink: true,
});
}
if (ALERT_STATUS_URL) {
systemLinks.push({
link: ALERT_STATUS_URL,
name: res.$t('lib.global.link.status'),
testId: 'status',
isExternalLink: true,
});
}

if (SC_THEME !== 'default') {
systemLinks.push({
name: res.$t('lib.help_menu.link.releaseNotes'),
link: '/system/releases',
testId: 'releases',
link: res.locals.theme.documents.specificFiles.accessibilityStatement,
name: res.$t('lib.global.link.accessibilityStatement'),
testId: 'accessibility-statement',
isExternalLink: true,
});
}

if (SC_THEME !== 'n21') {
systemLinks.push({
name: res.$t('lib.global.link.github'),
link: 'https://github.com/hpi-schul-cloud',
testId: 'github',
isExternalLink: true,
});
}
systemLinks.push({
name: res.$t('lib.help_menu.link.releaseNotes'),
link: '/system/releases',
testId: 'releases',
});

if (SC_THEME === 'default') {
systemLinks.push({
link: '/system/security',
name: res.$t('lib.global.link.safety'),
testId: 'security',
});
}
if (SC_THEME !== 'n21') {
systemLinks.push({
name: res.$t('lib.global.link.github'),
link: 'https://github.com/hpi-schul-cloud',
testId: 'github',
isExternalLink: true,
});
}

res.locals.sidebarItems.push(
{
name: res.$t('global.sidebar.link.system'),
icon: 'application-brackets-outline',
testId: 'system',
groupName: 'system',
link: '/system/',
children: systemLinks,
},
);
if (SC_THEME === 'default') {
systemLinks.push({
link: '/system/security',
name: res.$t('lib.global.link.safety'),
testId: 'security',
});
}

// end new sidebar
res.locals.sidebarItems.push(
{
name: res.$t('global.sidebar.link.system'),
icon: 'application-brackets-outline',
testId: 'system',
groupName: 'system',
link: '/system/',
children: systemLinks,
},
);

makeActive(res.locals.sidebarItems, url.parse(req.url).pathname);

Expand Down
2 changes: 0 additions & 2 deletions static/scripts/loggedin.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ function showHideGlobalAnnouncement() {
}
}

// new sidebar
function toggleSidebarItemGroup(groupData) {
const itemGroup = document.querySelector(`.${groupData.groupName}`);
if (itemGroup) {
Expand Down Expand Up @@ -210,7 +209,6 @@ $(document).ready(() => {
});

$(document).ready(function () {
// new sidebar
const groupToggleBtns = document.querySelectorAll('.group-toggle-btn');
if (groupToggleBtns) {
groupToggleBtns.forEach((btn) => {
Expand Down
17 changes: 3 additions & 14 deletions static/styles/lib/loggedin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -392,21 +392,10 @@ header {
display: flex;
flex-direction: column;
transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
padding-left: 255px;

&.new-sidebar {
padding-left: 255px;

@media only screen and (max-width: 1279px) {
padding: 0;
}
}

&.old-sidebar {
padding-left: 240px;

@include media-breakpoint-down(md) {
padding-left: 60px;
}
@media only screen and (max-width: 1279px) {
padding: 0;
}

@include media-breakpoint-down(xs) {
Expand Down
173 changes: 3 additions & 170 deletions views/lib/loggedin.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -45,59 +45,9 @@
<input type="hidden" id="schuljahrtransfer" value="{{currentRole}}"/>
{{/if}}

{{!-- new sidebar --}}
{{#if (getConfig "FEATURE_NEW_LAYOUT_ENABLED")}}
{{#embed "lib/sidebar"}}{{/embed}}
{{else}}
<div class="navtooltips"></div>
<aside class="nav-sidebar hide-inline">
<nav id="sidebar" aria-label="{{$t "global.aria_label.sidebar"}}">
<ul class="sidebar-list">
<li>
<a class="sc-branding" href="/" title="{{$t "global.link.landing"}}" data-testid="{{$t "global.link.landing"}}">
<div class="cloud-logo"></div>
<div class="sc-title"><span>{{theme.short_title}}</span></div>
</a>
</li>
{{#each sidebarItems}}
<li>
{{#ifneq this.name "divider"}}
<a class="{{../class}}" href="{{../link}}" title="{{../name}}" data-testid="{{../testId}}" aria-label="{{../name}} {{#if ../isExternalLink}}{{$t "global.link.openInNewTabWarning"}}{{/if}}" {{#if ../isExternalLink}}target="_blank" {{/if}}>
{{#if ../isExternalIcon}}
{{{../icon}}}
{{else}}
<i class="mdi mdi-{{../icon}}" aria-hidden="true"></i>
{{/if}}
<span class="link-name">{{../name}}</span>
</a>

{{#if ../childActive}}
{{#if ../children}}
<ul class="subitems">
{{#each ../children}}
<li data-testid="{{this.testId}}">
<a class="subitem {{this.class}}" href="{{this.link}}" title="{{this.name}}" aria-label="{{this.name}} {{#if this.isExternalLink}}{{$t "global.link.openInNewTabWarning"}}{{/if}}" {{#if this.isExternalLink}}target="_blank" {{/if}}>
{{#if this.isExternalIcon}}
{{{this.icon}}}
{{else}}
<i class="mdi mdi-{{this.icon}}" aria-hidden="true"></i>
{{/if}}
<span class="link-name">{{this.name}}</span>
</a>
</li>
{{/each}}
</ul>
{{/if}}
{{/if}}
{{/ifneq}}
</li>
{{/each}}
</ul>
</nav>
</aside>
{{/if}}
{{#embed "lib/sidebar"}}{{/embed}}

<section class="content-wrapper {{#if (getConfig "FEATURE_NEW_LAYOUT_ENABLED")}} new-sidebar {{else}} old-sidebar {{/if}}">
<section class="content-wrapper">
<div class="content-min-height">
<section class="demo" id="offlineAlert" style="display:none;">
<div class="alert alert-warning" role="alert">
Expand All @@ -109,119 +59,7 @@

{{> "lib/components/notification"}}

{{#if (getConfig "FEATURE_NEW_LAYOUT_ENABLED")}}
{{#embed "lib/topbar"}}{{/embed}}
{{else}}
<nav id="top-navbar" class="old-topbar navbar hide-inline" aria-label="{{ $t "global.aria_label.topMenu"}}">
<a class="mobile-nav-toggle" aria-label="{{$t "lib.loggedin.aria_label.mobileNavMenu"}}">
<svg class="mdi mdi-menu" width="18" height="12" viewBox="0 0 18 12" fill="none" xmlns="http://www.w3.org/2000/svg" class="mdi mdi-menu">
<path d="M0 0H18V2H0V0ZM0 5H18V7H0V5ZM0 10H18V12H0V10Z" fill="#1B1B1B"/>
</svg>
</a>
<a class="sc-branding" href="/" title="{{$t "global.link.landing"}}" data-testid="{{$t "global.link.landing"}}">
<div class="cloud-logo"></div>
</a>
<ul class="nav navbar-nav float-xs-none dropdowns">
<li class="nav-item alert-button">
<div class="dropdown minimal-button minimal-button-loggedin">
<a class="btn btn-alert-info btn-thin dropdown-toggle" href="" title="{{$t "lib.loggedin.label.thereIsAProblem"}}" aria-label="{{$t "lib.loggedin.label.thereIsAProblem"}}"
data-toggle="dropdown" data-testid="dropdown-toggle">
<i class="mdi mdi-alert" aria-hidden="true"></i>
</a>

<div class="dropdown-menu" data-testid="dropdown-menu">
<div class="content js-alert-content"></div>
</div>
</div>
</li>
<li class="nav-item fullscreen-action">
<div class="dropdown minimal-button">
<a class="btn btn-secondary btn-thin dropdown-toggle btn-fullscreen" href="" title="{{$t "lib.loggedin.label.fullscreen"}}" aria-label="{{$t "lib.loggedin.label.fullscreen"}}" data-toggle="dropdown">
<i class="mdi mdi-arrow-expand" data-testid="fullscreen-mode" aria-hidden="true"></i>
</a>
</div>
</li>
<li class="nav-item qr-code-action">
<div class="dropdown minimal-button">
<a class="btn btn-secondary btn-thin dropdown-toggle btn-create-qr" href="" title="{{$t "lib.loggedin.label.qrCode"}}" aria-label="{{$t "lib.loggedin.label.qrCode"}}" data-toggle="dropdown">
<i class="mdi mdi-qrcode" aria-hidden="true"></i>
</a>
<div class="dropdown-menu print">
<div class="content qr-show"></div>
<div class="qr-hint-text">
{{$t "global.text.qrHintText"}}
</div>
<div class="btn btn-secondary btn-print mb-1 ml-1 mt-0" data-toggle="tooltip" tabindex="0">
<i class="fa fa-print" aria-hidden="true"></i> {{$t "global.button.print" }}
</div>
</div>
</div>
</li>
{{#if false}}
<li class="nav-item notification-dropdown">
<div class="dropdown minimal-button">
<a class="btn btn-secondary btn-thin dropdown-toggle notification-dropdown-toggle {{#if
recentNotifications}}recent{{/if}}" href="" title="{{$t "lib.loggedin.label.notifications"}}" aria-label="{{$t "lib.loggedin.label.notifications"}}" data-toggle="dropdown">
<i class="fa fa-bell" aria-hidden="true"></i> {{#if recentNotifications}}
<span class="tag tag-primary">{{recentNotifications}}</span>{{/if}}
</a>

<div class="dropdown-menu">
<div class="content">
{{#if notifications}}
{{#each notifications}}
<div class="notification-item {{#unless this.read}}unread{{/unless}}"
data-notification-id="{{this.notificationId}}">
<a href="{{this.action}}"><b>{{this.title}}</b></a>
<br>
<span>{{this.body}}</span>
<time class="notification-time">{{timeFromNow this.date}}</time>
</div>
{{/each}}
{{else}}
<div class="notification-item" data-notification-id="0">
<span>{{$t "lib.loggedin.text.noNotificationsAtTheMoment" }}</span>
</div>
{{/if}}
</div>
</div>
</div>
</li>
{{/if}}

{{#embed "lib/help_menu"}}{{/embed}}

{{#if currentSchoolData}}
{{#unless currentSchoolData.isExpertSchool}}
<li class="nav-item school-data hidden-sm-down">{{ currentSchoolData.name }}</li>
{{#if currentSchoolData.logo.dataUrl}}
<img class="nav-item school-logo" src="{{ currentSchoolData.logo.dataUrl }}" alt="{{$t "lib.loggedin.img_alt.logoOfSchool" (dict "name" currentSchoolData.name)}}">
{{/if}}
{{/unless}}
{{/if}}

<li class="nav-item">
<div class="btn-group" data-matomo-mask>
<div class="dropdown btn-avatar">
<a class="btn btn-secondary btn-thin dropdown-toggle" href=""
title='{{ currentUser.displayName }} ({{$t (concat "global.placeholder." currentRole) }})' aria-label='{{$t "lib.loggedin.label.currentUser"}} {{ currentUser.displayName }} {{$t (concat "global.placeholder." currentRole) }}' data-toggle="dropdown">
<div data-testid="initials" class="avatar-circle" >
<span class="initials">{{ currentUser.avatarInitials }}</span>
</div>
</a>
<input type="hidden" name="testUserGroup" id="testUserGroup" value="{{ currentUser.testGroup }}" />
<ul class="dropdown-menu dropdown-menu-right" data-testid="icon-clickable" role="menu">
<li><div class="dropdown-name" data-testid="name-in-the-icon">{{ currentUser.displayName }} ({{$t (concat "global.placeholder." currentRole) }})</div></li>
{{> "user/forms/language" language=@root.userLanguage }}
<li><a class="dropdown-item" data-testid="settings" href="/account/" role="menuitem" aria-label="{{$t 'lib.loggedin.tab_label.settings' }}">{{$t "lib.loggedin.tab_label.settings" }}</a></li>
<li><a class="dropdown-item localstorageclear" data-testid="logout" href= {{#hasConfig "OAUTH2_LOGOUT_URI"}} {{getConfig "OAUTH2_LOGOUT_URI"}} {{else}} "/logout/" {{/hasConfig}} role="menuitem" aria-label="{{$t 'lib.loggedin.tab_label.signOut'}}">{{$t "lib.loggedin.tab_label.signOut"}}</a></li>
</ul>
</div>
</div>
</li>
</ul>
</nav>
{{/if}}
{{#embed "lib/topbar"}}{{/embed}}

{{#hasConfig "GLOBAL_ANNOUNCEMENT_TEXT"}}
{{#hasConfig "GLOBAL_ANNOUNCEMENT_ROLES"}}
Expand Down Expand Up @@ -310,11 +148,6 @@
}}
{{/if}}
</div>
{{#unless (getConfig "FEATURE_NEW_LAYOUT_ENABLED")}}
{{#unless inline}}
{{#embed "lib/footer"}}{{/embed}}
{{/unless}}
{{/unless}}
</section>
{{/content}}
{{/extend}}
Expand Down

0 comments on commit a771e69

Please sign in to comment.