-
+
-
+
+
+
diff --git a/src/Squidex/app/features/content/pages/content/content-page.component.ts b/src/Squidex/app/features/content/pages/content/content-page.component.ts
index 519bd5fbf..51291114e 100644
--- a/src/Squidex/app/features/content/pages/content/content-page.component.ts
+++ b/src/Squidex/app/features/content/pages/content/content-page.component.ts
@@ -156,12 +156,7 @@ export class ContentPageComponent extends ResourceOwner implements CanComponentD
}
public canDeactivate(): Observable {
- const observable =
- this.contentForm.hasChanged() ?
- this.dialogs.confirm('Unsaved changes', 'You have unsaved changes, do you want to close the current content view and discard your changes?') :
- of(true);
-
- return observable.pipe(
+ return this.checkPendingChanges('close current content view').pipe(
tap(confirmed => {
if (confirmed) {
this.autoSaveService.remove(this.autoSaveKey);
@@ -225,7 +220,7 @@ export class ContentPageComponent extends ResourceOwner implements CanComponentD
});
}
} else {
- this.dialogs.notifyError('Content element not valid, please check the field with the red bar on the left in all languages (if localizable).');
+ this.contentForm.submitFailed('Content element not valid, please check the field with the red bar on the left in all languages (if localizable).');
}
}
@@ -253,17 +248,29 @@ export class ContentPageComponent extends ResourceOwner implements CanComponentD
}
public publishChanges() {
- this.dueTimeSelector.selectDueTime('Publish').pipe(
- switchMap(d => this.contentsState.publishDraft(this.content, d)), onErrorResumeNext())
+ this.checkPendingChanges('publish your changes').pipe(
+ filter(x => !!x),
+ switchMap(_ => this.dueTimeSelector.selectDueTime(status)),
+ switchMap(d => this.contentsState.publishDraft(this.content, d)),
+ onErrorResumeNext())
.subscribe();
}
public changeStatus(status: string) {
- this.dueTimeSelector.selectDueTime(status).pipe(
- switchMap(d => this.contentsState.changeStatus(this.content, status, d)), onErrorResumeNext())
+ this.checkPendingChanges('change the status').pipe(
+ filter(x => !!x),
+ switchMap(_ => this.dueTimeSelector.selectDueTime(status)),
+ switchMap(d => this.contentsState.changeStatus(this.content, status, d)),
+ onErrorResumeNext())
.subscribe();
}
+ private checkPendingChanges(action: string) {
+ return this.contentForm.hasChanged() ?
+ this.dialogs.confirm('Unsaved changes', `You have unsaved changes. When you ${action} you will loose them. Do you want to continue anyway?`) :
+ of(true);
+ }
+
public showLatest() {
this.loadVersion(null, false);
}
diff --git a/src/Squidex/app/features/schemas/pages/schemas/schema-form.component.html b/src/Squidex/app/features/schemas/pages/schemas/schema-form.component.html
index 629e5fd70..de27923b4 100644
--- a/src/Squidex/app/features/schemas/pages/schemas/schema-form.component.html
+++ b/src/Squidex/app/features/schemas/pages/schemas/schema-form.component.html
@@ -11,7 +11,7 @@
-
+
diff --git a/src/Squidex/app/framework/angular/forms/form-error.component.ts b/src/Squidex/app/framework/angular/forms/form-error.component.ts
index 40aeaf3fe..720b8bc94 100644
--- a/src/Squidex/app/framework/angular/forms/form-error.component.ts
+++ b/src/Squidex/app/framework/angular/forms/form-error.component.ts
@@ -5,19 +5,44 @@
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/
-import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
+import { ChangeDetectionStrategy, Component, Input, OnChanges, SimpleChanges } from '@angular/core';
import { ErrorDto } from '@app/framework/internal';
@Component({
selector: 'sqx-form-error',
template: `
-
-
+
+