From e0ec5826ca4c82a32ad08465a31a211d06d31f39 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 8 Mar 2021 21:51:25 +0100 Subject: [PATCH] web: add edit button to LibraryView when user is superuser --- web/src/pages/LibraryPage.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/web/src/pages/LibraryPage.ts b/web/src/pages/LibraryPage.ts index 5e9db57fc..b94caae24 100644 --- a/web/src/pages/LibraryPage.ts +++ b/web/src/pages/LibraryPage.ts @@ -1,9 +1,11 @@ import { gettext } from "django"; import { css, CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element"; import { ifDefined } from "lit-html/directives/if-defined"; +import { until } from "lit-html/directives/until"; import { Application, CoreApi } from "../api"; import { AKResponse } from "../api/Client"; import { DEFAULT_CONFIG } from "../api/Config"; +import { me } from "../api/Users"; import { COMMON_STYLES } from "../common/styles"; import { loading, truncate } from "../utils"; @@ -24,6 +26,15 @@ export class LibraryApplication extends LitElement { .pf-c-avatar { --pf-c-avatar--BorderRadius: 0; } + .pf-c-card__header { + justify-content: space-between; + } + .pf-c-card__header a { + display: flex; + flex-direction: column; + justify-content: center; + margin-right: 0.25em; + } ` ); } @@ -37,6 +48,14 @@ export class LibraryApplication extends LitElement { ${this.application.metaIcon ? html`Application Icon` : html``} + ${until(me().then((u) => { + if (!u.isSuperuser) return html``; + return html` + + + + `; + }))}

${this.application.name}