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] 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;