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

ScrollIntoView active WP on the wp-list

Aleix Suau71fa23703add
diff --git a/.gitignore b/.gitignore
index 1d4edfc5a2b..0d6a5d34c23 100644
--- a/.gitignore
+++ b/.gitignore
@@ -100,3 +100,7 @@ node_modules/
/package-lock.json
plaintext.yml
structure.sql
+
+.generators
+
+.rakeTasks
diff --git a/frontend/angular.json b/frontend/angular.json
index f147d8bc2f6..89c03f690a4 100644
--- a/frontend/angular.json
+++ b/frontend/angular.json
@@ -1,4 +1,4 @@
- {
+{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
@@ -151,5 +151,8 @@
"@schematics/angular:directive": {
"prefix": "app"
}
+ },
+ "cli": {
+ "analytics": false
}
-}
+}
\ No newline at end of file
diff --git a/frontend/src/app/components/wp-card-view/wp-single-card/wp-single-card.component.ts b/frontend/src/app/components/wp-card-view/wp-single-card/wp-single-card.component.ts
index 4242ebe2cd5..17cd5349e07 100644
--- a/frontend/src/app/components/wp-card-view/wp-single-card/wp-single-card.component.ts
+++ b/frontend/src/app/components/wp-card-view/wp-single-card/wp-single-card.component.ts
@@ -5,8 +5,7 @@ import {
EventEmitter,
Input,
OnInit,
- Output,
- ElementRef
+ Output
} from "@angular/core";
import {WorkPackageResource} from "core-app/modules/hal/resources/work-package-resource";
import {checkedClassName, uiStateLinkClass} from "core-components/wp-fast-table/builders/ui-state-link-builder";
@@ -53,19 +52,11 @@ export class WorkPackageSingleCardComponent extends UntilDestroyedMixin implemen
readonly wpTableSelection:WorkPackageViewSelectionService,
readonly wpTableFocus:WorkPackageViewFocusService,
readonly cardView:WorkPackageCardViewService,
- readonly cdRef:ChangeDetectorRef,
- readonly elementRef:ElementRef) {
+ readonly cdRef:ChangeDetectorRef) {
super();
}
ngOnInit():void {
- // Scroll into view this card if it represents the selected WorkPackage
- // so when the user clicks a WP from a wp-split-view-entry (list of wp) and then
- // clicks on the 'back button', the last selected card is visible on the list.
- if (this.isSelected(this.workPackage)) {
- this.elementRef.nativeElement.scrollIntoView({block: "start"});
- }
-
// Update selection state
this.wpTableSelection.live$()
.pipe(
diff --git a/frontend/src/app/modules/router/openproject.routes.ts b/frontend/src/app/modules/router/openproject.routes.ts
index ce951b3d851..e049928ad81 100644
--- a/frontend/src/app/modules/router/openproject.routes.ts
+++ b/frontend/src/app/modules/router/openproject.routes.ts
@@ -162,8 +162,8 @@ export function initializeUiRouterListeners(injector:Injector) {
let wpBase = document.querySelector(appBaseSelector);
// Uncomment to trace route changes
- const uiRouter = injector.get(UIRouter);
- uiRouter.trace.enable();
+ // const uiRouter = injector.get(UIRouter);
+ // uiRouter.trace.enable();
// Apply classes from bodyClasses in each state definition
// This was defined as onEnter, onExit functions in each state before
diff --git a/frontend/src/app/modules/work_packages/routing/wp-list-view/wp-list-view.component.ts b/frontend/src/app/modules/work_packages/routing/wp-list-view/wp-list-view.component.ts
index c8a99ffb3f3..383f10781f7 100644
--- a/frontend/src/app/modules/work_packages/routing/wp-list-view/wp-list-view.component.ts
+++ b/frontend/src/app/modules/work_packages/routing/wp-list-view/wp-list-view.component.ts
@@ -26,7 +26,14 @@
// See docs/COPYRIGHT.rdoc for more details.
// ++
-import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Injector, OnInit} from "@angular/core";
+import {
+ ChangeDetectionStrategy,
+ ChangeDetectorRef,
+ Component,
+ Injector,
+ OnInit,
+ ElementRef
+} from "@angular/core";
import {take} from "rxjs/operators";
import {CausedUpdatesService} from "core-app/modules/boards/board/caused-updates/caused-updates.service";
import {DragAndDropService} from "core-app/modules/common/drag-and-drop/drag-and-drop.service";
@@ -89,7 +96,8 @@ export class WorkPackageListViewComponent extends UntilDestroyedMixin implements
readonly deviceService:DeviceService,
readonly CurrentProject:CurrentProjectService,
readonly wpDisplayRepresentation:WorkPackageViewDisplayRepresentationService,
- readonly cdRef:ChangeDetectorRef) {
+ readonly cdRef:ChangeDetectorRef,
+ readonly elementRef:ElementRef) {
super();
}
@@ -105,6 +113,15 @@ export class WorkPackageListViewComponent extends UntilDestroyedMixin implements
this.noResults = query.results.total === 0;
this.cdRef.detectChanges();
});
+
+ // Scroll into view the card/row that represents the last selected WorkPackage
+ // so when the user clicks a WP from a wp-split-view-entry (list of wp) and then
+ // clicks on the 'back button', the last selected card is visible on this list.
+ const selectedElement = this.elementRef.nativeElement.querySelector('.-checked');
+
+ if (selectedElement) {
+ this.elementRef.nativeElement.scrollIntoView({block: "start"});
+ }
}
protected setupInformationLoadedListener() {
@@ -119,7 +136,7 @@ export class WorkPackageListViewComponent extends UntilDestroyedMixin implements
});
}
- protected showResizerInCardView():boolean {
+ public showResizerInCardView():boolean {
return false;
}