Browse Source

UI improvements.

pull/422/head
Sebastian 7 years ago
parent
commit
b8ba49d4cf
  1. 5
      src/Squidex.Domain.Apps.Core.Model/Schemas/SchemaExtensions.cs
  2. 2
      src/Squidex.Domain.Apps.Entities/Contents/Queries/ContentEnricher.cs
  3. 33
      src/Squidex/app/features/content/shared/content.component.html
  4. 24
      src/Squidex/app/features/content/shared/content.component.scss
  5. 11
      src/Squidex/app/features/content/shared/content.component.ts
  6. 6
      src/Squidex/app/features/content/shared/reference-item.component.scss
  7. 8
      src/Squidex/app/features/content/shared/reference-item.component.ts
  8. 2
      src/Squidex/app/features/content/shared/references-editor.component.ts
  9. 6
      src/Squidex/app/features/schemas/pages/schema/types/references-validation.component.ts

5
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;

2
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)
{

33
src/Squidex/app/features/content/shared/content.component.html

@ -1,18 +1,11 @@
<tr [routerLink]="link">
<td class="cell-select" sqxStopClick>
<ng-container *ngIf="!isReference; else referenceTemplate">
<input type="checkbox" class="form-check"
[disabled]="!selectable"
[ngModel]="selected || !selectable"
(ngModelChange)="emitSelectedChange($event)" />
</ng-container>
<ng-template #referenceTemplate>
<i class="icon-drag2 drag-handle"></i>
</ng-template>
<input type="checkbox" class="form-check"
[ngModel]="selected"
(ngModelChange)="emitSelectedChange($event)" />
</td>
<td class="cell-actions cell-actions-left" *ngIf="!isReadOnly && !isDirty" sqxStopClick>
<td class="cell-actions cell-actions-left" *ngIf="!isDirty" sqxStopClick>
<div class="dropdown dropdown-options" *ngIf="content">
<button type="button" class="btn btn-text-secondary" (click)="dropdown.toggle()" [class.active]="dropdown.isOpen | async" #buttonOptions>
<i class="icon-dots"></i>
@ -79,23 +72,5 @@
<small class="item-modified">{{content.lastModified | sqxFromNow}}</small>
</td>
<td class="cell-actions" *ngIf="isReference" [sqxStopClick]="isDirty">
<div class="reference-edit">
<button type="button" class="btn btn-text-secondary">
<i class="icon-dots"></i>
</button>
<div class="reference-menu">
<a class="btn btn-text-secondary" [routerLink]="['../..', schema.name, content.id]">
<i class="icon-pencil"></i>
</a>
<button type="button" class="btn btn-text-secondary" (click)="emitDelete()">
<i class="icon-close"></i>
</button>
</div>
</div>
</td>
</tr>
<tr class="spacer"></tr>

24
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;
}
}
@import '_mixins';

11
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']) {

6
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;
}

8
src/Squidex/app/features/content/shared/reference-item.component.ts

@ -32,8 +32,8 @@ import {
<sqx-content-value [value]="value"></sqx-content-value>
</td>
<td class="cell-time" *ngIf="!isCompact">
<span class="badge badge-pill truncate badge-primary">{{content.schemaDisplayName}}</span>
<td class="cell-label" *ngIf="!isCompact">
<span class="badge badge-pill truncate-inline badge-primary">{{content.schemaDisplayName}}</span>
</td>
<td class="cell-actions">
@ -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() {

2
src/Squidex/app/features/content/shared/references-editor.component.ts

@ -85,7 +85,7 @@ export class ReferencesEditorComponent extends StatefulControlComponent<State, s
}
public setContentItems(contentItems: ContentDto[]) {
let columnCount = 0;
let columnCount = 1;
for (let content of contentItems) {
columnCount = Math.max(columnCount, content.referenceFields.length);

6
src/Squidex/app/features/schemas/pages/schema/types/references-validation.component.ts

@ -6,7 +6,7 @@
*/
import { Component, Input, OnInit } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import { FormControl, FormGroup } from '@angular/forms';
import {
FieldDto,
@ -45,8 +45,6 @@ export class ReferencesValidationComponent implements OnInit {
new FormControl(this.properties.minItems));
this.editForm.setControl('schemaIds',
new FormControl(this.properties.schemaIds, [
Validators.required
]));
new FormControl(this.properties.schemaIds));
}
}
Loading…
Cancel
Save