From b8ba49d4cff5d9f3793ae347aeb18bf306765262 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 4 Oct 2019 23:58:10 +0200 Subject: [PATCH] UI improvements. --- .../Schemas/SchemaExtensions.cs | 5 +++ .../Contents/Queries/ContentEnricher.cs | 2 +- .../content/shared/content.component.html | 33 +++---------------- .../content/shared/content.component.scss | 24 +------------- .../content/shared/content.component.ts | 11 +------ .../shared/reference-item.component.scss | 6 +++- .../shared/reference-item.component.ts | 8 ++--- .../shared/references-editor.component.ts | 2 +- .../types/references-validation.component.ts | 6 ++-- 9 files changed, 23 insertions(+), 74 deletions(-) diff --git a/src/Squidex.Domain.Apps.Core.Model/Schemas/SchemaExtensions.cs b/src/Squidex.Domain.Apps.Core.Model/Schemas/SchemaExtensions.cs index 3ecfe0747..71d912b26 100644 --- a/src/Squidex.Domain.Apps.Core.Model/Schemas/SchemaExtensions.cs +++ b/src/Squidex.Domain.Apps.Core.Model/Schemas/SchemaExtensions.cs @@ -54,6 +54,11 @@ namespace Squidex.Domain.Apps.Core.Schemas return schema.Properties.Label.WithFallback(schema.TypeName()); } + public static string DisplayNameUnchanged(this Schema schema) + { + return schema.Properties.Label.WithFallback(schema.Name); + } + public static Guid SingleId(this ReferencesFieldProperties properties) { return properties.SchemaIds?.Count == 1 ? properties.SchemaIds[0] : Guid.Empty; diff --git a/src/Squidex.Domain.Apps.Entities/Contents/Queries/ContentEnricher.cs b/src/Squidex.Domain.Apps.Entities/Contents/Queries/ContentEnricher.cs index b262976c3..7808fe52a 100644 --- a/src/Squidex.Domain.Apps.Entities/Contents/Queries/ContentEnricher.cs +++ b/src/Squidex.Domain.Apps.Entities/Contents/Queries/ContentEnricher.cs @@ -101,7 +101,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Queries var referenceFields = schema.SchemaDef.ReferenceFields().ToArray(); var schemaName = schema.SchemaDef.Name; - var schemaDisplayName = schema.DisplayName(); + var schemaDisplayName = schema.SchemaDef.DisplayNameUnchanged(); foreach (var content in group) { diff --git a/src/Squidex/app/features/content/shared/content.component.html b/src/Squidex/app/features/content/shared/content.component.html index df881b423..51cd12140 100644 --- a/src/Squidex/app/features/content/shared/content.component.html +++ b/src/Squidex/app/features/content/shared/content.component.html @@ -1,18 +1,11 @@ - - - - - - - + - + - \ No newline at end of file diff --git a/src/Squidex/app/features/content/shared/content.component.scss b/src/Squidex/app/features/content/shared/content.component.scss index d56691f00..fbb752506 100644 --- a/src/Squidex/app/features/content/shared/content.component.scss +++ b/src/Squidex/app/features/content/shared/content.component.scss @@ -1,24 +1,2 @@ @import '_vars'; -@import '_mixins'; - -.reference-edit { - & { - position: relative; - } - - &:hover { - .reference-menu { - display: block; - } - } - - .reference-menu { - @include absolute(0, -.25rem, auto, auto); - display: none; - padding-left: 2rem; - min-height: 2.4rem; - max-height: 2.4rem; - white-space: nowrap; - background: $color-table-background; - } -} \ No newline at end of file +@import '_mixins'; \ No newline at end of file diff --git a/src/Squidex/app/features/content/shared/content.component.ts b/src/Squidex/app/features/content/shared/content.component.ts index 613ed4a36..1fb614168 100644 --- a/src/Squidex/app/features/content/shared/content.component.ts +++ b/src/Squidex/app/features/content/shared/content.component.ts @@ -47,9 +47,6 @@ export class ContentComponent implements OnChanges { @Input() public selected = false; - @Input() - public selectable = true; - @Input() public language: AppLanguageDto; @@ -62,12 +59,6 @@ export class ContentComponent implements OnChanges { @Input() public canClone: boolean; - @Input() - public isReadOnly = false; - - @Input() - public isReference = false; - @Input() public isCompact = false; @@ -99,7 +90,7 @@ export class ContentComponent implements OnChanges { public ngOnChanges(changes: SimpleChanges) { if (changes['content']) { - this.patchAllowed = !this.isReadOnly && this.content.canUpdate; + this.patchAllowed = this.content.canUpdate; } if (changes['schema'] || changes['language']) { diff --git a/src/Squidex/app/features/content/shared/reference-item.component.scss b/src/Squidex/app/features/content/shared/reference-item.component.scss index d56691f00..43441bd9e 100644 --- a/src/Squidex/app/features/content/shared/reference-item.component.scss +++ b/src/Squidex/app/features/content/shared/reference-item.component.scss @@ -15,10 +15,14 @@ .reference-menu { @include absolute(0, -.25rem, auto, auto); display: none; - padding-left: 2rem; min-height: 2.4rem; max-height: 2.4rem; white-space: nowrap; background: $color-table-background; } +} + +.badge { + @include truncate; + display: inline-block !important; } \ No newline at end of file diff --git a/src/Squidex/app/features/content/shared/reference-item.component.ts b/src/Squidex/app/features/content/shared/reference-item.component.ts index c77b4118d..777c689ee 100644 --- a/src/Squidex/app/features/content/shared/reference-item.component.ts +++ b/src/Squidex/app/features/content/shared/reference-item.component.ts @@ -32,8 +32,8 @@ import { - - {{content.schemaDisplayName}} + + {{content.schemaDisplayName}} @@ -77,9 +77,7 @@ export class ReferenceItemComponent implements OnChanges { public values: any[] = []; public ngOnChanges(changes: SimpleChanges) { - if (changes['content'] || changes['language']) { - this.updateValues(); - } + this.updateValues(); } public emitDelete() { diff --git a/src/Squidex/app/features/content/shared/references-editor.component.ts b/src/Squidex/app/features/content/shared/references-editor.component.ts index 9d1080835..f54ba9dbb 100644 --- a/src/Squidex/app/features/content/shared/references-editor.component.ts +++ b/src/Squidex/app/features/content/shared/references-editor.component.ts @@ -85,7 +85,7 @@ export class ReferencesEditorComponent extends StatefulControlComponent