From 7e47faf12551a50d08139af656892134ba33d5ed Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 12 Oct 2020 17:46:55 +0200 Subject: [PATCH] Half width fields. --- backend/i18n/frontend_en.json | 1 + backend/i18n/frontend_it.json | 1 + backend/i18n/frontend_nl.json | 3 ++- backend/i18n/source/backend__ignore.json | 4 ++-- backend/i18n/source/frontend__ignore.json | 4 ++-- backend/i18n/source/frontend_en.json | 1 + .../Schemas/FieldProperties.cs | 2 ++ .../Schemas/Models/FieldPropertiesDto.cs | 5 +++++ .../pages/content/content-field.component.html | 2 +- .../pages/content/content-field.component.ts | 11 ++++++++++- .../content/content-section.component.html | 2 +- .../content/content-section.component.scss | 13 +++++++++++++ .../fields/forms/field-form-ui.component.html | 17 +++++++++++++++-- .../fields/forms/field-form-ui.component.scss | 3 --- frontend/app/shared/services/schemas.types.ts | 1 + frontend/app/shared/state/schemas.forms.ts | 1 + 16 files changed, 58 insertions(+), 13 deletions(-) diff --git a/backend/i18n/frontend_en.json b/backend/i18n/frontend_en.json index fe11289b7..035f51931 100644 --- a/backend/i18n/frontend_en.json +++ b/backend/i18n/frontend_en.json @@ -662,6 +662,7 @@ "schemas.field.empty": "No field created yet.", "schemas.field.enable": "Enable in UI", "schemas.field.enabledMarker": "Enabled", + "schemas.field.halfWidth": "Half Width", "schemas.field.hiddenMarker": "Hidden", "schemas.field.hide": "Hide in API", "schemas.field.hintsHint": "Describe this schema for documentation and user interfaces.", diff --git a/backend/i18n/frontend_it.json b/backend/i18n/frontend_it.json index ccc8d5834..8284cdfea 100644 --- a/backend/i18n/frontend_it.json +++ b/backend/i18n/frontend_it.json @@ -662,6 +662,7 @@ "schemas.field.empty": "Nessun campo è stato ancora creato.", "schemas.field.enable": "Abilita nella UI", "schemas.field.enabledMarker": "Abilitato", + "schemas.field.halfWidth": "Half Width", "schemas.field.hiddenMarker": "Nasconsto", "schemas.field.hide": "Nascondi nelle API", "schemas.field.hintsHint": "Descrivi questo schema per la documentazione e le interfacce utente.", diff --git a/backend/i18n/frontend_nl.json b/backend/i18n/frontend_nl.json index 27d3f70bd..494565614 100644 --- a/backend/i18n/frontend_nl.json +++ b/backend/i18n/frontend_nl.json @@ -58,7 +58,7 @@ "assets.deleteFolderConfirmTitle": "Map verwijderen", "assets.deleteMetadataConfirmText": "Wil je deze metadata echt verwijderen?", "assets.deleteMetadataConfirmTitle": "Metadata verwijderen", - "assets.deleteReferrerConfirmText": "Er wordt naar het item verwezen door een contentitem.\n\nWil je het item echt verwijderen?", + "assets.deleteReferrerConfirmText": "Er wordt naar het item verwezen door een contentitem. \n \n Wil je het item echt verwijderen?", "assets.deleteReferrerConfirmTitle": "Verwijder bestand", "assets.downloadVersion": "Download deze versie", "assets.dropToUpdate": "Zet neer om te updaten", @@ -662,6 +662,7 @@ "schemas.field.empty": "Nog geen veld aangemaakt.", "schemas.field.enable": "Inschakelen in gebruikersinterface", "schemas.field.enabledMarker": "Ingeschakeld", + "schemas.field.halfWidth": "Half Width", "schemas.field.hiddenMarker": "Verborgen", "schemas.field.hide": "Verbergen in API", "schemas.field.hintsHint": "Beschrijf dit schema voor documentatie en gebruikersinterfaces.", diff --git a/backend/i18n/source/backend__ignore.json b/backend/i18n/source/backend__ignore.json index a678d4af6..e9596e8ee 100644 --- a/backend/i18n/source/backend__ignore.json +++ b/backend/i18n/source/backend__ignore.json @@ -151,10 +151,10 @@ "/Squidex.Domain.Apps.Entities/Contents/Text/Elastic/ElasticSearchTextIndex.cs": [ "*" ], - "/Squidex.Domain.Apps.Entities/Contents/Text/Lucene/IndexManager_Impl.cs": [ + "/Squidex.Domain.Apps.Entities/Contents/Text/Lucene/IndexManager.cs": [ "*" ], - "/Squidex.Domain.Apps.Entities/Contents/Text/Lucene/IndexManager.cs": [ + "/Squidex.Domain.Apps.Entities/Contents/Text/Lucene/IndexManager_Impl.cs": [ "*" ], "/Squidex.Domain.Apps.Entities/Notifications/NotificationEmailSender.cs": [ diff --git a/backend/i18n/source/frontend__ignore.json b/backend/i18n/source/frontend__ignore.json index 4635dc8c0..737bd389f 100644 --- a/backend/i18n/source/frontend__ignore.json +++ b/backend/i18n/source/frontend__ignore.json @@ -19,8 +19,8 @@ "#{{index + 1}}" ], "/features/content/shared/forms/field-editor.component.html": [ - "{{field.displayName}} {{displaySuffix}}", - "*" + "*", + "{{field.displayName}} {{displaySuffix}}" ], "/features/content/shared/references/references-editor.component.html": [ "·" diff --git a/backend/i18n/source/frontend_en.json b/backend/i18n/source/frontend_en.json index fe11289b7..035f51931 100644 --- a/backend/i18n/source/frontend_en.json +++ b/backend/i18n/source/frontend_en.json @@ -662,6 +662,7 @@ "schemas.field.empty": "No field created yet.", "schemas.field.enable": "Enable in UI", "schemas.field.enabledMarker": "Enabled", + "schemas.field.halfWidth": "Half Width", "schemas.field.hiddenMarker": "Hidden", "schemas.field.hide": "Hide in API", "schemas.field.hintsHint": "Describe this schema for documentation and user interfaces.", diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldProperties.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldProperties.cs index 5765770c1..152688f2f 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldProperties.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldProperties.cs @@ -14,6 +14,8 @@ namespace Squidex.Domain.Apps.Core.Schemas { public bool IsRequired { get; set; } + public bool IsHalfWidth { get; set; } + public string? Placeholder { get; set; } public string? EditorUrl { get; set; } diff --git a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/FieldPropertiesDto.cs b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/FieldPropertiesDto.cs index 1d2888b4b..be00a4f25 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/FieldPropertiesDto.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/FieldPropertiesDto.cs @@ -43,6 +43,11 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models /// public bool IsRequired { get; set; } + /// + /// Indicates if the field should be rendered with half width only. + /// + public bool IsHalfWidth { get; set; } + /// /// Optional url to the editor. /// diff --git a/frontend/app/features/content/pages/content/content-field.component.html b/frontend/app/features/content/pages/content/content-field.component.html index 1a6c2a83e..69e1239d4 100644 --- a/frontend/app/features/content/pages/content/content-field.component.html +++ b/frontend/app/features/content/pages/content/content-field.component.html @@ -86,4 +86,4 @@ - + \ No newline at end of file diff --git a/frontend/app/features/content/pages/content/content-field.component.ts b/frontend/app/features/content/pages/content/content-field.component.ts index 05181c54c..f7867d3b2 100644 --- a/frontend/app/features/content/pages/content/content-field.component.ts +++ b/frontend/app/features/content/pages/content/content-field.component.ts @@ -5,7 +5,7 @@ * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. */ -import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core'; +import { Component, EventEmitter, HostBinding, Input, OnChanges, Output, SimpleChanges } from '@angular/core'; import { AppLanguageDto, AppsState, EditContentForm, FieldForm, invalid$, LocalStoreService, SchemaDto, Settings, StringFieldPropertiesDto, TranslationsService, Types, value$ } from '@app/shared'; import { combineLatest, Observable } from 'rxjs'; import { map } from 'rxjs/operators'; @@ -43,6 +43,15 @@ export class ContentFieldComponent implements OnChanges { @Input() public languages: ReadonlyArray; + @HostBinding('class') + public get class() { + return this.isHalfWidth ? 'col-6 half-field' : 'col-12'; + } + + public get isHalfWidth() { + return this.formModel.field.properties.isHalfWidth && !this.formCompare; + } + public showAllControls = false; public isDifferent: Observable; diff --git a/frontend/app/features/content/pages/content/content-section.component.html b/frontend/app/features/content/pages/content/content-section.component.html index b62a82228..34e2690e2 100644 --- a/frontend/app/features/content/pages/content/content-section.component.html +++ b/frontend/app/features/content/pages/content/content-section.component.html @@ -17,7 +17,7 @@ -
+
.col-6, + > .col-12 { + padding-left: .25rem; + padding-right: .25rem; + } + } +} + .btn { & { width: 2rem; diff --git a/frontend/app/features/schemas/pages/schema/fields/forms/field-form-ui.component.html b/frontend/app/features/schemas/pages/schema/fields/forms/field-form-ui.component.html index 5b6edff4c..9ce287760 100644 --- a/frontend/app/features/schemas/pages/schema/fields/forms/field-form-ui.component.html +++ b/frontend/app/features/schemas/pages/schema/fields/forms/field-form-ui.component.html @@ -1,5 +1,5 @@
-
+
@@ -40,4 +40,17 @@ - \ No newline at end of file + + +
+
+
+
+ + +
+
+
+
diff --git a/frontend/app/features/schemas/pages/schema/fields/forms/field-form-ui.component.scss b/frontend/app/features/schemas/pages/schema/fields/forms/field-form-ui.component.scss index 54750016b..e69de29bb 100644 --- a/frontend/app/features/schemas/pages/schema/fields/forms/field-form-ui.component.scss +++ b/frontend/app/features/schemas/pages/schema/fields/forms/field-form-ui.component.scss @@ -1,3 +0,0 @@ -.form-group { - margin-bottom: 1rem; -} \ No newline at end of file diff --git a/frontend/app/shared/services/schemas.types.ts b/frontend/app/shared/services/schemas.types.ts index 86fceaf53..4fd44e9d2 100644 --- a/frontend/app/shared/services/schemas.types.ts +++ b/frontend/app/shared/services/schemas.types.ts @@ -135,6 +135,7 @@ export abstract class FieldPropertiesDto { public readonly editorUrl?: string; public readonly hints?: string; public readonly isRequired: boolean = false; + public readonly isHalfWidth: boolean = false; public readonly label?: string; public readonly placeholder?: string; public readonly tags?: ReadonlyArray; diff --git a/frontend/app/shared/state/schemas.forms.ts b/frontend/app/shared/state/schemas.forms.ts index 882d083d9..975583702 100644 --- a/frontend/app/shared/state/schemas.forms.ts +++ b/frontend/app/shared/state/schemas.forms.ts @@ -214,6 +214,7 @@ export class EditFieldForm extends Form { ], editorUrl: null, isRequired: false, + isHalfWidth: false, tags: [] })); }