Skip to content

Commit c1dbc0f

Browse files
[UXP-123] pass as a param the tab name to the attachment viewer link calculator
1 parent 806220d commit c1dbc0f

5 files changed

Lines changed: 23 additions & 7 deletions

File tree

src/app/cris-layout/cris-layout-matrix/cris-layout-box-container/boxes/metadata/rendering-types/advanced-attachment/bitstream-attachment/attachment-render/types/iiif-toolbar/iiif-toolbar.component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ export class IIIFToolbarComponent implements OnInit {
2828

2929
@Input()
3030
bitstream: Bitstream;
31+
/**
32+
* The tab name
33+
*/
34+
@Input() tabName: string;
3135

3236
// The path to the REST manifest endpoint.
3337
manifestUrl: string;
@@ -57,7 +61,7 @@ export class IIIFToolbarComponent implements OnInit {
5761

5862
async openMiradorViewer() {
5963
if (environment.advancedAttachmentRendering.showViewerOnSameItemPage) {
60-
await this.router.navigate([ getItemViewerDetailsPath(this.item, 'iiif') ], { fragment: 'viewer' });
64+
await this.router.navigate([ getItemViewerDetailsPath(this.item, 'iiif', this.tabName) ], { fragment: 'viewer' });
6165
} else {
6266
await this.router.navigate([ getItemViewerPath(this.item, 'iiif') ]);
6367
}

src/app/cris-layout/cris-layout-matrix/cris-layout-box-container/boxes/metadata/rendering-types/advanced-attachment/bitstream-attachment/attachment-render/types/media-viewer-button/media-viewer-button.component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ export class MediaViewerButtonComponent implements OnInit {
3232
* The bitstream
3333
*/
3434
@Input() bitstream: Bitstream;
35+
/**
36+
* The tab name
37+
*/
38+
@Input() tabName: string;
3539

3640
showButton$!: Observable<boolean>;
3741

@@ -46,7 +50,7 @@ export class MediaViewerButtonComponent implements OnInit {
4650

4751
async openViewer() {
4852
if (environment.advancedAttachmentRendering.showViewerOnSameItemPage) {
49-
await this.router.navigate([getBitstreamItemViewerDetailsPath(this.item, this.bitstream, 'media')], {fragment: 'viewer'});
53+
await this.router.navigate([getBitstreamItemViewerDetailsPath(this.item, this.bitstream, 'media', this.tabName)], {fragment: 'viewer'});
5054
} else {
5155
await this.router.navigate([getBitstreamItemViewerPath(this.item, this.bitstream, 'media')]);
5256
}

src/app/cris-layout/cris-layout-matrix/cris-layout-box-container/boxes/metadata/rendering-types/advanced-attachment/bitstream-attachment/attachment-render/types/pdf-viewer-button/pdf-viewer-button.component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ export class PdfViewerButtonComponent implements OnInit {
3232
* The bitstream
3333
*/
3434
@Input() bitstream: Bitstream;
35+
/**
36+
* The tab name
37+
*/
38+
@Input() tabName: string;
3539

3640
constructor(
3741
private router: Router,
@@ -46,7 +50,7 @@ export class PdfViewerButtonComponent implements OnInit {
4650

4751
public async openPdfViewer() {
4852
if (environment.advancedAttachmentRendering.showViewerOnSameItemPage) {
49-
await this.router.navigate([ getBitstreamItemViewerDetailsPath(this.item, this.bitstream, 'pdf') ], { fragment: 'viewer' });
53+
await this.router.navigate([ getBitstreamItemViewerDetailsPath(this.item, this.bitstream, 'pdf', this.tabName) ], { fragment: 'viewer' });
5054
} else {
5155
await this.router.navigate([ getBitstreamItemViewerPath(this.item, this.bitstream, 'pdf') ]);
5256
}

src/app/item-page/item-page-routing-paths.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@ export function getItemViewerPath(item: Item, viewer: string) {
3737
return new URLCombiner(getItemPageRoute(item), VIEWERS_PATH, viewer).toString();
3838
}
3939

40-
export function getItemViewerDetailsPath(item: Item, viewer: string) {
41-
return new URLCombiner(getItemPageRoute(item), 'details', VIEWERS_PATH, viewer).toString();
40+
export function getItemViewerDetailsPath(item: Item, viewer: string, tabName: string) {
41+
return new URLCombiner(getItemPageRoute(item), tabName, VIEWERS_PATH, viewer).toString();
4242
}
4343

4444
export function getBitstreamItemViewerPath(item: Item, bitstream: Bitstream, viewer: string) {
4545
return new URLCombiner(getItemPageRoute(item), VIEWERS_PATH, bitstream.uuid, viewer).toString();
4646
}
4747

48-
export function getBitstreamItemViewerDetailsPath(item: Item, bitstream: Bitstream, viewer: string) {
49-
return new URLCombiner(getItemPageRoute(item), 'details', VIEWERS_PATH, bitstream.uuid, viewer).toString();
48+
export function getBitstreamItemViewerDetailsPath(item: Item, bitstream: Bitstream, viewer: string, tabName: string) {
49+
return new URLCombiner(getItemPageRoute(item), tabName, VIEWERS_PATH, bitstream.uuid, viewer).toString();
5050
}
5151

5252

src/app/shared/file-download-link/file-download-link.component.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ export class FileDownloadLinkComponent implements OnInit {
2929
@Input() bitstream: Bitstream;
3030

3131
@Input() item: Item;
32+
/**
33+
* The tab name
34+
*/
35+
@Input() tabName: string;
3236

3337
/**
3438
* Additional css classes to apply to link

0 commit comments

Comments
 (0)