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

Replace path with existing path in PathHelperService

Oliver Günther7be0c1fdfec2
diff --git a/frontend/src/app/core/apiv3/virtual/apiv3-boards-paths.ts b/frontend/src/app/core/apiv3/virtual/apiv3-boards-paths.ts
index f71d7adbd94..720a95060a6 100644
--- a/frontend/src/app/core/apiv3/virtual/apiv3-boards-paths.ts
+++ b/frontend/src/app/core/apiv3/virtual/apiv3-boards-paths.ts
@@ -102,7 +102,7 @@ export class ApiV3BoardsPaths extends ApiV3Collection<Board, ApiV3BoardPath> {
* @param projectIdentifier The current project identifier
*/
public boardPath(projectIdentifier:string) {
- return this.PathHelper.projectBoardsPath(projectIdentifier);
+ return this.PathHelper.boardsPath(projectIdentifier);
}
protected createCache():StateCacheService<Board> {
diff --git a/frontend/src/app/core/path-helper/path-helper.service.ts b/frontend/src/app/core/path-helper/path-helper.service.ts
index 44244bc9431..a0f37d67581 100644
--- a/frontend/src/app/core/path-helper/path-helper.service.ts
+++ b/frontend/src/app/core/path-helper/path-helper.service.ts
@@ -172,13 +172,17 @@ export class PathHelperService {
return `${this.projectWorkPackagesPath(projectId)}/new`;
}
- public projectBoardsPath(projectIdentifier:string|null) {
+ public boardsPath(projectIdentifier:string|null) {
if (projectIdentifier) {
return `${this.projectPath(projectIdentifier)}/boards`;
}
return `${this.staticBase}/boards`;
}
+ public newBoardsPath(projectIdentifier:string|null) {
+ return `${this.boardsPath(projectIdentifier)}/new`;
+ }
+
public projectDashboardsPath(projectIdentifier:string) {
return `${this.projectPath(projectIdentifier)}/dashboards`;
}
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.ts
index 47471f47043..3906abcf04f 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
@@ -16,6 +16,7 @@ import { CurrentUserService } from 'core-app/core/current-user/current-user.serv
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { OpModalService } from 'core-app/shared/components/modal/modal.service';
import { IOpSidemenuItem } from 'core-app/shared/components/sidemenu/sidemenu.component';
+import { PathHelperService } from 'core-app/core/path-helper/path-helper.service';
export const boardsMenuSelector = 'boards-menu';
@@ -63,14 +64,13 @@ export class BoardsMenuComponent extends UntilDestroyedMixin implements OnInit {
};
constructor(
- private readonly boardService:BoardService,
- private readonly apiV3Service:ApiV3Service,
- private readonly currentProject:CurrentProjectService,
- private readonly mainMenuService:MainMenuNavigationService,
+ readonly boardService:BoardService,
+ readonly apiV3Service:ApiV3Service,
+ readonly currentProject:CurrentProjectService,
+ readonly mainMenuService:MainMenuNavigationService,
readonly currentUserService:CurrentUserService,
readonly I18n:I18nService,
- private readonly opModalService:OpModalService,
- private readonly injector:Injector,
+ readonly pathHelper:PathHelperService
) {
super();
}
@@ -87,11 +87,7 @@ export class BoardsMenuComponent extends UntilDestroyedMixin implements OnInit {
}
redirectToNewBoardForm():void {
- const newBoardFormPath = (this.currentProject && this.currentProject.identifier)
- ? `${window.appBasePath}/projects/${this.currentProject.identifier}/boards/new`
- : `${window.appBasePath}/boards/new`;
-
- window.location.href = newBoardFormPath;
+ window.location.href = this.pathHelper.newBoardsPath(this.currentProject.identifier);
}
private focusBackArrow():void {