Skip to content

Commit 8899375

Browse files
Merge branch 'main' into bugfix/v14/user-startnode-and-user-groups-links
2 parents d3fc680 + 877b5a9 commit 8899375

File tree

2 files changed

+77
-22
lines changed

2 files changed

+77
-22
lines changed

src/packages/documents/documents/entity-actions/create/document-create-options-modal.element.ts

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,16 @@ export class UmbDocumentCreateOptionsModalElement extends UmbModalBaseElement<
118118
render() {
119119
return html`
120120
<umb-body-layout headline=${this.localize.term('actions_create')}>
121-
${this._availableBlueprints.length && this.#documentTypeUnique
122-
? this.#renderBlueprints()
123-
: this.#renderDocumentTypes()}
124-
<uui-button slot="actions" id="cancel" label="Cancel" @click="${this._rejectModal}"></uui-button>
121+
${when(
122+
this._availableBlueprints.length === 0 && this.#documentTypeUnique,
123+
() => this.#renderBlueprints(),
124+
() => this.#renderDocumentTypes(),
125+
)}
126+
<uui-button
127+
slot="actions"
128+
id="cancel"
129+
label=${this.localize.term('general_cancel')}
130+
@click="${this._rejectModal}"></uui-button>
125131
</umb-body-layout>
126132
`;
127133
}
@@ -134,8 +140,14 @@ export class UmbDocumentCreateOptionsModalElement extends UmbModalBaseElement<
134140
<umb-localize key="create_noDocumentTypes">
135141
There are no allowed Document Types available for creating content here. You must enable these in
136142
<strong>Document Types</strong> within the <strong>Settings</strong> section, by editing the
137-
<strong>Allowed child node types</strong> under <strong>Permissions</strong>
143+
<strong>Allowed child node types</strong> under <strong>Permissions</strong>.<br />
138144
</umb-localize>
145+
<uui-button
146+
id="edit-permissions"
147+
look="secondary"
148+
@click=${() => this._rejectModal()}
149+
href=${`/section/settings/workspace/document-type/edit/${this.data?.documentType?.unique}/view/structure`}
150+
label=${this.localize.term('create_noDocumentTypesEditPermissions')}></uui-button>
139151
`,
140152
() =>
141153
repeat(
@@ -145,7 +157,7 @@ export class UmbDocumentCreateOptionsModalElement extends UmbModalBaseElement<
145157
html` <uui-ref-node-document-type
146158
data-id=${ifDefined(documentType.unique)}
147159
.name=${documentType.name}
148-
.alias=${documentType.description}
160+
.alias=${documentType.description ?? ''}
149161
select-only
150162
selectable
151163
@selected=${() => this.#onSelectDocumentType(documentType.unique)}>
@@ -183,6 +195,10 @@ export class UmbDocumentCreateOptionsModalElement extends UmbModalBaseElement<
183195
#blank {
184196
border-bottom: 1px solid var(--uui-color-border);
185197
}
198+
199+
#edit-permissions {
200+
margin-top: var(--uui-size-6);
201+
}
186202
`,
187203
];
188204
}

src/packages/media/media/entity-actions/create/media-create-options-modal.element.ts

Lines changed: 55 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,19 @@ import type {
33
UmbMediaCreateOptionsModalData,
44
UmbMediaCreateOptionsModalValue,
55
} from './media-create-options-modal.token.js';
6-
import { html, nothing, customElement, state, ifDefined } from '@umbraco-cms/backoffice/external/lit';
6+
import {
7+
html,
8+
nothing,
9+
customElement,
10+
state,
11+
ifDefined,
12+
repeat,
13+
css,
14+
when,
15+
} from '@umbraco-cms/backoffice/external/lit';
716
import { UmbModalBaseElement } from '@umbraco-cms/backoffice/modal';
817
import { UmbMediaTypeStructureRepository, type UmbAllowedMediaTypeModel } from '@umbraco-cms/backoffice/media-type';
18+
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
919

1020
@customElement('umb-media-create-options-modal')
1121
export class UmbMediaCreateOptionsModalElement extends UmbModalBaseElement<
@@ -63,21 +73,10 @@ export class UmbMediaCreateOptionsModalElement extends UmbModalBaseElement<
6373
return html`
6474
<umb-body-layout headline=${this._headline ?? ''}>
6575
<uui-box>
66-
${this._allowedMediaTypes.length === 0
67-
? html`<umb-localize key="create_noMediaTypes"></umb-localize>`
68-
: nothing}
69-
${this._allowedMediaTypes.map(
70-
(mediaType) => html`
71-
<uui-ref-node-document-type
72-
data-id=${ifDefined(mediaType.unique)}
73-
.name=${mediaType.name}
74-
.alias=${mediaType.description}
75-
select-only
76-
selectable
77-
@selected=${() => this.#onNavigate(mediaType)}>
78-
${mediaType.icon ? html`<umb-icon slot="icon" name=${mediaType.icon}></umb-icon>` : nothing}
79-
</uui-ref-node-document-type>
80-
`,
76+
${when(
77+
this._allowedMediaTypes.length === 0,
78+
() => this.#renderNotAllowed(),
79+
() => this.#renderAllowedMediaTypes(),
8180
)}
8281
</uui-box>
8382
<uui-button
@@ -88,6 +87,46 @@ export class UmbMediaCreateOptionsModalElement extends UmbModalBaseElement<
8887
</umb-body-layout>
8988
`;
9089
}
90+
91+
#renderNotAllowed() {
92+
return html`<umb-localize key="create_noMediaTypes">
93+
There are no allowed Media Types available for creating media here. You must enable these in
94+
<strong>Media Types</strong> within the <strong>Settings</strong> section, by editing the
95+
<strong>Allowed child node types</strong> under <strong>Permissions</strong>. </umb-localize
96+
><br />
97+
<uui-button
98+
id="edit-permissions"
99+
look="secondary"
100+
@click=${() => this._rejectModal()}
101+
href=${`/section/settings/workspace/media-type/edit/${this.data?.mediaType?.unique}/view/structure`}
102+
label=${this.localize.term('create_noMediaTypesEditPermissions')}></uui-button>`;
103+
}
104+
105+
#renderAllowedMediaTypes() {
106+
return repeat(
107+
this._allowedMediaTypes,
108+
(mediaType) => mediaType.unique,
109+
(mediaType) =>
110+
html`<uui-ref-node-document-type
111+
data-id=${ifDefined(mediaType.unique)}
112+
.name=${mediaType.name}
113+
.alias=${mediaType.description ?? ''}
114+
select-only
115+
selectable
116+
@selected=${() => this.#onNavigate(mediaType)}>
117+
${mediaType.icon ? html`<umb-icon slot="icon" name=${mediaType.icon}></umb-icon>` : nothing}
118+
</uui-ref-node-document-type>`,
119+
);
120+
}
121+
122+
static styles = [
123+
UmbTextStyles,
124+
css`
125+
#edit-permissions {
126+
margin-top: var(--uui-size-6);
127+
}
128+
`,
129+
];
91130
}
92131

93132
export default UmbMediaCreateOptionsModalElement;

0 commit comments

Comments
 (0)