mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
[CST-5668] Fix layout and add typedoc
This commit is contained in:
@@ -4,61 +4,74 @@
|
|||||||
<ng-template ngbPanelContent>
|
<ng-template ngbPanelContent>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<form #f="ngForm" (ngSubmit)="onSubmit(f.form)">
|
<form #f="ngForm" (ngSubmit)="onSubmit(f.form)">
|
||||||
<div class="row alert alert-info">
|
<ds-alert [type]="'alert-info'">
|
||||||
{{ 'person.page.orcid.synchronization-mode-message' | translate}}
|
{{ 'person.page.orcid.synchronization-mode-message' | translate}}
|
||||||
</div>
|
</ds-alert>
|
||||||
<div class="row">
|
<div class="row mb-3">
|
||||||
<div class="card m-2 p-0 col-md">
|
<div class="col-md">
|
||||||
|
<div class="card">
|
||||||
<div class="card-header">{{ 'person.page.orcid.synchronization-mode'| translate }}</div>
|
<div class="card-header">{{ 'person.page.orcid.synchronization-mode'| translate }}</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label for="syncMode">{{ 'person.page.orcid.synchronization-mode.label'| translate }}</label>
|
<label for="syncMode">{{ 'person.page.orcid.synchronization-mode.label'| translate }}</label>
|
||||||
<select class="form-control" [(ngModel)]="currentSyncMode" name="syncMode" id="syncMode" required>
|
<select class="form-control" [(ngModel)]="currentSyncMode" name="syncMode" id="syncMode"
|
||||||
<option *ngFor="let syncMode of syncModes" [value]="syncMode.value">{{ syncMode.label | translate }}</option>
|
required>
|
||||||
|
<option *ngFor="let syncMode of syncModes"
|
||||||
|
[value]="syncMode.value">{{ syncMode.label | translate }}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
</div>
|
||||||
<div class="card m-2 col-md p-0">
|
<div class="row mb-3">
|
||||||
|
<div class="col-md">
|
||||||
|
<div class="card">
|
||||||
<div class="card-header">{{ 'person.page.orcid.publications-preferences'| translate }}</div>
|
<div class="card-header">{{ 'person.page.orcid.publications-preferences'| translate }}</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="m-3">
|
<div class="m-3">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div *ngFor="let option of syncPublicationOptions" class="row form-check">
|
<div *ngFor="let option of syncPublicationOptions" class="row form-check">
|
||||||
<input type="radio" [(ngModel)]="currentSyncPublications"
|
<input type="radio" [(ngModel)]="currentSyncPublications"
|
||||||
name="syncPublications" id="publicationOption_{{option.value}}" [value]="option.value" required >
|
name="syncPublications" id="publicationOption_{{option.value}}" [value]="option.value"
|
||||||
<label for="publicationOption_{{option.value}}" class="ml-2">{{option.label | translate}}</label>
|
required>
|
||||||
|
<label for="publicationOption_{{option.value}}"
|
||||||
|
class="ml-2">{{option.label | translate}}</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card m-2 col-md p-0">
|
</div>
|
||||||
|
<div class="col-md">
|
||||||
|
<div class="card">
|
||||||
<div class="card-header">{{ 'person.page.orcid.funding-preferences'| translate }}</div>
|
<div class="card-header">{{ 'person.page.orcid.funding-preferences'| translate }}</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="m-3">
|
<div class="m-3">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div *ngFor="let option of syncFundingOptions" class="row form-check">
|
<div *ngFor="let option of syncFundingOptions" class="row form-check">
|
||||||
<input type="radio" [(ngModel)]="currentSyncFundings"
|
<input type="radio" [(ngModel)]="currentSyncFunding"
|
||||||
name="syncFundings" id="fundingOption_{{option.value}}" [value]="option.value" required >
|
name="syncFundings" id="fundingOption_{{option.value}}" [value]="option.value"
|
||||||
|
required>
|
||||||
<label for="fundingOption_{{option.value}}" class="ml-2">{{option.label | translate}}</label>
|
<label for="fundingOption_{{option.value}}" class="ml-2">{{option.label | translate}}</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card m-2 col-md p-0">
|
</div>
|
||||||
|
<div class="col-md">
|
||||||
|
<div class="card">
|
||||||
<div class="card-header">{{ 'person.page.orcid.profile-preferences'| translate }}</div>
|
<div class="card-header">{{ 'person.page.orcid.profile-preferences'| translate }}</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="m-3">
|
<div class="m-3">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div *ngFor="let option of syncProfileOptions" class="row form-check">
|
<div *ngFor="let option of syncProfileOptions" class="row form-check">
|
||||||
<input type="checkbox" [(ngModel)]="option.checked"
|
<input type="checkbox" [(ngModel)]="option.checked"
|
||||||
name="syncProfile_{{option.value}}" id="profileOption_{{option.value}}" [value]="option.value" >
|
name="syncProfile_{{option.value}}" id="profileOption_{{option.value}}"
|
||||||
|
[value]="option.value">
|
||||||
<label for="profileOption_{{option.value}}" class="ml-2">{{option.label | translate}}</label>
|
<label for="profileOption_{{option.value}}" class="ml-2">{{option.label | translate}}</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -66,9 +79,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md">
|
<div class="col">
|
||||||
<button type="submit" class="btn btn-primary float-right m-2">
|
<button type="submit" class="btn btn-primary float-right">
|
||||||
<i class="fas fa-edit"></i>
|
<i class="fas fa-edit"></i>
|
||||||
{{ 'person.page.orcid.save.preference.changes' | translate }}
|
{{ 'person.page.orcid.save.preference.changes' | translate }}
|
||||||
</button>
|
</button>
|
||||||
|
@@ -26,20 +26,44 @@ export class OrcidSettingComponent implements OnInit {
|
|||||||
*/
|
*/
|
||||||
@Input() item: Item;
|
@Input() item: Item;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The prefix used for i18n keys
|
||||||
|
*/
|
||||||
messagePrefix = 'person.page.orcid';
|
messagePrefix = 'person.page.orcid';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The current synchronization mode
|
||||||
|
*/
|
||||||
currentSyncMode: string;
|
currentSyncMode: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The current synchronization mode for publications
|
||||||
|
*/
|
||||||
currentSyncPublications: string;
|
currentSyncPublications: string;
|
||||||
|
|
||||||
currentSyncFundings: string;
|
/**
|
||||||
|
* The current synchronization mode for funding
|
||||||
|
*/
|
||||||
|
currentSyncFunding: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The synchronization options
|
||||||
|
*/
|
||||||
syncModes: { value: string, label: string }[];
|
syncModes: { value: string, label: string }[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The synchronization options for publications
|
||||||
|
*/
|
||||||
syncPublicationOptions: { value: string, label: string }[];
|
syncPublicationOptions: { value: string, label: string }[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The synchronization options for funding
|
||||||
|
*/
|
||||||
syncFundingOptions: { value: string, label: string }[];
|
syncFundingOptions: { value: string, label: string }[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The profile synchronization options
|
||||||
|
*/
|
||||||
syncProfileOptions: { value: string, label: string, checked: boolean }[];
|
syncProfileOptions: { value: string, label: string, checked: boolean }[];
|
||||||
|
|
||||||
|
|
||||||
@@ -50,6 +74,9 @@ export class OrcidSettingComponent implements OnInit {
|
|||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init orcid settings form
|
||||||
|
*/
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.syncModes = [
|
this.syncModes = [
|
||||||
{
|
{
|
||||||
@@ -91,10 +118,15 @@ export class OrcidSettingComponent implements OnInit {
|
|||||||
|
|
||||||
this.currentSyncMode = this.getCurrentPreference('dspace.orcid.sync-mode', ['BATCH', 'MANUAL'], 'MANUAL');
|
this.currentSyncMode = this.getCurrentPreference('dspace.orcid.sync-mode', ['BATCH', 'MANUAL'], 'MANUAL');
|
||||||
this.currentSyncPublications = this.getCurrentPreference('dspace.orcid.sync-publications', ['DISABLED', 'ALL'], 'DISABLED');
|
this.currentSyncPublications = this.getCurrentPreference('dspace.orcid.sync-publications', ['DISABLED', 'ALL'], 'DISABLED');
|
||||||
this.currentSyncFundings = this.getCurrentPreference('dspace.orcid.sync-fundings', ['DISABLED', 'ALL'], 'DISABLED');
|
this.currentSyncFunding = this.getCurrentPreference('dspace.orcid.sync-fundings', ['DISABLED', 'ALL'], 'DISABLED');
|
||||||
}
|
}
|
||||||
|
|
||||||
onSubmit(form: FormGroup) {
|
/**
|
||||||
|
* Generate path operations to save orcid synchronization preferences
|
||||||
|
*
|
||||||
|
* @param form The form group
|
||||||
|
*/
|
||||||
|
onSubmit(form: FormGroup): void {
|
||||||
const operations: Operation[] = [];
|
const operations: Operation[] = [];
|
||||||
this.fillOperationsFor(operations, '/orcid/mode', form.value.syncMode);
|
this.fillOperationsFor(operations, '/orcid/mode', form.value.syncMode);
|
||||||
this.fillOperationsFor(operations, '/orcid/publications', form.value.syncPublications);
|
this.fillOperationsFor(operations, '/orcid/publications', form.value.syncPublications);
|
||||||
@@ -131,7 +163,27 @@ export class OrcidSettingComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fillOperationsFor(operations: Operation[], path: string, currentValue: string) {
|
/**
|
||||||
|
* Retrieve setting saved in the item's metadata
|
||||||
|
*
|
||||||
|
* @param metadataField The metadata name that contains setting
|
||||||
|
* @param allowedValues The allowed values
|
||||||
|
* @param defaultValue The default value
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
private getCurrentPreference(metadataField: string, allowedValues: string[], defaultValue: string): string {
|
||||||
|
const currentPreference = this.item.firstMetadataValue(metadataField);
|
||||||
|
return (currentPreference && allowedValues.includes(currentPreference)) ? currentPreference : defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate a replace patch operation
|
||||||
|
*
|
||||||
|
* @param operations
|
||||||
|
* @param path
|
||||||
|
* @param currentValue
|
||||||
|
*/
|
||||||
|
private fillOperationsFor(operations: Operation[], path: string, currentValue: string): void {
|
||||||
operations.push({
|
operations.push({
|
||||||
path: path,
|
path: path,
|
||||||
op: 'replace',
|
op: 'replace',
|
||||||
@@ -139,9 +191,4 @@ export class OrcidSettingComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getCurrentPreference(metadataField: string, allowedValues: string[], defaultValue: string): string {
|
|
||||||
const currentPreference = this.item.firstMetadataValue(metadataField);
|
|
||||||
return (currentPreference && allowedValues.includes(currentPreference)) ? currentPreference : defaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user