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
Add subtasks action with header
Oliver Güntherfbff9d93b4e9
diff --git a/config/locales/js-en.yml b/config/locales/js-en.ymlindex 79d19964979..1c01f1134a8 100644--- a/config/locales/js-en.yml+++ b/config/locales/js-en.yml@@ -447,6 +447,7 @@ en:label_value_derived_from_children: "(value derived from children)"label_warning: "Warning"label_work_package: "Work package"+ label_work_package_parent: "Parent work package"label_work_package_plural: "Work packages"label_watch: "Watch"label_watch_work_package: "Watch work package"diff --git a/frontend/src/app/modules/boards/board/board-actions/subtasks/board-subtasks-action.service.ts b/frontend/src/app/modules/boards/board/board-actions/subtasks/board-subtasks-action.service.tsindex caecd455393..ed543fac42e 100644--- a/frontend/src/app/modules/boards/board/board-actions/subtasks/board-subtasks-action.service.ts+++ b/frontend/src/app/modules/boards/board/board-actions/subtasks/board-subtasks-action.service.ts@@ -7,6 +7,7 @@ import {HalResource} from "core-app/modules/hal/resources/hal-resource";import {Observable} from "rxjs";import {map} from "rxjs/operators";import {ApiV3FilterBuilder, buildApiV3Filter, FalseValue} from "core-components/api/api-v3/api-v3-filter-builder";+import {SubtasksBoardHeaderComponent} from "core-app/modules/boards/board/board-actions/subtasks/subtasks-board-header.component";@Injectable()export class BoardSubtasksActionService extends BoardActionService {@@ -16,6 +17,10 @@ export class BoardSubtasksActionService extends BoardActionService {return this.I18n.t('js.boards.board_type.action_type.subtasks');}+ public headerComponent() {+ return SubtasksBoardHeaderComponent;+ }+public canMove(workPackage:WorkPackageResource):boolean {return !!workPackage.changeParent;}@@ -23,6 +28,7 @@ export class BoardSubtasksActionService extends BoardActionService {protected loadValues(matching?:string):Observable<HalResource[]> {let filters = new ApiV3FilterBuilder();filters.add('is_milestone', '=', false);+ filters.add('project', '=', [this.currentProject.id]);if (matching) {filters.add('subjectOrId', '**', [matching]);diff --git a/frontend/src/app/modules/boards/board/board-actions/subtasks/subtasks-board-header.component.ts b/frontend/src/app/modules/boards/board/board-actions/subtasks/subtasks-board-header.component.tsnew file mode 100644index 00000000000..b951ae48bac--- /dev/null+++ b/frontend/src/app/modules/boards/board/board-actions/subtasks/subtasks-board-header.component.ts@@ -0,0 +1,57 @@+//-- copyright+// OpenProject is an open source project management software.+// Copyright (C) 2012-2020 the OpenProject GmbH+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License version 3.+//+// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+// Copyright (C) 2006-2013 Jean-Philippe Lang+// Copyright (C) 2010-2013 the ChiliProject Team+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License+// as published by the Free Software Foundation; either version 2+// of the License, or (at your option) any later version.+//+// This program is distributed in the hope that it will be useful,+// but WITHOUT ANY WARRANTY; without even the implied warranty of+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+// GNU General Public License for more details.+//+// You should have received a copy of the GNU General Public License+// along with this program; if not, write to the Free Software+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+//+// See docs/COPYRIGHT.rdoc for more details.+//+++import {Component, Input, OnInit} from "@angular/core";+import {HalResource} from "core-app/modules/hal/resources/hal-resource";+import {PathHelperService} from "core-app/modules/common/path-helper/path-helper.service";+import {I18nService} from "core-app/modules/common/i18n/i18n.service";+import {WorkPackageResource} from "core-app/modules/hal/resources/work-package-resource";+import {Highlighting} from "core-components/wp-fast-table/builders/highlighting/highlighting.functions";+++@Component({+ templateUrl: './subtasks-board-header.html',+ styleUrls: ['./subtasks-board-header.sass'],+ host: { 'class': 'title-container -small' }+})+export class SubtasksBoardHeaderComponent implements OnInit {+ @Input() public resource:WorkPackageResource;++ text = {+ workPackage: this.I18n.t('js.label_work_package_parent')+ };++ typeHighlightingClass:string;++ constructor(readonly pathHelper:PathHelperService,+ readonly I18n:I18nService) {+ }++ ngOnInit() {+ this.typeHighlightingClass = Highlighting.inlineClass('type', this.resource.type.id!);+ }+}diff --git a/frontend/src/app/modules/boards/board/board-actions/subtasks/subtasks-board-header.html b/frontend/src/app/modules/boards/board/board-actions/subtasks/subtasks-board-header.htmlnew file mode 100644index 00000000000..47aa1824407--- /dev/null+++ b/frontend/src/app/modules/boards/board/board-actions/subtasks/subtasks-board-header.html@@ -0,0 +1,14 @@+<div class="subtask-board-header" *ngIf="resource">+ <h2 class="editable-toolbar-title--fixed">+ <small [textContent]="text.workPackage"></small>+ <br/>+ <span class="work-package-type"+ [ngClass]="typeHighlightingClass"+ [textContent]="resource.type.name">+ </span>+ <a [href]="pathHelper.workPackagePath(resource.idFromLink)"+ [textContent]="resource.subjectWithId()"+ target="_blank">+ </a>+ </h2>+</div>diff --git a/frontend/src/app/modules/boards/board/board-actions/subtasks/subtasks-board-header.sass b/frontend/src/app/modules/boards/board/board-actions/subtasks/subtasks-board-header.sassnew file mode 100644index 00000000000..3fb7e635b5f--- /dev/null+++ b/frontend/src/app/modules/boards/board/board-actions/subtasks/subtasks-board-header.sass@@ -0,0 +1,7 @@+// Override line-height for proper+// display of the h2 + small+.editable-toolbar-title--fixed+ line-height: 1 !important++.work-package-type+ padding-right: 0.5rem\ No newline at end of filediff --git a/frontend/src/app/modules/boards/openproject-boards.module.ts b/frontend/src/app/modules/boards/openproject-boards.module.tsindex 4bca52a85a8..4f1a94f5277 100644--- a/frontend/src/app/modules/boards/openproject-boards.module.ts+++ b/frontend/src/app/modules/boards/openproject-boards.module.ts@@ -53,6 +53,7 @@ import {BoardsMenuButtonComponent} from "core-app/modules/boards/board/toolbar-mimport {AssigneeBoardHeaderComponent} from "core-app/modules/boards/board/board-actions/assignee/assignee-board-header.component";import { TileViewComponent } from './tile-view/tile-view.component';import {SubprojectBoardHeaderComponent} from "core-app/modules/boards/board/board-actions/subproject/subproject-board-header.component";+import {SubtasksBoardHeaderComponent} from "core-app/modules/boards/board/board-actions/subtasks/subtasks-board-header.component";@NgModule({imports: [@@ -88,8 +89,9 @@ import {SubprojectBoardHeaderComponent} from "core-app/modules/boards/board/boarBoardFilterComponent,VersionBoardHeaderComponent,AssigneeBoardHeaderComponent,+ SubprojectBoardHeaderComponent,+ SubtasksBoardHeaderComponent,TileViewComponent,- SubprojectBoardHeaderComponent]})export class OpenprojectBoardsModule {