Browse Source

Saving field fixed.

pull/253/head
Sebastian Stehle 9 years ago
parent
commit
76f1b3507a
  1. 8
      src/Squidex/app/features/schemas/pages/schema/field.component.scss
  2. 19
      src/Squidex/app/features/schemas/pages/schema/field.component.ts
  3. 2
      src/Squidex/app/features/schemas/pages/schema/schema-page.component.html
  4. 5
      src/Squidex/app/features/schemas/pages/schema/schema-page.component.ts
  5. 8
      src/Squidex/app/features/settings/pages/languages/languages-page.component.scss

8
src/Squidex/app/features/schemas/pages/schema/field.component.scss

@ -4,7 +4,13 @@
$field-header: #e7ebef; $field-header: #e7ebef;
.table-items-row-details { .table-items-row-details {
cursor: default; & {
cursor: default;
}
&::before {
right: 4.6rem;
}
} }
.col { .col {

19
src/Squidex/app/features/schemas/pages/schema/field.component.ts

@ -13,6 +13,7 @@ import {
createProperties, createProperties,
fadeAnimation, fadeAnimation,
FieldDto, FieldDto,
FieldPropertiesDto,
ModalView, ModalView,
SchemaDto SchemaDto
} from 'shared'; } from 'shared';
@ -45,7 +46,7 @@ export class FieldComponent implements OnInit {
public showing = new EventEmitter(); public showing = new EventEmitter();
@Output() @Output()
public saving = new EventEmitter(); public saving = new EventEmitter<FieldPropertiesDto>();
@Output() @Output()
public enabling = new EventEmitter(); public enabling = new EventEmitter();
@ -107,22 +108,12 @@ export class FieldComponent implements OnInit {
if (this.editForm.valid) { if (this.editForm.valid) {
const properties = createProperties(this.field.properties['fieldType'], this.editForm.value); const properties = createProperties(this.field.properties['fieldType'], this.editForm.value);
const field = this.emitSaving(properties);
new FieldDto(
this.field.fieldId,
this.field.name,
this.field.isLocked,
this.field.isHidden,
this.field.isHidden,
this.field.partitioning,
properties);
this.emitSaving(field);
} }
} }
private emitSaving(field: FieldDto) { private emitSaving(properties: FieldPropertiesDto) {
this.saving.emit(field); this.saving.emit(properties);
} }
private resetEditForm() { private resetEditForm() {

2
src/Squidex/app/features/schemas/pages/schema/schema-page.component.html

@ -69,7 +69,7 @@
(locking)="lockField(field)" (locking)="lockField(field)"
(showing)="showField(field)" (showing)="showField(field)"
(hiding)="hideField(field)" (hiding)="hideField(field)"
(saving)="saveField($event)"></sqx-field> (saving)="saveField(field, $event)"></sqx-field>
</div> </div>
<div class="table-items-footer"> <div class="table-items-footer">

5
src/Squidex/app/features/schemas/pages/schema/schema-page.component.ts

@ -18,6 +18,7 @@ import {
createProperties, createProperties,
fadeAnimation, fadeAnimation,
FieldDto, FieldDto,
FieldPropertiesDto,
fieldTypes, fieldTypes,
HistoryChannelUpdated, HistoryChannelUpdated,
ImmutableArray, ImmutableArray,
@ -213,12 +214,12 @@ export class SchemaPageComponent implements OnDestroy, OnInit {
}); });
} }
public saveField(field: FieldDto) { public saveField(field: FieldDto, properties: FieldPropertiesDto) {
const requestDto = new UpdateFieldDto(field.properties); const requestDto = new UpdateFieldDto(field.properties);
this.schemasService.putField(this.ctx.appName, this.schema.name, field.fieldId, requestDto, this.schema.version) this.schemasService.putField(this.ctx.appName, this.schema.name, field.fieldId, requestDto, this.schema.version)
.subscribe(dto => { .subscribe(dto => {
this.updateSchema(this.schema.updateField(field, this.ctx.userToken, dto.version)); this.updateSchema(this.schema.updateField(field.update(properties), this.ctx.userToken, dto.version));
}, error => { }, error => {
this.ctx.notifyError(error); this.ctx.notifyError(error);
}); });

8
src/Squidex/app/features/settings/pages/languages/languages-page.component.scss

@ -1,2 +1,8 @@
@import '_vars'; @import '_vars';
@import '_mixins'; @import '_mixins';
.table-item-row-details {
&::before {
right: 5.2rem;
}
}
Loading…
Cancel
Save