1
0

Add an input to show/hide the badge on file component

This commit is contained in:
Nicolas Boulay
2025-03-19 13:20:05 -04:00
parent 2c6754a647
commit fe3ae0e8b4
5 changed files with 20 additions and 4 deletions

View File

@@ -29,7 +29,7 @@
[title]="'process.detail.output-files'"> [title]="'process.detail.output-files'">
<div class="d-flex flex-column"> <div class="d-flex flex-column">
@for (file of files; track file; let last = $last) { @for (file of files; track file; let last = $last) {
<ds-file-download-link [bitstream]="file"> <ds-file-download-link [bitstream]="file" [showAccessStatusBadge]="false">
<span>{{getFileName(file)}}</span> <span>{{getFileName(file)}}</span>
<span>({{(file?.sizeBytes) | dsFileSize }})</span> <span>({{(file?.sizeBytes) | dsFileSize }})</span>
</ds-file-download-link> </ds-file-download-link>

View File

@@ -1,4 +1,6 @@
<ds-access-status-badge [object]="bitstream"></ds-access-status-badge> @if (showAccessStatusBadge) {
<ds-access-status-badge [object]="bitstream"></ds-access-status-badge>
}
<a [routerLink]="(bitstreamPath$| async)?.routerLink" class="d-block dont-break-out mb-1" <a [routerLink]="(bitstreamPath$| async)?.routerLink" class="d-block dont-break-out mb-1"
[queryParams]="(bitstreamPath$| async)?.queryParams" [queryParams]="(bitstreamPath$| async)?.queryParams"
[target]="isBlank ? '_blank': '_self'" [target]="isBlank ? '_blank': '_self'"

View File

@@ -65,6 +65,11 @@ export class FileDownloadLinkComponent implements OnInit {
@Input() enableRequestACopy = true; @Input() enableRequestACopy = true;
/**
* A boolean indicating whether the access status badge is displayed
*/
@Input() showAccessStatusBadge = true;
bitstreamPath$: Observable<{ bitstreamPath$: Observable<{
routerLink: string, routerLink: string,
queryParams: any, queryParams: any,

View File

@@ -27,7 +27,16 @@ export class ThemedFileDownloadLinkComponent extends ThemedComponent<FileDownloa
@Input() enableRequestACopy: boolean; @Input() enableRequestACopy: boolean;
protected inAndOutputNames: (keyof FileDownloadLinkComponent & keyof this)[] = ['bitstream', 'item', 'cssClasses', 'isBlank', 'enableRequestACopy']; @Input() showAccessStatusBadge: boolean;
protected inAndOutputNames: (keyof FileDownloadLinkComponent & keyof this)[] = [
'bitstream',
'item',
'cssClasses',
'isBlank',
'enableRequestACopy',
'showAccessStatusBadge',
];
protected getComponentName(): string { protected getComponentName(): string {
return 'FileDownloadLinkComponent'; return 'FileDownloadLinkComponent';

View File

@@ -27,7 +27,7 @@
<div class="float-end w-15"> <div class="float-end w-15">
<ng-container> <ng-container>
<ds-file-download-link [cssClasses]="'btn btn-link-focus'" [isBlank]="true" <ds-file-download-link [cssClasses]="'btn btn-link-focus'" [isBlank]="true"
[bitstream]="getBitstream()" [enableRequestACopy]="false"> [bitstream]="getBitstream()" [enableRequestACopy]="false" [showAccessStatusBadge]="false">
<i class="fa fa-download fa-2x text-normal" aria-hidden="true"></i> <i class="fa fa-download fa-2x text-normal" aria-hidden="true"></i>
</ds-file-download-link> </ds-file-download-link>
<button class="btn btn-link-focus" <button class="btn btn-link-focus"