Browse Source
UI fixes (#1152)
* Fixes
* Show zero properly.
* Fix reference editor.
pull/1153/head
Sebastian Stehle
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with
19 additions and
4 deletions
-
frontend/src/app/features/content/shared/preview-button.component.ts
-
frontend/src/app/features/content/shared/references/references-editor.component.html
-
frontend/src/app/shared/state/contents.forms.spec.ts
-
frontend/src/app/shared/state/contents.forms.visitors.ts
|
|
|
@ -96,7 +96,6 @@ export class PreviewButtonComponent extends StatefulComponent<State> implements |
|
|
|
const state = { ...s }; |
|
|
|
|
|
|
|
const keys = Object.keys(this.schema.previewUrls); |
|
|
|
|
|
|
|
state.previewNameSelected = selectedName; |
|
|
|
state.previewNamesMore = keys.removed(selectedName).sorted(); |
|
|
|
|
|
|
|
|
|
|
|
@ -5,7 +5,7 @@ |
|
|
|
</button> |
|
|
|
</div> |
|
|
|
<div class="col" [class.disabled]="snapshot.isDisabled"> |
|
|
|
<button class="btn btn-outline-secondary btn-dashed btn-block" (click)="contentSelectorDialog.show()"> |
|
|
|
<button class="btn btn-outline-secondary btn-dashed btn-block" (click)="contentSelectorDialog.show()" type="button"> |
|
|
|
{{ "contents.referencesSelectExisting" | sqxTranslate }} |
|
|
|
</button> |
|
|
|
</div> |
|
|
|
|
|
|
|
@ -397,6 +397,23 @@ describe('GetContentValue', () => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
it('should resolve value from invariant field as zero', () => { |
|
|
|
const content: any = { |
|
|
|
data: { |
|
|
|
field1: { |
|
|
|
iv: 0, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
|
|
|
|
const result = getContentValue(content, language, fieldInvariant); |
|
|
|
|
|
|
|
expect(result).toEqual({ |
|
|
|
value: 0, |
|
|
|
formatted: '0', |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
it('should resolve value from localized field', () => { |
|
|
|
const content: any = { |
|
|
|
data: { |
|
|
|
|
|
|
|
@ -48,12 +48,11 @@ export function getContentValue(content: ContentDto, language: LanguageDto, fiel |
|
|
|
const actualReference = getValue(content.referenceData, language, field, true); |
|
|
|
const actualValue = getValue(content.data, language, field); |
|
|
|
|
|
|
|
if (!actualReference && !actualValue) { |
|
|
|
if (Types.isUndefined(actualReference) && Types.isUndefined(actualValue)) { |
|
|
|
return { value: actualValue, formatted: '' }; |
|
|
|
} |
|
|
|
|
|
|
|
const formatted = FieldFormatter.format(field, actualValue, actualReference, allowHtml); |
|
|
|
|
|
|
|
return { value: actualValue, formatted }; |
|
|
|
} |
|
|
|
|
|
|
|
|