Skip to content

Commit c550678

Browse files
atarix83Andrea Barbasso
authored andcommitted
Merged in task/dspace-cris-2023_02_x/CST-14674 (pull request DSpace#1695)
Fix issue with small com/col logo which were stretched out Approved-by: Andrea Barbasso
2 parents 5ec1ff3 + 89ba074 commit c550678

2 files changed

Lines changed: 23 additions & 21 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<div *ngIf="logo" class="dso-logo mb-3">
2-
<img [src]="logo._links.content.href" class="w-100 img-fluid" [attr.alt]="alternateText ? alternateText : null" (error)="errorHandler($event)"/>
2+
<img [src]="logo._links.content.href" class="mw-100 img-fluid" [attr.alt]="alternateText ? alternateText : null" (error)="errorHandler($event)"/>
33
</div>

src/app/shared/form/form.component.ts

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -426,25 +426,27 @@ export class FormComponent implements OnDestroy, OnInit {
426426
const metadataKeys = hasValue(metadataFields) ? Object.keys(metadataFields) : [];
427427
const formKeys = hasValue(this.formGroup.value) ? Object.keys(this.formGroup.value) : [];
428428

429-
formKeys.forEach((key) => {
430-
const innerObjectKeys = (Object.keys(this.formGroup.value[key] ) as any[]).map((oldKey) => oldKey.replaceAll('_', '.'));
431-
const filteredKeys = innerObjectKeys.filter(innerKey => metadataKeys.includes(innerKey));
432-
const oldValue = this.formGroup.value[key];
433-
434-
if (filteredKeys.length > 0) {
435-
filteredKeys.forEach((oldValueKey) => {
436-
const newValue = {...oldValue};
437-
const formattedKey = (oldValueKey as any).replaceAll('.', '_');
438-
const patchValue = {};
439-
440-
newValue[formattedKey] = metadataFields[oldValueKey][0];
441-
patchValue[key] = newValue;
442-
443-
if (!isEqual(oldValue[oldValueKey], newValue[oldValueKey])) {
444-
this.formGroup.patchValue(patchValue);
445-
}
446-
});
447-
}
448-
});
429+
formKeys
430+
.filter((key) => isNotEmpty(this.formGroup.value[key]))
431+
.forEach((key) => {
432+
const innerObjectKeys = (Object.keys(this.formGroup.value[key]) as any[]).map((oldKey) => oldKey.replaceAll('_', '.'));
433+
const filteredKeys = innerObjectKeys.filter(innerKey => metadataKeys.includes(innerKey));
434+
const oldValue = this.formGroup.value[key];
435+
436+
if (filteredKeys.length > 0) {
437+
filteredKeys.forEach((oldValueKey) => {
438+
const newValue = { ...oldValue };
439+
const formattedKey = (oldValueKey as any).replaceAll('.', '_');
440+
const patchValue = {};
441+
442+
newValue[formattedKey] = metadataFields[oldValueKey][0];
443+
patchValue[key] = newValue;
444+
445+
if (!isEqual(oldValue[oldValueKey], newValue[oldValueKey])) {
446+
this.formGroup.patchValue(patchValue);
447+
}
448+
});
449+
}
450+
});
449451
}
450452
}

0 commit comments

Comments
 (0)