Bugfix: Hide template input when there are no allowed templates (#2484)

hide template input when there are no allowed templates
This commit is contained in:
Mads Rasmussen
2024-10-28 11:35:32 +01:00
committed by Niels Lyngsø
parent c848d4569f
commit e96013ac29

View File

@@ -159,7 +159,6 @@ export class UmbDocumentWorkspaceViewInfoElement extends UmbLitElement {
#renderGeneralSection() {
const editDocumentTypePath = this._routeBuilder?.({ entityType: 'document-type' }) ?? '';
const editTemplatePath = this._routeBuilder?.({ entityType: 'template' }) ?? '';
return html`
<div class="general-item">
@@ -177,6 +176,20 @@ export class UmbDocumentWorkspaceViewInfoElement extends UmbLitElement {
<umb-icon slot="icon" name=${ifDefined(this._documentTypeIcon)}></umb-icon>
</uui-ref-node-document-type>
</div>
${this.#renderTemplateInput()}
<div class="general-item">
<strong><umb-localize key="template_id">Id</umb-localize></strong>
<span>${this._documentUnique}</span>
</div>
`;
}
#renderTemplateInput() {
if (this._allowedTemplates?.length === 0) return nothing;
const editTemplatePath = this._routeBuilder?.({ entityType: 'template' }) ?? '';
return html`
<div class="general-item">
<strong><umb-localize key="template_template">Template</umb-localize></strong>
${this._templateUnique
@@ -200,10 +213,6 @@ export class UmbDocumentWorkspaceViewInfoElement extends UmbLitElement {
@click=${this.#openTemplatePicker}></uui-button>
`}
</div>
<div class="general-item">
<strong><umb-localize key="template_id">Id</umb-localize></strong>
<span>${this._documentUnique}</span>
</div>
`;
}