118220: Integrate live-region component into item-edit-bitsream page

This commit is contained in:
Andreas Awouters
2024-09-16 15:47:42 +02:00
parent a207fb51e9
commit d674bcc390
3 changed files with 19 additions and 8 deletions

View File

@@ -68,7 +68,7 @@
<ng-container *ngFor="let entry of (tableEntries$ | async)"> <ng-container *ngFor="let entry of (tableEntries$ | async)">
<tr *ngIf="updates[entry.id] as update" [ngClass]="getRowClass(update)" class="bitstream-row" cdkDrag <tr *ngIf="updates[entry.id] as update" [ngClass]="getRowClass(update)" class="bitstream-row" cdkDrag
(cdkDragStarted)="dragStart()" (cdkDragEnded)="dragEnd()"> (cdkDragStarted)="dragStart(entry.name)" (cdkDragEnded)="dragEnd(entry.name)">
<th class="bitstream-name row-element {{ columnSizes.columns[0].buildClasses() }}" <th class="bitstream-name row-element {{ columnSizes.columns[0].buildClasses() }}"
scope="row" id="{{ entry.nameStripped }}" headers="{{ bundleName }} name"> scope="row" id="{{ entry.nameStripped }}" headers="{{ bundleName }} name">

View File

@@ -30,6 +30,8 @@ import { RequestService } from '../../../../core/data/request.service';
import { ItemBitstreamsService } from '../item-bitstreams.service'; import { ItemBitstreamsService } from '../item-bitstreams.service';
import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop'; import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';
import { hasValue } from '../../../../shared/empty.util'; import { hasValue } from '../../../../shared/empty.util';
import { LiveRegionService } from '../../../../shared/live-region/live-region.service';
import { TranslateService } from '@ngx-translate/core';
/** /**
* Interface storing all the information necessary to create a row in the bitstream edit table * Interface storing all the information necessary to create a row in the bitstream edit table
@@ -166,11 +168,6 @@ export class ItemEditBitstreamBundleComponent implements OnInit {
*/ */
pageSize$: BehaviorSubject<number>; pageSize$: BehaviorSubject<number>;
/**
* Whether the table has multiple pages
*/
hasMultiplePages = false;
/** /**
* The self url of the bundle, also used when retrieving fieldUpdates * The self url of the bundle, also used when retrieving fieldUpdates
*/ */
@@ -190,6 +187,8 @@ export class ItemEditBitstreamBundleComponent implements OnInit {
protected paginationService: PaginationService, protected paginationService: PaginationService,
protected requestService: RequestService, protected requestService: RequestService,
protected itemBitstreamsService: ItemBitstreamsService, protected itemBitstreamsService: ItemBitstreamsService,
protected liveRegionService: LiveRegionService,
protected translateService: TranslateService,
) { ) {
} }
@@ -301,7 +300,7 @@ export class ItemEditBitstreamBundleComponent implements OnInit {
this.paginationComponent.doPageSizeChange(pageSize); this.paginationComponent.doPageSizeChange(pageSize);
} }
dragStart() { dragStart(bitstreamName: string) {
// Only open the drag tooltip when there are multiple pages // Only open the drag tooltip when there are multiple pages
this.paginationComponent.shouldShowBottomPager.pipe( this.paginationComponent.shouldShowBottomPager.pipe(
take(1), take(1),
@@ -309,10 +308,18 @@ export class ItemEditBitstreamBundleComponent implements OnInit {
).subscribe(() => { ).subscribe(() => {
this.dragTooltip.open(); this.dragTooltip.open();
}); });
const message = this.translateService.instant('item.edit.bitstreams.edit.live.drag',
{ bitstream: bitstreamName });
this.liveRegionService.addMessage(message);
} }
dragEnd() { dragEnd(bitstreamName: string) {
this.dragTooltip.close(); this.dragTooltip.close();
const message = this.translateService.instant('item.edit.bitstreams.edit.live.drop',
{ bitstream: bitstreamName });
this.liveRegionService.addMessage(message);
} }

View File

@@ -1950,6 +1950,10 @@
"item.edit.bitstreams.edit.buttons.undo": "Undo changes", "item.edit.bitstreams.edit.buttons.undo": "Undo changes",
"item.edit.bitstreams.edit.live.drag": "{{ bitstream }} grabbed",
"item.edit.bitstreams.edit.live.drop": "{{ bitstream }} dropped",
"item.edit.bitstreams.empty": "This item doesn't contain any bitstreams. Click the upload button to create one.", "item.edit.bitstreams.empty": "This item doesn't contain any bitstreams. Click the upload button to create one.",
"item.edit.bitstreams.headers.actions": "Actions", "item.edit.bitstreams.headers.actions": "Actions",