1
1
import { UMB_DOCUMENT_BLUEPRINT_FOLDER_REPOSITORY_ALIAS } from '../../../tree/folder/manifests.js' ;
2
+ import { UmbDocumentBlueprintFolderRepository } from '../../../tree/index.js' ;
2
3
import type {
3
4
UmbDocumentBlueprintOptionsCreateModalData ,
4
5
UmbDocumentBlueprintOptionsCreateModalValue ,
5
6
} from './index.js' ;
6
7
import { UmbTextStyles } from '@umbraco-cms/backoffice/style' ;
7
- import { html , customElement , css } from '@umbraco-cms/backoffice/external/lit' ;
8
+ import { html , customElement , css , state } from '@umbraco-cms/backoffice/external/lit' ;
8
9
import { UmbModalBaseElement } from '@umbraco-cms/backoffice/modal' ;
9
10
import { type UmbSelectedEvent , UmbSelectionChangeEvent } from '@umbraco-cms/backoffice/event' ;
10
11
import { UmbCreateFolderEntityAction , type UmbTreeElement } from '@umbraco-cms/backoffice/tree' ;
@@ -14,12 +15,24 @@ export class UmbDocumentBlueprintOptionsCreateModalElement extends UmbModalBaseE
14
15
UmbDocumentBlueprintOptionsCreateModalData ,
15
16
UmbDocumentBlueprintOptionsCreateModalValue
16
17
> {
18
+ @state ( )
19
+ private _parentName ?: string ;
20
+
17
21
#createFolderAction?: UmbCreateFolderEntityAction ;
18
22
19
- override connectedCallback ( ) : void {
23
+ #itemRepository = new UmbDocumentBlueprintFolderRepository ( this ) ;
24
+
25
+ override async connectedCallback ( ) : Promise < void > {
20
26
super . connectedCallback ( ) ;
21
27
if ( ! this . data ?. parent ) throw new Error ( 'A parent is required to create a folder' ) ;
22
28
29
+ if ( this . data . parent . unique ) {
30
+ const { data : parent } = await this . #itemRepository. request ( this . data . parent . unique . toString ( ) ) ;
31
+ this . _parentName = parent ?. name ?? this . localize . term ( 'general_unknown' ) ;
32
+ } else {
33
+ this . _parentName = this . localize . term ( 'treeHeaders_contentBlueprints' ) ;
34
+ }
35
+
23
36
// TODO: render the info from this instance in the list of actions
24
37
this . #createFolderAction = new UmbCreateFolderEntityAction ( this , {
25
38
unique : this . data . parent . unique ,
@@ -54,7 +67,7 @@ export class UmbDocumentBlueprintOptionsCreateModalElement extends UmbModalBaseE
54
67
override render ( ) {
55
68
return html `
56
69
<umb- body- layout headline= ${ this . localize . term ( 'actions_createblueprint' ) } >
57
- <uui- box headline= "Create a folder under Content Templates" >
70
+ <uui- box headline= ${ this . localize . term ( 'blueprints_createBlueprintFolderUnder' , this . _parentName ) } >
58
71
<uui- menu- item @click = ${ this . #onCreateFolderClick} label= "New Folder..." >
59
72
<uui- icon slot= "icon" name = "icon-folder" > </ uui- icon>
60
73
</ uui- menu- item>
0 commit comments