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
Show create button in boards module
Henriette Dargeb2a9da0f6b6c
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 99d7c63bc71..a21a35a6d11 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@@ -13,3 +13,11 @@</li></ul></div>++<button+ *ngIf="(canCreateBoards$ | async)"+ class="spot-button spot-button_outlined"+ (click)="showNewBoardModal()"+>+ {{text.create_new_board}}+</button>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 6aba3cb8f70..e1fb127afea 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@@ -1,4 +1,8 @@-import { Component, OnInit } from '@angular/core';+import {+ Component,+ Injector,+ OnInit,+} from '@angular/core';import { Observable } from 'rxjs';import { BoardService } from 'core-app/features/boards/board/board.service';import { Board } from 'core-app/features/boards/board/board';@@ -8,6 +12,10 @@ import { CurrentProjectService } from 'core-app/core/current-project/current-proimport { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';import { MainMenuNavigationService } from 'core-app/core/main-menu/main-menu-navigation.service';+import { CurrentUserService } from 'core-app/core/current-user/current-user.service';+import { 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';export const boardsMenuSelector = 'boards-menu';@@ -23,7 +31,7 @@ export class BoardsMenuComponent extends UntilDestroyedMixin implements OnInit {selectedBoardId:string;- public boards$:Observable<Board[]> = this+ boards$:Observable<Board[]> = this.apiV3Service.boards.observeAll()@@ -31,14 +39,32 @@ export class BoardsMenuComponent extends UntilDestroyedMixin implements OnInit {map((boards:Board[]) => boards.sort((a, b) => a.name.localeCompare(b.name))),);- constructor(private readonly boardService:BoardService,+ canCreateBoards$ = this+ .currentUserService+ .hasCapabilities$(+ 'boards/create',+ this.currentProject.id || undefined,+ )+ .pipe(this.untilDestroyed());++ text = {+ create_new_board: this.I18n.t('js.boards.create_new'),+ };++ constructor(+ private readonly boardService:BoardService,private readonly apiV3Service:ApiV3Service,private readonly currentProject:CurrentProjectService,- private readonly mainMenuService:MainMenuNavigationService) {+ private readonly mainMenuService:MainMenuNavigationService,+ readonly currentUserService:CurrentUserService,+ readonly I18n:I18nService,+ private readonly opModalService:OpModalService,+ private readonly injector:Injector,+ ) {super();}- ngOnInit() {+ ngOnInit():void {// When activating the boards submenu,// either initially or through click on the toggle, load the resultsthis.mainMenuService@@ -59,7 +85,11 @@ export class BoardsMenuComponent extends UntilDestroyedMixin implements OnInit {});}- private focusBackArrow() {+ showNewBoardModal():void {+ this.opModalService.show(NewBoardModalComponent, this.injector);+ }++ private focusBackArrow():void {const buttonArrowLeft = jQuery('*[data-name="board_view"] .main-menu--arrow-left-to-project');buttonArrowLeft.focus();}diff --git a/modules/boards/config/locales/js-en.yml b/modules/boards/config/locales/js-en.ymlindex c73daac4d9f..20776772978 100644--- a/modules/boards/config/locales/js-en.yml+++ b/modules/boards/config/locales/js-en.yml@@ -2,6 +2,7 @@en:js:boards:+ create_new: 'New board'label_unnamed_board: 'Unnamed board'label_unnamed_list: 'Unnamed list'label_board_type: 'Board type'diff --git a/modules/boards/lib/open_project/boards/engine.rb b/modules/boards/lib/open_project/boards/engine.rbindex e46d7fba2d5..078236e5c99 100644--- a/modules/boards/lib/open_project/boards/engine.rb+++ b/modules/boards/lib/open_project/boards/engine.rb@@ -28,8 +28,14 @@ module OpenProject::Boardssettings: {},name: 'OpenProject Boards' doproject_module :board_view, dependencies: :work_package_tracking, order: 80 do- permission :show_board_views, 'boards/boards': %i[index], dependencies: :view_work_packages- permission :manage_board_views, 'boards/boards': %i[index], dependencies: :manage_public_queries+ permission :show_board_views,+ { 'boards/boards': %i[index] },+ dependencies: :view_work_packages,+ contract_actions: { boards: %i[read] }+ permission :manage_board_views,+ { 'boards/boards': %i[index] },+ dependencies: :manage_public_queries,+ contract_actions: { boards: %i[create update destroy] }endmenu :project_menu,