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
Replace custom sidemenu with opSideMenuComponent for Boards
Henriette Darge12dda66f2fd4
diff --git a/frontend/src/app/features/boards/boards-sidebar/boards-menu.component.html b/frontend/src/app/features/boards/boards-sidebar/boards-menu.component.htmlindex a21a35a6d11..45f7637767a 100644--- a/frontend/src/app/features/boards/boards-sidebar/boards-menu.component.html+++ b/frontend/src/app/features/boards/boards-sidebar/boards-menu.component.html@@ -1,18 +1,8 @@-<div *ngIf="(boards$ | async) as boards">- <ul class="main-menu--children boards--menu-items">- <li *ngFor="let board of boards;trackBy:trackById">- <a [textContent]="board.name"- uiSref="boards.partitioned.show"- [uiOptions]="{ reload: true }"- [uiParams]="{ board_id: board.id, query_props: '', projects: 'projects', projectPath: currentProjectIdentifier }"- class="main-menu--children-sub-item ellipsis"- [ngClass]=" {'selected': selectedBoardId === board.id }"- data-qa-selector="boards-menu--item"- >- </a>- </li>- </ul>-</div>+<op-sidemenu+ *ngIf="(boardOptions$ | async) as items"+ [items]="items"+>+</op-sidemenu><button*ngIf="(canCreateBoards$ | async)"diff --git a/frontend/src/app/features/boards/boards-sidebar/boards-menu.component.ts b/frontend/src/app/features/boards/boards-sidebar/boards-menu.component.tsindex e1fb127afea..4f8c83a0626 100644--- a/frontend/src/app/features/boards/boards-sidebar/boards-menu.component.ts+++ b/frontend/src/app/features/boards/boards-sidebar/boards-menu.component.ts@@ -6,8 +6,10 @@ import {import { Observable } from 'rxjs';import { BoardService } from 'core-app/features/boards/board/board.service';import { Board } from 'core-app/features/boards/board/board';-import { compareByAttribute } from 'core-app/shared/helpers/angular/tracking-functions';-import { map } from 'rxjs/operators';+import {+ map,+ skip,+} from 'rxjs/operators';import { CurrentProjectService } from 'core-app/core/current-project/current-project.service';import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';@@ -16,6 +18,7 @@ import { CurrentUserService } from 'core-app/core/current-user/current-user.servimport { I18nService } from 'core-app/core/i18n/i18n.service';import { NewBoardModalComponent } from 'core-app/features/boards/new-board-modal/new-board-modal.component';import { OpModalService } from 'core-app/shared/components/modal/modal.service';+import { IOpSidemenuItem } from 'core-app/shared/components/sidemenu/sidemenu.component';export const boardsMenuSelector = 'boards-menu';@@ -25,18 +28,29 @@ export const boardsMenuSelector = 'boards-menu';})export class BoardsMenuComponent extends UntilDestroyedMixin implements OnInit {- trackById = compareByAttribute('id');-- currentProjectIdentifier = this.currentProject.identifier;-selectedBoardId:string;- boards$:Observable<Board[]> = this+ boardOptions$:Observable<IOpSidemenuItem[]> = this.apiV3Service.boards.observeAll().pipe(- map((boards:Board[]) => boards.sort((a, b) => a.name.localeCompare(b.name))),+ skip(1),+ map((boards:Board[]) => {+ const menuItems:IOpSidemenuItem[] = boards.map((board) => ({+ title: board.name,+ uiSref: 'boards.partitioned.show',+ uiParams: {+ board_id: board.id,+ query_props: '',+ projects: 'projects',+ projectPath: this.currentProject.identifier,+ },+ uiOptions: { reload: true },+ }));++ return menuItems.sort((a, b) => a.title.localeCompare(b.title));+ }),);canCreateBoards$ = this@@ -44,7 +58,7 @@ export class BoardsMenuComponent extends UntilDestroyedMixin implements OnInit {.hasCapabilities$('boards/create',this.currentProject.id || undefined,- )+ ).pipe(this.untilDestroyed());text = {@@ -73,16 +87,6 @@ export class BoardsMenuComponent extends UntilDestroyedMixin implements OnInit {this.focusBackArrow();this.boardService.loadAllBoards();});-- this- .boardService- .currentBoard$- .pipe(- this.untilDestroyed(),- )- .subscribe((id:string|null) => {- this.selectedBoardId = id || '';- });}showNewBoardModal():void {