Skip to content

Commit fcdb14c

Browse files
committed
fix: hide Download All button when embargoed, clean up badge styling and i18n
1 parent 3a7f494 commit fcdb14c

4 files changed

Lines changed: 10 additions & 4 deletions

File tree

src/app/shared/object-collection/shared/badges/access-status-badge/access-status-badge.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@if (showAccessStatus) {
22
@if ((accessStatus$ | async); as status) {
3-
<span [class]="'badge dont-break-out access-status-list-element-badge ' + accessStatusClass">
3+
<span [class]="'badge badge-secondary dont-break-out access-status-list-element-badge ' + accessStatusClass">
44
<span class="sr-only">{{ 'listelement.badge.access-status' | translate }}</span>
55
{{ status | translate: { date: (embargoDate$ | async) } }}
66
<span class="sr-only">, </span>

src/assets/i18n/en.json5

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6972,8 +6972,6 @@
69726972

69736973
"file-download-link.download": "Download ",
69746974

6975-
"file-download-link.embargo-until": "Embargo until {{ date }}",
6976-
69776975
"register-page.registration.aria.label": "Enter your e-mail address",
69786976

69796977
"forgot-email.form.aria.label": "Enter your e-mail address",

src/themes/datashare/app/item-page/simple/field-components/file-section/file-section.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<ng-container *ngVar="(bitstreams$ | async) as bitstreams">
1212
<br>
1313
<div class="download-all-container" *ngIf="(downloadLink$ | async) as downloadLink">
14-
<a class="btn btn-primary" href="{{downloadLink}}" target="_blank">Download all files <i class="fa-solid fa-download"></i></a>
14+
<a *ngIf="(hasEmbargo$ | async) !== true" class="btn btn-primary" href="{{downloadLink}}" target="_blank">Download all files <i class="fa-solid fa-download"></i></a>
1515
</div>
1616
<br/>
1717
<ds-metadata-field-wrapper *ngIf="bitstreams?.length > 0" [label]="label | translate">

src/themes/datashare/app/item-page/simple/field-components/file-section/file-section.component.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { hasValue, isEmpty } from '../../../../../../../app/shared/empty.util';
1919
import { PaginationComponentOptions } from '../../../../../../../app/shared/pagination/pagination-component-options.model';
2020
import { followLink } from '../../../../../../../app/shared/utils/follow-link-config.model';
2121
import { BitstreamDataService } from '../../../../../../../app/core/data/bitstream-data.service';
22+
import { AccessStatusDataService } from '../../../../../../../app/core/data/access-status-data.service';
2223
import { NotificationsService } from '../../../../../../../app/shared/notifications/notifications.service';
2324
import { DSONameService } from '../../../../../../../app/core/breadcrumbs/dso-name.service';
2425
import { APP_CONFIG, AppConfig } from '../../../../../../../config/app-config.interface';
@@ -54,6 +55,7 @@ export class FileSectionComponent extends BaseComponent {
5455
licenses$: Observable<RemoteData<PaginatedList<Bitstream>>>;
5556
downloadLink$: Observable<string>;
5657
downloadLinkAvailable$: Observable<boolean>;
58+
hasEmbargo$: Observable<boolean>;
5759

5860
cclicenseOptions = Object.assign(new PaginationComponentOptions(), {
5961
id: 'cclbo',
@@ -76,6 +78,7 @@ export class FileSectionComponent extends BaseComponent {
7678
public dsoNameService: DSONameService,
7779
@Inject(APP_CONFIG) protected appConfig: AppConfig,
7880
protected downloadLinkService: DownloadLinkService,
81+
protected accessStatusDataService: AccessStatusDataService,
7982
) {
8083
super(bitstreamDataService, notificationsService, translateService, dsoNameService, appConfig);
8184

@@ -124,6 +127,11 @@ export class FileSectionComponent extends BaseComponent {
124127
map(link => link)
125128
);
126129

130+
this.hasEmbargo$ = this.accessStatusDataService.findAccessStatusFor(this.item).pipe(
131+
getFirstCompletedRemoteData(),
132+
map(rd => rd?.hasSucceeded && rd.payload?.status === 'embargo'),
133+
);
134+
127135
}
128136

129137
hasValuesInBundle(bundle: PaginatedList<Bitstream>) {

0 commit comments

Comments
 (0)