Browse Source

Small UI fixes.

pull/337/head
Sebastian Stehle 8 years ago
parent
commit
b09b7d6d67
  1. 12
      src/Squidex/app/features/schemas/pages/schema/forms/field-form-common.component.ts
  2. 2
      src/Squidex/app/features/settings/pages/roles/roles-page.component.ts

12
src/Squidex/app/features/schemas/pages/schema/forms/field-form-common.component.ts

@ -5,7 +5,7 @@
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/ */
import { Component, Input, OnChanges } from '@angular/core'; import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';
import { FormControl, FormGroup } from '@angular/forms'; import { FormControl, FormGroup } from '@angular/forms';
import { FieldDto } from '@app/shared'; import { FieldDto } from '@app/shared';
@ -15,7 +15,7 @@ import { FieldDto } from '@app/shared';
styleUrls: ['field-form-common.component.scss'], styleUrls: ['field-form-common.component.scss'],
templateUrl: 'field-form-common.component.html' templateUrl: 'field-form-common.component.html'
}) })
export class FieldFormCommonComponent implements OnChanges { export class FieldFormCommonComponent implements OnChanges, OnInit {
@Input() @Input()
public editForm: FormGroup; public editForm: FormGroup;
@ -28,7 +28,7 @@ export class FieldFormCommonComponent implements OnChanges {
@Input() @Input()
public field: FieldDto; public field: FieldDto;
public ngOnChanges() { public ngOnInit() {
this.editForm.setControl('isRequired', this.editForm.setControl('isRequired',
new FormControl(this.field.properties.isRequired)); new FormControl(this.field.properties.isRequired));
@ -47,4 +47,10 @@ export class FieldFormCommonComponent implements OnChanges {
this.editForm.setControl('label', this.editForm.setControl('label',
new FormControl(this.field.properties.label)); new FormControl(this.field.properties.label));
} }
public ngOnChanges(changes: SimpleChanges) {
if (changes['field']) {
this.editForm.reset(this.field.properties);
}
}
} }

2
src/Squidex/app/features/settings/pages/roles/roles-page.component.ts

@ -67,7 +67,7 @@ export class RolesPageComponent implements OnInit {
if (value) { if (value) {
this.rolesState.add(value) this.rolesState.add(value)
.subscribe(() => { .subscribe(() => {
this.addRoleForm.submitCompleted(); this.addRoleForm.submitCompleted({});
}, error => { }, error => {
this.addRoleForm.submitFailed(error); this.addRoleForm.submitFailed(error);
}); });

Loading…
Cancel
Save