From 4851660558f4ce7bb50df70cfca420f85e98720c Mon Sep 17 00:00:00 2001 From: Lone Iversen <108085781+loivsen@users.noreply.github.com> Date: Tue, 11 Jun 2024 10:15:01 +0200 Subject: [PATCH 1/3] add missing edit permissions for document create options modal --- .../document-create-options-modal.element.ts | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/create/document-create-options-modal.element.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/create/document-create-options-modal.element.ts index f1cb7e1e04..51146a3c1c 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/create/document-create-options-modal.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/create/document-create-options-modal.element.ts @@ -118,9 +118,11 @@ export class UmbDocumentCreateOptionsModalElement extends UmbModalBaseElement< render() { return html` - ${this._availableBlueprints.length && this.#documentTypeUnique - ? this.#renderBlueprints() - : this.#renderDocumentTypes()} + ${when( + this._availableBlueprints.length === 0 && this.#documentTypeUnique, + () => this.#renderBlueprints(), + () => this.#renderDocumentTypes(), + )} `; @@ -134,8 +136,14 @@ export class UmbDocumentCreateOptionsModalElement extends UmbModalBaseElement< There are no allowed Document Types available for creating content here. You must enable these in Document Types within the Settings section, by editing the - Allowed child node types under Permissions + Allowed child node types under Permissions
+ this._rejectModal()} + href=${`/section/settings/workspace/document-type/edit/${this.data?.documentType?.unique}/view/structure`} + label=${this.localize.term('create_noDocumentTypesEditPermissions')}> `, () => repeat( @@ -145,7 +153,7 @@ export class UmbDocumentCreateOptionsModalElement extends UmbModalBaseElement< html` this.#onSelectDocumentType(documentType.unique)}> @@ -183,6 +191,10 @@ export class UmbDocumentCreateOptionsModalElement extends UmbModalBaseElement< #blank { border-bottom: 1px solid var(--uui-color-border); } + + #edit-permissions { + margin-top: var(--uui-size-6); + } `, ]; } From 8940960b7dc8170499e052f0794f68323aaf4f2d Mon Sep 17 00:00:00 2001 From: Lone Iversen <108085781+loivsen@users.noreply.github.com> Date: Tue, 11 Jun 2024 10:15:14 +0200 Subject: [PATCH 2/3] add missing edit permissions button for media create options modal --- .../media-create-options-modal.element.ts | 67 ++++++++++++++----- 1 file changed, 51 insertions(+), 16 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/media/media/entity-actions/create/media-create-options-modal.element.ts b/src/Umbraco.Web.UI.Client/src/packages/media/media/entity-actions/create/media-create-options-modal.element.ts index 6e484f826a..eefbe75bc2 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/media/media/entity-actions/create/media-create-options-modal.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/media/media/entity-actions/create/media-create-options-modal.element.ts @@ -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` - ${this._allowedMediaTypes.length === 0 - ? html`` - : nothing} - ${this._allowedMediaTypes.map( - (mediaType) => html` - this.#onNavigate(mediaType)}> - ${mediaType.icon ? html`` : nothing} - - `, + ${when( + this._allowedMediaTypes.length === 0, + () => this.#renderNotAllowed(), + () => this.#renderAllowedMediaTypes(), )} `; } + + #renderNotAllowed() { + return html`
+ this._rejectModal()} + href=${`/section/settings/workspace/media-type/edit/${this.data?.mediaType?.unique}/view/structure`} + label=${this.localize.term('create_noMediaTypesEditPermissions')}>`; + } + + #renderAllowedMediaTypes() { + return repeat( + this._allowedMediaTypes, + (mediaType) => mediaType.unique, + (mediaType) => + html` this.#onNavigate(mediaType)}> + ${mediaType.icon ? html`` : nothing} + `, + ); + } + + static styles = [ + UmbTextStyles, + css` + #edit-permissions { + margin-top: var(--uui-size-6); + } + `, + ]; } export default UmbMediaCreateOptionsModalElement; From 6f4ec317240362e9067acc6697fb5566e51c82a1 Mon Sep 17 00:00:00 2001 From: Lone Iversen <108085781+loivsen@users.noreply.github.com> Date: Mon, 17 Jun 2024 11:49:38 +0200 Subject: [PATCH 3/3] localizations --- .../create/document-create-options-modal.element.ts | 8 ++++++-- .../create/media-create-options-modal.element.ts | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/create/document-create-options-modal.element.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/create/document-create-options-modal.element.ts index 51146a3c1c..7ba21a6c4b 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/create/document-create-options-modal.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/create/document-create-options-modal.element.ts @@ -123,7 +123,11 @@ export class UmbDocumentCreateOptionsModalElement extends UmbModalBaseElement< () => this.#renderBlueprints(), () => this.#renderDocumentTypes(), )} - +
`; } @@ -136,7 +140,7 @@ export class UmbDocumentCreateOptionsModalElement extends UmbModalBaseElement< There are no allowed Document Types available for creating content here. You must enable these in Document Types within the Settings section, by editing the - Allowed child node types under Permissions
+ Allowed child node types under Permissions.

+ return html` + There are no allowed Media Types available for creating media here. You must enable these in + Media Types within the Settings section, by editing the + Allowed child node types under Permissions.