mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Request-a-copy: Angular flow control changes
This commit is contained in:
@@ -3,10 +3,13 @@
|
||||
[target]="isBlank ? '_blank': '_self'"
|
||||
[ngClass]="cssClasses"
|
||||
[attr.aria-label]="('file-download-link.download' | translate) + dsoNameService.getName(bitstream)">
|
||||
@if ((canDownload$ | async) === false && (canDownloadWithToken$ | async) === false) {
|
||||
<!-- If the user cannot download the file by auth or token, show a lock icon -->
|
||||
<span role="img" *ngIf="(canDownload$ | async) === false && (canDownloadWithToken$ | async) === false" [attr.aria-label]="'file-download-link.restricted' | translate" class="pr-1"><i class="fas fa-lock"></i></span>
|
||||
<span role="img" [attr.aria-label]="'file-download-link.restricted' | translate" class="pr-1"><i class="fas fa-lock"></i></span>
|
||||
} @else if ((canDownloadWithToken$ | async) && (canDownload$ | async) === false) {
|
||||
<!-- If the user can download the file by token, and NOT normally show a lock open icon -->
|
||||
<span role="img" *ngIf="(canDownloadWithToken$ | async) && (canDownload$ | async) === false" [attr.aria-label]="'file-download-link.secure-access' | translate" class="pr-1"><i class="fa-solid fa-lock-open" style="color: #26a269;"></i></span>
|
||||
<span role="img" [attr.aria-label]="'file-download-link.secure-access' | translate" class="pr-1"><i class="fa-solid fa-lock-open" style="color: #26a269;"></i></span>
|
||||
}
|
||||
<!-- Otherwise, show no icon (normal download by authorized user), public access etc. -->
|
||||
<ng-container *ngTemplateOutlet="content"></ng-container>
|
||||
</a>
|
||||
|
@@ -1,7 +1,6 @@
|
||||
import {
|
||||
AsyncPipe,
|
||||
NgClass,
|
||||
NgIf,
|
||||
NgTemplateOutlet,
|
||||
} from '@angular/common';
|
||||
import {
|
||||
@@ -41,7 +40,7 @@ import {
|
||||
styleUrls: ['./item-secure-file-download-link.component.scss'],
|
||||
standalone: true,
|
||||
imports: [
|
||||
RouterLink, NgClass, NgIf, NgTemplateOutlet, AsyncPipe, TranslateModule,
|
||||
RouterLink, NgClass, NgTemplateOutlet, AsyncPipe, TranslateModule,
|
||||
],
|
||||
})
|
||||
/**
|
||||
|
@@ -3,6 +3,20 @@
|
||||
<ds-metadata-field-wrapper [label]="label | translate">
|
||||
<div class="file-section">
|
||||
@for (file of bitstreams; track file; let last = $last) {
|
||||
@if (hasAccessToken() === true) {
|
||||
<ds-item-secure-file-download-link [bitstream]="file" [item]="item">
|
||||
<span>
|
||||
@if (primaryBitsreamId === file.id) {
|
||||
<span class="badge bg-primary">{{ 'item.page.bitstreams.primary' | translate }}</span>
|
||||
}
|
||||
{{ dsoNameService.getName(file) }}
|
||||
</span>
|
||||
<span> ({{(file?.sizeBytes) | dsFileSize }})</span>
|
||||
@if (!last) {
|
||||
<span innerHTML="{{separator}}"></span>
|
||||
}
|
||||
</ds-item-secure-file-download-link>
|
||||
} @else {
|
||||
<ds-file-download-link [bitstream]="file" [item]="item">
|
||||
<span>
|
||||
@if (primaryBitsreamId === file.id) {
|
||||
@@ -16,6 +30,7 @@
|
||||
}
|
||||
</ds-file-download-link>
|
||||
}
|
||||
}
|
||||
@if (isLoading) {
|
||||
<ds-loading message="{{'loading.default' | translate}}" [showMessage]="false"></ds-loading>
|
||||
}
|
||||
|
@@ -36,8 +36,9 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
<!-- Display the "already handled" message if there is a decision date, and either no access token (attachment was sent in email) or the request was denied -->
|
||||
@if (itemRequestRD.payload.decisionDate && (itemRequestRD.payload.acceptRequest === false || !itemRequestRD.payload.accessToken)) {
|
||||
@if (itemRequestRD.payload.decisionDate && (!itemRequestRD.payload.acceptRequest || !itemRequestRD.payload.accessToken)) {
|
||||
<div class="processed-message">
|
||||
<p>{{ 'grant-deny-request-copy.processed' | translate }}</p>
|
||||
<p class="text-center">
|
||||
@@ -45,7 +46,6 @@
|
||||
</p>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
}
|
||||
@if (!itemRequestRD || itemRequestRD?.isLoading) {
|
||||
|
@@ -1,7 +1,9 @@
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import {
|
||||
ComponentFixture,
|
||||
fakeAsync,
|
||||
TestBed,
|
||||
tick,
|
||||
waitForAsync,
|
||||
} from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
@@ -138,14 +140,16 @@ describe('GrantDenyRequestCopyComponent', () => {
|
||||
expect(message).toBeNull();
|
||||
});
|
||||
|
||||
it('should be displayed when decisionDate is defined', () => {
|
||||
it('should be displayed when decisionDate is defined', fakeAsync(() => {
|
||||
component.itemRequestRD$ = createSuccessfulRemoteDataObject$(Object.assign(new ItemRequest(), itemRequest, {
|
||||
decisionDate: 'defined-date',
|
||||
}));
|
||||
fixture.detectChanges();
|
||||
tick(); // Simulate passage of time
|
||||
fixture.detectChanges();
|
||||
|
||||
const message = fixture.debugElement.query(By.css('.processed-message'));
|
||||
expect(message).not.toBeNull();
|
||||
});
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
@@ -47,7 +47,7 @@ import { ThemedEmailRequestCopyComponent } from '../email-request-copy/themed-em
|
||||
styleUrls: ['./grant-request-copy.component.scss'],
|
||||
templateUrl: './grant-request-copy.component.html',
|
||||
standalone: true,
|
||||
imports: [CommonModule, VarDirective, NgIf, ThemedEmailRequestCopyComponent, FormsModule, ThemedLoadingComponent, AsyncPipe, TranslateModule, RouterLink, NgClass],
|
||||
imports: [CommonModule, VarDirective, ThemedEmailRequestCopyComponent, FormsModule, ThemedLoadingComponent, AsyncPipe, TranslateModule, RouterLink, NgClass],
|
||||
})
|
||||
/**
|
||||
* Component for granting an item request
|
||||
|
@@ -8,7 +8,6 @@ import { TranslateModule } from '@ngx-translate/core';
|
||||
import { AlertComponent } from 'src/app/shared/alert/alert.component';
|
||||
import { GoogleRecaptchaComponent } from 'src/app/shared/google-recaptcha/google-recaptcha.component';
|
||||
|
||||
import { AltchaCaptchaComponent } from '../../../../app/item-page/bitstreams/request-a-copy/altcha-captcha.component';
|
||||
import { RegisterEmailFormComponent as BaseComponent } from '../../../../app/register-email-form/register-email-form.component';
|
||||
import { BtnDisabledDirective } from '../../../../app/shared/btn-disabled.directive';
|
||||
|
||||
|
Reference in New Issue
Block a user