Merge branch 'main' into bugfix/v14/user-startnode-and-user-groups-links

This commit is contained in:
Mads Rasmussen
2024-06-17 12:21:36 +02:00
committed by GitHub
2 changed files with 77 additions and 22 deletions

View File

@@ -118,10 +118,16 @@ export class UmbDocumentCreateOptionsModalElement extends UmbModalBaseElement<
render() {
return html`
<umb-body-layout headline=${this.localize.term('actions_create')}>
${this._availableBlueprints.length && this.#documentTypeUnique
? this.#renderBlueprints()
: this.#renderDocumentTypes()}
<uui-button slot="actions" id="cancel" label="Cancel" @click="${this._rejectModal}"></uui-button>
${when(
this._availableBlueprints.length === 0 && this.#documentTypeUnique,
() => this.#renderBlueprints(),
() => this.#renderDocumentTypes(),
)}
<uui-button
slot="actions"
id="cancel"
label=${this.localize.term('general_cancel')}
@click="${this._rejectModal}"></uui-button>
</umb-body-layout>
`;
}
@@ -134,8 +140,14 @@ export class UmbDocumentCreateOptionsModalElement extends UmbModalBaseElement<
<umb-localize key="create_noDocumentTypes">
There are no allowed Document Types available for creating content here. You must enable these in
<strong>Document Types</strong> within the <strong>Settings</strong> section, by editing the
<strong>Allowed child node types</strong> under <strong>Permissions</strong>
<strong>Allowed child node types</strong> under <strong>Permissions</strong>.<br />
</umb-localize>
<uui-button
id="edit-permissions"
look="secondary"
@click=${() => this._rejectModal()}
href=${`/section/settings/workspace/document-type/edit/${this.data?.documentType?.unique}/view/structure`}
label=${this.localize.term('create_noDocumentTypesEditPermissions')}></uui-button>
`,
() =>
repeat(
@@ -145,7 +157,7 @@ export class UmbDocumentCreateOptionsModalElement extends UmbModalBaseElement<
html` <uui-ref-node-document-type
data-id=${ifDefined(documentType.unique)}
.name=${documentType.name}
.alias=${documentType.description}
.alias=${documentType.description ?? ''}
select-only
selectable
@selected=${() => this.#onSelectDocumentType(documentType.unique)}>
@@ -183,6 +195,10 @@ export class UmbDocumentCreateOptionsModalElement extends UmbModalBaseElement<
#blank {
border-bottom: 1px solid var(--uui-color-border);
}
#edit-permissions {
margin-top: var(--uui-size-6);
}
`,
];
}

View File

@@ -3,9 +3,19 @@ import type {
UmbMediaCreateOptionsModalData,
UmbMediaCreateOptionsModalValue,
} from './media-create-options-modal.token.js';
import { html, nothing, customElement, state, ifDefined } from '@umbraco-cms/backoffice/external/lit';
import {
html,
nothing,
customElement,
state,
ifDefined,
repeat,
css,
when,
} from '@umbraco-cms/backoffice/external/lit';
import { UmbModalBaseElement } from '@umbraco-cms/backoffice/modal';
import { UmbMediaTypeStructureRepository, type UmbAllowedMediaTypeModel } from '@umbraco-cms/backoffice/media-type';
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
@customElement('umb-media-create-options-modal')
export class UmbMediaCreateOptionsModalElement extends UmbModalBaseElement<
@@ -63,21 +73,10 @@ export class UmbMediaCreateOptionsModalElement extends UmbModalBaseElement<
return html`
<umb-body-layout headline=${this._headline ?? ''}>
<uui-box>
${this._allowedMediaTypes.length === 0
? html`<umb-localize key="create_noMediaTypes"></umb-localize>`
: nothing}
${this._allowedMediaTypes.map(
(mediaType) => html`
<uui-ref-node-document-type
data-id=${ifDefined(mediaType.unique)}
.name=${mediaType.name}
.alias=${mediaType.description}
select-only
selectable
@selected=${() => this.#onNavigate(mediaType)}>
${mediaType.icon ? html`<umb-icon slot="icon" name=${mediaType.icon}></umb-icon>` : nothing}
</uui-ref-node-document-type>
`,
${when(
this._allowedMediaTypes.length === 0,
() => this.#renderNotAllowed(),
() => this.#renderAllowedMediaTypes(),
)}
</uui-box>
<uui-button
@@ -88,6 +87,46 @@ export class UmbMediaCreateOptionsModalElement extends UmbModalBaseElement<
</umb-body-layout>
`;
}
#renderNotAllowed() {
return html`<umb-localize key="create_noMediaTypes">
There are no allowed Media Types available for creating media here. You must enable these in
<strong>Media Types</strong> within the <strong>Settings</strong> section, by editing the
<strong>Allowed child node types</strong> under <strong>Permissions</strong>. </umb-localize
><br />
<uui-button
id="edit-permissions"
look="secondary"
@click=${() => this._rejectModal()}
href=${`/section/settings/workspace/media-type/edit/${this.data?.mediaType?.unique}/view/structure`}
label=${this.localize.term('create_noMediaTypesEditPermissions')}></uui-button>`;
}
#renderAllowedMediaTypes() {
return repeat(
this._allowedMediaTypes,
(mediaType) => mediaType.unique,
(mediaType) =>
html`<uui-ref-node-document-type
data-id=${ifDefined(mediaType.unique)}
.name=${mediaType.name}
.alias=${mediaType.description ?? ''}
select-only
selectable
@selected=${() => this.#onNavigate(mediaType)}>
${mediaType.icon ? html`<umb-icon slot="icon" name=${mediaType.icon}></umb-icon>` : nothing}
</uui-ref-node-document-type>`,
);
}
static styles = [
UmbTextStyles,
css`
#edit-permissions {
margin-top: var(--uui-size-6);
}
`,
];
}
export default UmbMediaCreateOptionsModalElement;