@@ -8,6 +8,7 @@ import type { UmbRoutableWorkspaceContext, UmbSubmittableWorkspaceContext } from
8
8
import {
9
9
UmbEntityDetailWorkspaceContextBase ,
10
10
UmbWorkspaceIsNewRedirectController ,
11
+ UmbWorkspaceIsNewRedirectControllerAlias ,
11
12
} from '@umbraco-cms/backoffice/workspace' ;
12
13
import { UmbObjectState } from '@umbraco-cms/backoffice/observable-api' ;
13
14
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api' ;
@@ -43,7 +44,7 @@ export class UmbTemplateWorkspaceContext
43
44
setup : ( component : PageComponent , info : IRoutingInfo ) => {
44
45
const parentEntityType = info . match . params . entityType ;
45
46
const parentUnique = info . match . params . parentUnique === 'null' ? null : info . match . params . parentUnique ;
46
- this . createScaffold ( { parent : { entityType : parentEntityType , unique : parentUnique } } ) ;
47
+ this . create ( { entityType : parentEntityType , unique : parentUnique } ) ;
47
48
48
49
new UmbWorkspaceIsNewRedirectController (
49
50
this ,
@@ -56,13 +57,32 @@ export class UmbTemplateWorkspaceContext
56
57
path : 'edit/:unique' ,
57
58
component : UmbTemplateWorkspaceEditorElement ,
58
59
setup : ( component : PageComponent , info : IRoutingInfo ) : void => {
60
+ this . removeUmbControllerByAlias ( UmbWorkspaceIsNewRedirectControllerAlias ) ;
59
61
const unique = info . match . params . unique ;
60
62
this . load ( unique ) ;
61
63
} ,
62
64
} ,
63
65
] ) ;
64
66
}
65
67
68
+ override async load ( unique : string ) {
69
+ const response = await super . load ( unique ) ;
70
+ if ( response . data ) {
71
+ this . setMasterTemplate ( response . data . masterTemplate ?. unique ?? null ) ;
72
+ }
73
+ return response ;
74
+ }
75
+
76
+ async create ( parent : any ) {
77
+ const data = await this . createScaffold ( { parent } ) ;
78
+
79
+ if ( data ) {
80
+ if ( ! parent ) return ;
81
+ await this . setMasterTemplate ( parent . unique ) ;
82
+ }
83
+ return data ;
84
+ }
85
+
66
86
setName ( value : string ) {
67
87
this . _data . updateCurrent ( { name : value } ) ;
68
88
}
0 commit comments