Skip to content

Commit

Permalink
Merged in authority_source_2023_02_x_DSC_1498 (pull request DSpace#1299)
Browse files Browse the repository at this point in the history
Authority source DSC-1498

Approved-by: Stefano Maffei
  • Loading branch information
FrancescoMolinaro authored and steph-ieffam committed Feb 12, 2024
2 parents 8249d00 + e2cec01 commit e4e9193
Show file tree
Hide file tree
Showing 12 changed files with 104 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ export function normalizeSectionData(obj: any, objIndex?: number) {
(obj.display || obj.value),
obj.place || objIndex,
obj.confidence,
obj.otherInformation
obj.otherInformation,
obj.source
);
} else if (Array.isArray(obj)) {
result = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@

<ng-template #hasInfo let-entry="entry">
<ul class="list-unstyled mb-0">
<li class="list-item text-truncate text-primary font-weight-bold">{{entry.value}}</li>
<li class="list-item d-flex align-items-center">
<div *ngIf="entry.source" class="mr-2">
<img onerror="handleImgError(this)" [src]="'assets/images/' + entry.source + '.logo.icon.svg'" [attr.alt]="('form.entry.source.' + entry.source) | translate" />
</div>
<div class="text-truncate text-primary font-weight-bold">{{entry.value}}</div>
<div *ngIf="entry.source" class="ml-2 text-truncate text-secondary">{{ ('form.entry.source.' + entry.source) | translate}}</div>
</li>
<ng-container *ngFor="let item of entry.otherInformation | dsObjNgFor">
<li *ngIf="!item.key.startsWith('data-')" class="list-item text-truncate text-secondary" >
{{ 'form.other-information.' + item.key | translate }} : {{item.value !== '' ? getOtherInfoValue(item.value) : ('form.other-information.not-available' | translate)}}
Expand All @@ -18,7 +24,13 @@

<ng-template #noInfo let-entry="entry">
<ul class="list-unstyled mb-0">
<li class="list-item text-truncate text-primary font-weight-bold">{{entry.value}}</li>
<li class="list-item d-flex align-items-center">
<div *ngIf="entry.source" class="mr-2">
<img onerror="handleImgError(this)" [src]="'assets/images/' + entry.source + '.logo.icon.svg'" [attr.alt]="('form.entry.source.' + entry.source) | translate" />
</div>
<div class="text-truncate text-primary font-weight-bold">{{entry.value}}</div>
<div *ngIf="entry.source" class="ml-2 text-truncate text-secondary">{{ ('form.entry.source.' + entry.source) | translate}}</div>
</li>
</ul>
</ng-template>

Expand Down Expand Up @@ -79,7 +91,6 @@
[disabled]="model.readOnly"
[type]="model.inputType"
[value]="currentValue?.display"
[disabled]="model.readOnly"
(focus)="onFocus($event)"
(change)="onChange($event)"
(click)="openTree($event)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@
background-color: #fff;
cursor: pointer;
}

.list-item img {
height: 20px
}
Original file line number Diff line number Diff line change
Expand Up @@ -311,4 +311,12 @@ export class DsDynamicOneboxComponent extends DsDynamicVocabularyComponent imple
.filter((sub) => hasValue(sub))
.forEach((sub) => sub.unsubscribe());
}

/**
* Hide image on error
* @param image
*/
handleImgError(image: HTMLElement): void {
image.style.display = 'none';
}
}
2 changes: 2 additions & 0 deletions src/app/shared/form/builder/form-builder.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ export class FormBuilderService extends DynamicFormService {
(controlModel as any).metadataValue.place,
(controlModel as any).metadataValue.confidence,
(controlModel as any).metadataValue.otherInformation,
(controlModel as any).metadataValue.source,
(controlModel as any).metadataValue.metadata);
}

Expand All @@ -262,6 +263,7 @@ export class FormBuilderService extends DynamicFormService {
(controlModel as any).value.place,
(controlModel as any).value.confidence,
(controlModel as any).value.otherInformation,
(controlModel as any).value.source,
(controlModel as any).value.metadata);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export class FormFieldMetadataValueObject implements MetadataValueInterface {
place: number;
label: string;
securityLevel: number;
source: string;
otherInformation: OtherInformation;

constructor(value: any = null,
Expand All @@ -35,7 +36,9 @@ export class FormFieldMetadataValueObject implements MetadataValueInterface {
place: number = 0,
confidence: number = null,
otherInformation: any = null,
metadata: string = null) {
source: string = null,
metadata: string = null
) {
this.value = isNotNull(value) ? ((typeof value === 'string') ? value.trim() : value) : null;
this.language = language;
this.authority = authority;
Expand All @@ -54,7 +57,7 @@ export class FormFieldMetadataValueObject implements MetadataValueInterface {
if (isNotEmpty(metadata)) {
this.metadata = metadata;
}

this.source = source;
this.otherInformation = otherInformation;
}

Expand Down
12 changes: 12 additions & 0 deletions src/assets/i18n/en.json5
Original file line number Diff line number Diff line change
Expand Up @@ -2473,6 +2473,18 @@

"form.other-information.ror_orgunit_acronym": "ROR acronym",

"form.entry.source.local": "",

"form.entry.source.orcid": "",

"form.entry.source.ror": "",

"form.entry.source.openaire": "",

"form.entry.source.zdb": "",

"form.entry.source.sherpa": "- Sherpa Romeo",

"form.remove": "Remove",

"form.save": "Save",
Expand Down
1 change: 1 addition & 0 deletions src/assets/images/local.logo.icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/images/openaire.logo.icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions src/assets/images/ror.logo.icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions src/assets/images/sherpa.logo.icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/images/zdb.logo.icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e4e9193

Please sign in to comment.