diff --git a/backend/i18n/frontend_en.json b/backend/i18n/frontend_en.json
index 124cf6711..f53888ca6 100644
--- a/backend/i18n/frontend_en.json
+++ b/backend/i18n/frontend_en.json
@@ -424,6 +424,7 @@
"contents.draftNew": "New Draft",
"contents.draftStatus": "New Version",
"contents.editPageTitle": "Edit Content",
+ "contents.idPlaceholder": "Define a custom ID or leave empty to let Squidex generate one.",
"contents.invariantFieldDescription": "The '{fieldName}' field of the content item.",
"contents.languageModeAll": "All Languages",
"contents.languageModeSingle": "Single Language",
diff --git a/backend/i18n/frontend_it.json b/backend/i18n/frontend_it.json
index 097f3494a..b5c29a7bc 100644
--- a/backend/i18n/frontend_it.json
+++ b/backend/i18n/frontend_it.json
@@ -424,6 +424,7 @@
"contents.draftNew": "Nuova bozza",
"contents.draftStatus": "Nuova versione",
"contents.editPageTitle": "Modifica contenuto",
+ "contents.idPlaceholder": "Define a custom ID or leave empty to let Squidex generate one.",
"contents.invariantFieldDescription": "Il campo '{fieldName}' del contenuto.",
"contents.languageModeAll": "Tutte le lingue",
"contents.languageModeSingle": "Una sola lingua",
diff --git a/backend/i18n/frontend_nl.json b/backend/i18n/frontend_nl.json
index 21744908b..65e36a015 100644
--- a/backend/i18n/frontend_nl.json
+++ b/backend/i18n/frontend_nl.json
@@ -424,6 +424,7 @@
"contents.draftNew": "Nieuw concept",
"contents.draftStatus": "Nieuwe versie",
"contents.editPageTitle": "Inhoud bewerken",
+ "contents.idPlaceholder": "Define a custom ID or leave empty to let Squidex generate one.",
"contents.invariantFieldDescription": "Het veld '{fieldName}' van het inhoudsitem.",
"contents.languageModeAll": "Alle talen",
"contents.languageModeSingle": "Enkele taal",
diff --git a/backend/i18n/frontend_zh.json b/backend/i18n/frontend_zh.json
index 052bab327..3c7b9f462 100644
--- a/backend/i18n/frontend_zh.json
+++ b/backend/i18n/frontend_zh.json
@@ -424,6 +424,7 @@
"contents.draftNew": "新草稿",
"contents.draftStatus": "新版本",
"contents.editPageTitle": "编辑内容",
+ "contents.idPlaceholder": "Define a custom ID or leave empty to let Squidex generate one.",
"contents.invariantFieldDescription": "内容项的 '{fieldName}' 字段。",
"contents.languageModeAll": "所有语言",
"contents.languageModeSingle": "单一语言",
diff --git a/backend/i18n/source/frontend_en.json b/backend/i18n/source/frontend_en.json
index 124cf6711..f53888ca6 100644
--- a/backend/i18n/source/frontend_en.json
+++ b/backend/i18n/source/frontend_en.json
@@ -424,6 +424,7 @@
"contents.draftNew": "New Draft",
"contents.draftStatus": "New Version",
"contents.editPageTitle": "Edit Content",
+ "contents.idPlaceholder": "Define a custom ID or leave empty to let Squidex generate one.",
"contents.invariantFieldDescription": "The '{fieldName}' field of the content item.",
"contents.languageModeAll": "All Languages",
"contents.languageModeSingle": "Single Language",
diff --git a/frontend/app/features/content/pages/content/content-page.component.html b/frontend/app/features/content/pages/content/content-page.component.html
index 239a75bb6..228259932 100644
--- a/frontend/app/features/content/pages/content/content-page.component.html
+++ b/frontend/app/features/content/pages/content/content-page.component.html
@@ -130,6 +130,7 @@
x['tab'] || 'editor'));
public content?: ContentDto | null;
+ public contentId = '';
public contentVersion: Version | null;
public contentForm: EditContentForm;
public contentFormCompare: EditContentForm | null = null;
@@ -180,7 +181,7 @@ export class ContentPageComponent extends ResourceOwner implements CanComponentD
return;
}
- this.contentsState.create(value, publish)
+ this.contentsState.create(value, publish, this.contentId)
.subscribe({
next: content => {
this.contentForm.submitCompleted({ noReset: true });
@@ -219,6 +220,10 @@ export class ContentPageComponent extends ResourceOwner implements CanComponentD
}
}
+ public setContentId(id: string) {
+ this.contentId = id;
+ }
+
public checkPendingChangesBeforePreview() {
return this.checkPendingChanges('i18n:contents.pendingChangesTextToPreview');
}
diff --git a/frontend/app/features/content/pages/content/editor/content-editor.component.html b/frontend/app/features/content/pages/content/editor/content-editor.component.html
index eecd91245..c363b3598 100644
--- a/frontend/app/features/content/pages/content/editor/content-editor.component.html
+++ b/frontend/app/features/content/pages/content/editor/content-editor.component.html
@@ -7,6 +7,12 @@
+
+
+
+
diff --git a/frontend/app/features/content/pages/content/editor/content-editor.component.scss b/frontend/app/features/content/pages/content/editor/content-editor.component.scss
index b93b8e929..ee8728272 100644
--- a/frontend/app/features/content/pages/content/editor/content-editor.component.scss
+++ b/frontend/app/features/content/pages/content/editor/content-editor.component.scss
@@ -10,4 +10,10 @@
border: 0;
border-radius: 0;
margin: 0;
+}
+
+.form-control {
+ border-radius: 0;
+ border-width: 0;
+ border-bottom-width: 1px;
}
\ No newline at end of file
diff --git a/frontend/app/features/content/pages/content/editor/content-editor.component.ts b/frontend/app/features/content/pages/content/editor/content-editor.component.ts
index ffd570502..0e9e8b76a 100644
--- a/frontend/app/features/content/pages/content/editor/content-editor.component.ts
+++ b/frontend/app/features/content/pages/content/editor/content-editor.component.ts
@@ -9,7 +9,7 @@ import { Component, EventEmitter, Input, Output } from '@angular/core';
import { AppLanguageDto, EditContentForm, FieldForm, FieldSection, RootFieldDto, SchemaDto, Version } from '@app/shared';
@Component({
- selector: 'sqx-content-editor[contentForm][formContext][language][languages][schema]',
+ selector: 'sqx-content-editor[contentId][contentForm][formContext][language][languages][schema]',
styleUrls: ['./content-editor.component.scss'],
templateUrl: './content-editor.component.html',
})
@@ -20,6 +20,15 @@ export class ContentEditorComponent {
@Output()
public loadLatest = new EventEmitter();
+ @Output()
+ public contentIdChange = new EventEmitter();
+
+ @Input()
+ public isNew = false;
+
+ @Input()
+ public contentId: string;
+
@Input()
public contentForm: EditContentForm;
diff --git a/frontend/app/shared/services/contents.service.spec.ts b/frontend/app/shared/services/contents.service.spec.ts
index 60b7d52cb..73c834f6f 100644
--- a/frontend/app/shared/services/contents.service.spec.ts
+++ b/frontend/app/shared/services/contents.service.spec.ts
@@ -122,11 +122,11 @@ describe('ContentsService', () => {
let content: ContentDto;
- contentsService.postContent('my-app', 'my-schema', dto, true).subscribe(result => {
+ contentsService.postContent('my-app', 'my-schema', dto, true, 'my-id').subscribe(result => {
content = result;
});
- const req = httpMock.expectOne('http://service/p/api/content/my-app/my-schema?publish=true');
+ const req = httpMock.expectOne('http://service/p/api/content/my-app/my-schema?publish=true&id=my-id');
expect(req.request.method).toEqual('POST');
expect(req.request.headers.get('If-Match')).toBeNull();
diff --git a/frontend/app/shared/services/contents.service.ts b/frontend/app/shared/services/contents.service.ts
index a42e930b6..f5e20a13e 100644
--- a/frontend/app/shared/services/contents.service.ts
+++ b/frontend/app/shared/services/contents.service.ts
@@ -225,10 +225,10 @@ export class ContentsService {
pretifyError('i18n:contents.loadDataFailed'));
}
- public postContent(appName: string, schemaName: string, dto: any, publish: boolean): Observable {
- const url = this.apiUrl.buildUrl(`/api/content/${appName}/${schemaName}?publish=${publish}`);
+ public postContent(appName: string, schemaName: string, data: any, publish: boolean, id?: string): Observable {
+ const url = this.apiUrl.buildUrl(`/api/content/${appName}/${schemaName}?publish=${publish}&id=${id}`);
- return HTTP.postVersioned(this.http, url, dto).pipe(
+ return HTTP.postVersioned(this.http, url, data).pipe(
map(({ payload }) => {
return parseContent(payload.body);
}),
diff --git a/frontend/app/shared/state/contents.state.ts b/frontend/app/shared/state/contents.state.ts
index 6e0cb5313..b22f23850 100644
--- a/frontend/app/shared/state/contents.state.ts
+++ b/frontend/app/shared/state/contents.state.ts
@@ -219,8 +219,8 @@ export abstract class ContentsStateBase extends State {
shareSubscribed(this.dialogs));
}
- public create(request: any, publish: boolean): Observable {
- return this.contentsService.postContent(this.appName, this.schemaName, request, publish).pipe(
+ public create(data: any, publish: boolean, id?: string): Observable {
+ return this.contentsService.postContent(this.appName, this.schemaName, data, publish, id).pipe(
tap(payload => {
this.dialogs.notifyInfo('i18n:contents.created');