Skip to content

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

Highlight currently active board in the sidebar menu

Henriette Darge25e06f1dec45
diff --git a/frontend/src/app/modules/boards/board/board-partitioned-page/board-list-container.component.ts b/frontend/src/app/modules/boards/board/board-partitioned-page/board-list-container.component.ts
index 1513a7467be..635b440596e 100644
--- a/frontend/src/app/modules/boards/board/board-partitioned-page/board-list-container.component.ts
+++ b/frontend/src/app/modules/boards/board/board-partitioned-page/board-list-container.component.ts
@@ -89,6 +89,7 @@ export class BoardListContainerComponent extends UntilDestroyedMixin implements
const id:string = this.state.params.board_id.toString();
this.board$ = this.BoardCache.observe(id);
+ this.Boards.currentBoard$.next(id);
this.board$
.pipe(
diff --git a/frontend/src/app/modules/boards/board/board.service.ts b/frontend/src/app/modules/boards/board/board.service.ts
index 4b5cabf85b2..dbeadac996d 100644
--- a/frontend/src/app/modules/boards/board/board.service.ts
+++ b/frontend/src/app/modules/boards/board/board.service.ts
@@ -7,9 +7,9 @@ import {Board, BoardType} from "core-app/modules/boards/board/board";
import {BoardDmService} from "core-app/modules/boards/board/board-dm.service";
import {BoardCacheService} from "core-app/modules/boards/board/board-cache.service";
import {GridWidgetResource} from "core-app/modules/hal/resources/grid-widget-resource";
-import {GonService} from "core-app/modules/common/gon/gon.service";
import {I18nService} from "core-app/modules/common/i18n/i18n.service";
import {BoardActionsRegistryService} from "core-app/modules/boards/board/board-actions/board-actions-registry.service";
+import {BehaviorSubject} from "rxjs";
export interface CreateBoardParams {
type:BoardType;
@@ -20,6 +20,8 @@ export interface CreateBoardParams {
@Injectable({ providedIn: 'root' })
export class BoardService {
+ public currentBoard$:BehaviorSubject<string|null> = new BehaviorSubject<string|null>(null);
+
private loadAllPromise:Promise<Board[]>|undefined;
private text = {
@@ -31,7 +33,6 @@ export class BoardService {
constructor(protected boardDm:BoardDmService,
protected PathHelper:PathHelperService,
- protected Gon:GonService,
protected CurrentProject:CurrentProjectService,
protected halResourceService:HalResourceService,
protected boardCache:BoardCacheService,
diff --git a/frontend/src/app/modules/boards/boards-sidebar/boards-menu.component.html b/frontend/src/app/modules/boards/boards-sidebar/boards-menu.component.html
index b83130832e4..26cd2e31d26 100644
--- a/frontend/src/app/modules/boards/boards-sidebar/boards-menu.component.html
+++ b/frontend/src/app/modules/boards/boards-sidebar/boards-menu.component.html
@@ -5,7 +5,8 @@
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">
+ class="main-menu--children-sub-item ellipsis"
+ [ngClass]=" {'selected': selectedBoardId === board.id }">
</a>
</li>
</ul>
diff --git a/frontend/src/app/modules/boards/boards-sidebar/boards-menu.component.ts b/frontend/src/app/modules/boards/boards-sidebar/boards-menu.component.ts
index 3017afa189e..95f72ac9b1a 100644
--- a/frontend/src/app/modules/boards/boards-sidebar/boards-menu.component.ts
+++ b/frontend/src/app/modules/boards/boards-sidebar/boards-menu.component.ts
@@ -7,6 +7,7 @@ import {AngularTrackingHelpers} from "core-components/angular/tracking-functions
import {MainMenuNavigationService} from "core-components/main-menu/main-menu-navigation.service";
import {map} from "rxjs/operators";
import {CurrentProjectService} from "core-components/projects/current-project.service";
+import {UntilDestroyedMixin} from "core-app/helpers/angular/until-destroyed.mixin";
export const boardsMenuSelector = 'boards-menu';
@@ -15,11 +16,13 @@ export const boardsMenuSelector = 'boards-menu';
templateUrl: './boards-menu.component.html'
})
-export class BoardsMenuComponent implements OnInit {
+export class BoardsMenuComponent extends UntilDestroyedMixin implements OnInit {
trackById = AngularTrackingHelpers.compareByAttribute('id');
currentProjectIdentifier = this.currentProject.identifier;
+ selectedBoardId:string;
+
public boards$:Observable<Board[]> = this.boardCache.observeAll().pipe(
map((boards:Board[]) => {
return boards.sort(function (a, b) {
@@ -38,10 +41,11 @@ export class BoardsMenuComponent implements OnInit {
private readonly boardCache:BoardCacheService,
private readonly currentProject:CurrentProjectService,
private readonly mainMenuService:MainMenuNavigationService) {
+ super();
}
ngOnInit() {
- // When activating the work packages submenu,
+ // When activating the boards submenu,
// either initially or through click on the toggle, load the results
this.mainMenuService
.onActivate('board_view')
@@ -49,6 +53,16 @@ export class BoardsMenuComponent implements OnInit {
this.focusBackArrow();
this.boardService.loadAllBoards();
});
+
+ this
+ .boardService
+ .currentBoard$
+ .pipe(
+ this.untilDestroyed()
+ )
+ .subscribe((id:string|null) => {
+ this.selectedBoardId = id ? id : '';
+ });
}
private focusBackArrow() {