From 7a90b435ccf34ccf01e277026a2f60d7b3d711c0 Mon Sep 17 00:00:00 2001 From: Jens L Date: Sat, 26 Aug 2023 23:43:36 +0200 Subject: [PATCH] web/user: only render expand element when required (#6641) Signed-off-by: Jens Langhammer --- .../admin-overview/cards/VersionStatusCard.ts | 6 +-- web/src/user/LibraryApplication/index.ts | 42 ++++++++++++------- 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/web/src/admin/admin-overview/cards/VersionStatusCard.ts b/web/src/admin/admin-overview/cards/VersionStatusCard.ts index 85bbd6a30..77b075467 100644 --- a/web/src/admin/admin-overview/cards/VersionStatusCard.ts +++ b/web/src/admin/admin-overview/cards/VersionStatusCard.ts @@ -43,11 +43,11 @@ export class VersionStatusCard extends AdminStatusCard { renderValue(): TemplateResult { let text = this.value?.versionCurrent; - let link = "https://goauthentik.io/docs/releases/${this.value?.versionCurrent}"; + let link = `https://goauthentik.io/docs/releases/${this.value?.versionCurrent}`; if (this.value?.buildHash) { text = this.value.buildHash?.substring(0, 7); - link = "https://github.com/goauthentik/authentik/commit/${this.value.buildHash}"; + link = `https://github.com/goauthentik/authentik/commit/${this.value.buildHash}`; } - return html` ${text} `; + return html`${text}`; } } diff --git a/web/src/user/LibraryApplication/index.ts b/web/src/user/LibraryApplication/index.ts index 258e5047c..e4d9afc4f 100644 --- a/web/src/user/LibraryApplication/index.ts +++ b/web/src/user/LibraryApplication/index.ts @@ -67,6 +67,13 @@ export class LibraryApplication extends AKElement { return html``; } const me = rootInterface()?.me; + let expandable = false; + if (rootInterface()?.uiConfig?.enabledFeatures.applicationEdit && me?.user.isSuperuser) { + expandable = true; + } + if (this.application.metaPublisher !== "" || this.application.metaDescription !== "") { + expandable = true; + } return html`
- -
- ${this.application.metaPublisher} -
- ${truncateWords(this.application.metaDescription || "", 10)} - ${rootInterface()?.uiConfig?.enabledFeatures.applicationEdit && me?.user.isSuperuser - ? html` - -  ${msg("Edit")} - - ` - : html``} -
+ ${expandable + ? html` +
+ ${this.application.metaPublisher} +
+ ${truncateWords(this.application.metaDescription || "", 10)} + ${rootInterface()?.uiConfig?.enabledFeatures.applicationEdit && + me?.user.isSuperuser + ? html` + +  ${msg("Edit")} + + ` + : html``} +
` + : html``} `; } }