ScrollIntoView active WP on the wp-list

pull/8496/head
Aleix Suau 4 years ago
parent 2271412af9
commit 71fa23703a
  1. 4
      .gitignore
  2. 7
      frontend/angular.json
  3. 13
      frontend/src/app/components/wp-card-view/wp-single-card/wp-single-card.component.ts
  4. 4
      frontend/src/app/modules/router/openproject.routes.ts
  5. 23
      frontend/src/app/modules/work_packages/routing/wp-list-view/wp-list-view.component.ts

4
.gitignore vendored

@ -100,3 +100,7 @@ node_modules/
/package-lock.json
plaintext.yml
structure.sql
.generators
.rakeTasks

@ -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
}
}
}

@ -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(

@ -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

@ -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;
}

Loading…
Cancel
Save