Merge branch 'bim/fix/33758-keep-scroll-position-when-back-to-list-from-detail' of https://github.com/opf/openproject into bim/fix/33758-keep-scroll-position-when-back-to-list-from-detail

pull/8496/head
Aleix Suau 4 years ago
commit 0b0c10c37c
  1. 13
      frontend/src/app/components/wp-card-view/wp-single-card/wp-single-card.component.ts

@ -5,7 +5,8 @@ import {
EventEmitter,
Input,
OnInit,
Output
Output,
ElementRef
} 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";
@ -52,11 +53,19 @@ export class WorkPackageSingleCardComponent extends UntilDestroyedMixin implemen
readonly wpTableSelection:WorkPackageViewSelectionService,
readonly wpTableFocus:WorkPackageViewFocusService,
readonly cardView:WorkPackageCardViewService,
readonly cdRef:ChangeDetectorRef) {
readonly cdRef:ChangeDetectorRef,
readonly elementRef:ElementRef) {
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(

Loading…
Cancel
Save