OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Open the main menu with default width when the last saved width was 0
Aleix Suaucf2010cbeb43
diff --git a/frontend/src/app/components/main-menu/main-menu-toggle.service.ts b/frontend/src/app/components/main-menu/main-menu-toggle.service.tsindex 10b3d5c7821..1e304812cdc 100644--- a/frontend/src/app/components/main-menu/main-menu-toggle.service.ts+++ b/frontend/src/app/components/main-menu/main-menu-toggle.service.ts@@ -36,11 +36,11 @@ import {InjectField} from "core-app/helpers/angular/inject-field.decorator";@Injectable({ providedIn: 'root' })export class MainMenuToggleService {public toggleTitle:string;-private elementWidth:number;+ private elementMinWidth = 11;+ private readonly defaultWidth:number = 230;private readonly localStorageKey:string = 'openProject-mainMenuWidth';private readonly localStorageStateKey:string = 'openProject-mainMenuCollapsed';- private readonly defaultWidth:number = 230;@InjectField() currentProject:CurrentProjectService;@@ -97,7 +97,10 @@ export class MainMenuToggleService {if (this.deviceService.isMobile) { // mobile versionthis.setWidth(window.innerWidth);} else { // desktop version- this.saveWidth(parseInt(window.OpenProject.guardedLocalStorage(this.localStorageKey) as string));+ const savedWidth = parseInt(window.OpenProject.guardedLocalStorage(this.localStorageKey) as string);+ const widthToSave = savedWidth >= this.elementMinWidth ? savedWidth : this.defaultWidth;++ this.saveWidth(widthToSave);}} else { // sidebar is expanded -> close menuthis.closeMenu();@@ -156,11 +159,11 @@ export class MainMenuToggleService {}public get showNavigation():boolean {- return (this.elementWidth > 10);+ return (this.elementWidth >= this.elementMinWidth);}private snapBack():void {- if (this.elementWidth <= 10) {+ if (this.elementWidth < this.elementMinWidth) {this.elementWidth = 0;}}