allow create empty
This commit is contained in:
@@ -11,8 +11,16 @@ import { Subject, debounceTime } from '@umbraco-cms/backoffice/external/rxjs';
|
||||
|
||||
@customElement('umb-partial-views-workspace-edit')
|
||||
export class UmbPartialViewsWorkspaceEditElement extends UmbLitElement {
|
||||
#name: string | undefined = '';
|
||||
@state()
|
||||
private _name?: string | null = '';
|
||||
private get _name() {
|
||||
return this.#name;
|
||||
}
|
||||
|
||||
private set _name(value) {
|
||||
this.#name = value?.replace('.cshtml', '');
|
||||
this.requestUpdate();
|
||||
}
|
||||
|
||||
@state()
|
||||
private _content?: string | null = '';
|
||||
@@ -64,7 +72,7 @@ export class UmbPartialViewsWorkspaceEditElement extends UmbLitElement {
|
||||
});
|
||||
|
||||
this.inputQuery$.pipe(debounceTime(250)).subscribe((nameInputValue: string) => {
|
||||
this.#partialViewsWorkspaceContext?.setName(nameInputValue);
|
||||
this.#partialViewsWorkspaceContext?.setName(`${nameInputValue}.cshtml`);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -19,7 +19,14 @@ export class UmbPartialViewsWorkspaceContext extends UmbWorkspaceContext<UmbPart
|
||||
if (!partialView)
|
||||
return Promise.reject('Something went wrong, there is no data for partial view you want to save...');
|
||||
if (this.getIsNew()) {
|
||||
//this.repository.create()
|
||||
|
||||
const createRequestBody = {
|
||||
name: partialView.name,
|
||||
content: partialView.content,
|
||||
parentPath: partialView.path + '/',
|
||||
}
|
||||
|
||||
this.repository.create(createRequestBody)
|
||||
console.log('create');
|
||||
return Promise.resolve();
|
||||
}
|
||||
@@ -80,7 +87,6 @@ export class UmbPartialViewsWorkspaceContext extends UmbWorkspaceContext<UmbPart
|
||||
|
||||
async create(parentKey: string | null, name = 'Empty') {
|
||||
const { data } = await this.repository.createScaffold(parentKey, name);
|
||||
debugger;
|
||||
const newPartial = {
|
||||
...data,
|
||||
name: '',
|
||||
|
||||
Reference in New Issue
Block a user