create empty partial
This commit is contained in:
@@ -7,6 +7,6 @@ export class UmbCreateEmptyPartialViewAction<T extends { copy(): Promise<void> }
|
||||
}
|
||||
|
||||
async execute() {
|
||||
throw new Error('Method not implemented.');
|
||||
history.pushState(null, '', `section/settings/workspace/partial-view/create/${this.unique ?? 'null'}/`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
import { UmbEntityActionBase } from '@umbraco-cms/backoffice/entity-action';
|
||||
import { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api';
|
||||
import { UmbPartialViewsRepository } from '../../repository/index.js';
|
||||
|
||||
export class UmbCreateFromSnippetPartialViewAction<T extends { copy(): Promise<void> }> extends UmbEntityActionBase<T> {
|
||||
export class UmbCreateFromSnippetPartialViewAction<
|
||||
T extends { copy(): Promise<void> }
|
||||
> extends UmbEntityActionBase<UmbPartialViewsRepository> {
|
||||
constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) {
|
||||
super(host, repositoryAlias, unique);
|
||||
}
|
||||
|
||||
async execute() {
|
||||
throw new Error('Method not implemented.');
|
||||
const snippets = await this.repository?.getSnippets({});
|
||||
console.log(snippets);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,10 +6,7 @@ import { UmbWorkspaceContext } from '@umbraco-cms/backoffice/workspace';
|
||||
import { loadCodeEditor } from '@umbraco-cms/backoffice/code-editor';
|
||||
import { UpdatePartialViewRequestModel } from '@umbraco-cms/backoffice/backend-api';
|
||||
|
||||
export class UmbPartialViewsWorkspaceContext extends UmbWorkspaceContext<
|
||||
UmbPartialViewsRepository,
|
||||
PartialViewDetails
|
||||
> {
|
||||
export class UmbPartialViewsWorkspaceContext extends UmbWorkspaceContext<UmbPartialViewsRepository, PartialViewDetails> {
|
||||
getEntityId(): string | undefined {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
@@ -81,10 +78,16 @@ export class UmbPartialViewsWorkspaceContext extends UmbWorkspaceContext<
|
||||
}
|
||||
}
|
||||
|
||||
async create(parentKey: string | null, name = 'empty') {
|
||||
async create(parentKey: string | null, name = 'Empty') {
|
||||
const { data } = await this.repository.createScaffold(parentKey, name);
|
||||
debugger;
|
||||
const newPartial = {
|
||||
...data,
|
||||
name: '',
|
||||
path: parentKey ?? '',
|
||||
};
|
||||
if (!data) return;
|
||||
this.setIsNew(true);
|
||||
this.#data.next(data);
|
||||
this.#data.next(newPartial);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,9 +22,10 @@ export class UmbPartialViewsWorkspaceElement extends UmbLitElement {
|
||||
component: () => this.#element,
|
||||
setup: async (component: PageComponent, info: IRoutingInfo) => {
|
||||
const parentKey = info.match.params.parentKey;
|
||||
const decodePath = decodeURIComponent(parentKey).replace('-cshtml', '.cshtml');
|
||||
const decodePath = decodeURIComponent(parentKey);
|
||||
const snippetName = 'Empty';
|
||||
|
||||
this.#partialViewsWorkspaceContext.create(parentKey);
|
||||
this.#partialViewsWorkspaceContext.create(parentKey === 'null' ? null : parentKey, snippetName);
|
||||
|
||||
new UmbWorkspaceIsNewRedirectController(
|
||||
this,
|
||||
|
||||
Reference in New Issue
Block a user