mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
Make grant message an optional addition; main text is in backend.
This commit is contained in:
@@ -8,10 +8,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="message">{{ 'grant-deny-request-copy.email.message' | translate }}</label>
|
<label for="message">{{ 'grant-deny-request-copy.email.message' | translate }}</label>
|
||||||
<textarea class="form-control" id="message" rows="8" [ngClass]="{'is-invalid': !message || message.length === 0}" [(ngModel)]="message" name="message"></textarea>
|
<textarea class="form-control" id="message" rows="8" [(ngModel)]="message" name="message"></textarea>
|
||||||
<div *ngIf="!message || message.length === 0" class="invalid-feedback">
|
|
||||||
{{ 'grant-deny-request-copy.email.message.empty' | translate }}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<ng-content></ng-content>
|
<ng-content></ng-content>
|
||||||
<div class="d-flex flex-row-reverse">
|
<div class="d-flex flex-row-reverse">
|
||||||
|
@@ -9,12 +9,8 @@ import {
|
|||||||
import { RemoteData } from '../../core/data/remote-data';
|
import { RemoteData } from '../../core/data/remote-data';
|
||||||
import { AuthService } from '../../core/auth/auth.service';
|
import { AuthService } from '../../core/auth/auth.service';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { combineLatest as observableCombineLatest } from 'rxjs';
|
|
||||||
import { ItemDataService } from '../../core/data/item-data.service';
|
import { ItemDataService } from '../../core/data/item-data.service';
|
||||||
import { EPerson } from '../../core/eperson/models/eperson.model';
|
|
||||||
import { DSONameService } from '../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../core/breadcrumbs/dso-name.service';
|
||||||
import { Item } from '../../core/shared/item.model';
|
|
||||||
import { isNotEmpty } from '../../shared/empty.util';
|
|
||||||
import { ItemRequestDataService } from '../../core/data/item-request-data.service';
|
import { ItemRequestDataService } from '../../core/data/item-request-data.service';
|
||||||
import { RequestCopyEmail } from '../email-request-copy/request-copy-email.model';
|
import { RequestCopyEmail } from '../email-request-copy/request-copy-email.model';
|
||||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||||
@@ -54,8 +50,6 @@ export class GrantRequestCopyComponent implements OnInit {
|
|||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private authService: AuthService,
|
private authService: AuthService,
|
||||||
private translateService: TranslateService,
|
private translateService: TranslateService,
|
||||||
private itemDataService: ItemDataService,
|
|
||||||
private nameService: DSONameService,
|
|
||||||
private itemRequestService: ItemRequestDataService,
|
private itemRequestService: ItemRequestDataService,
|
||||||
private notificationsService: NotificationsService,
|
private notificationsService: NotificationsService,
|
||||||
) {
|
) {
|
||||||
@@ -69,31 +63,7 @@ export class GrantRequestCopyComponent implements OnInit {
|
|||||||
redirectOn4xx(this.router, this.authService),
|
redirectOn4xx(this.router, this.authService),
|
||||||
);
|
);
|
||||||
|
|
||||||
const msgParams$ = observableCombineLatest([
|
|
||||||
this.itemRequestRD$.pipe(getFirstSucceededRemoteDataPayload()),
|
|
||||||
this.authService.getAuthenticatedUserFromStore(),
|
|
||||||
]).pipe(
|
|
||||||
switchMap(([itemRequest, user]: [ItemRequest, EPerson]) => {
|
|
||||||
return this.itemDataService.findById(itemRequest.itemId).pipe(
|
|
||||||
getFirstSucceededRemoteDataPayload(),
|
|
||||||
map((item: Item) => {
|
|
||||||
const uri = item.firstMetadataValue('dc.identifier.uri');
|
|
||||||
return Object.assign({
|
|
||||||
recipientName: itemRequest.requestName,
|
|
||||||
itemUrl: isNotEmpty(uri) ? uri : item.handle,
|
|
||||||
itemName: this.nameService.getName(item),
|
|
||||||
authorName: this.nameService.getName(user),
|
|
||||||
authorEmail: user.email,
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
this.subject$ = this.translateService.get('grant-request-copy.email.subject');
|
this.subject$ = this.translateService.get('grant-request-copy.email.subject');
|
||||||
this.message$ = msgParams$.pipe(
|
|
||||||
switchMap((params) => this.translateService.get('grant-request-copy.email.message', params)),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1726,7 +1726,7 @@
|
|||||||
|
|
||||||
"grant-deny-request-copy.email.back": "Back",
|
"grant-deny-request-copy.email.back": "Back",
|
||||||
|
|
||||||
"grant-deny-request-copy.email.message": "Message",
|
"grant-deny-request-copy.email.message": "Optional additional message",
|
||||||
|
|
||||||
"grant-deny-request-copy.email.message.empty": "Please enter a message",
|
"grant-deny-request-copy.email.message.empty": "Please enter a message",
|
||||||
|
|
||||||
@@ -1752,15 +1752,13 @@
|
|||||||
|
|
||||||
"grant-deny-request-copy.processed": "This request has already been processed. You can use the button below to get back to the home page.",
|
"grant-deny-request-copy.processed": "This request has already been processed. You can use the button below to get back to the home page.",
|
||||||
|
|
||||||
"grant-request-copy.email.message": "Dear {{ recipientName }},\nIn response to your request I have the pleasure to send you in attachment a copy of the file(s) concerning the document: \"{{ itemUrl }}\" ({{ itemName }}), of which I am an author.\n\nBest regards,\n{{ authorName }} <{{ authorEmail }}>",
|
|
||||||
|
|
||||||
"grant-request-copy.email.subject": "Request copy of document",
|
"grant-request-copy.email.subject": "Request copy of document",
|
||||||
|
|
||||||
"grant-request-copy.error": "An error occurred",
|
"grant-request-copy.error": "An error occurred",
|
||||||
|
|
||||||
"grant-request-copy.header": "Grant document copy request",
|
"grant-request-copy.header": "Grant document copy request",
|
||||||
|
|
||||||
"grant-request-copy.intro": "This message will be sent to the applicant of the request. The requested document(s) will be attached.",
|
"grant-request-copy.intro": "A message will be sent to the applicant of the request. The requested document(s) will be attached.",
|
||||||
|
|
||||||
"grant-request-copy.success": "Successfully granted item request",
|
"grant-request-copy.success": "Successfully granted item request",
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user