tooltips + verwaltung finish

This commit is contained in:
Simon Martens
2025-05-27 15:08:55 +02:00
parent 2ad431ca09
commit 4e13a0b5cb
28 changed files with 339 additions and 213 deletions

BIN
views/assets/favicon.xcf Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -318,14 +318,7 @@ class z extends HTMLElement {
super(), this._tooltipBox = null, this._timeout = 200, this._hideTimeout = null, this._hiddenTimeout = null;
}
connectedCallback() {
this.classList.add(
"w-full",
"h-full",
"relative",
"block",
"leading-none",
"[&>*]:leading-normal"
);
this.classList.add("relative", "block", "leading-none", "[&>*]:leading-normal");
const t = this.querySelector(".data-tip"), e = t ? t.innerHTML : "Tooltip";
t && t.classList.add("hidden"), this._tooltipBox = document.createElement("div"), this._tooltipBox.innerHTML = e, this._tooltipBox.className = [
"opacity-0",

File diff suppressed because one or more lines are too long

View File

@@ -45,7 +45,7 @@
<body class="w-full min-h-full" hx-ext="response-targets" hx-boost="true">
<div class="flex flex-col min-h-screen w-full">
<header class="container-normal bg-slate-100 px-2 py-2" id="header">
<header class="container-normal bg-slate-100 " id="header">
{{ template "_menu" . }}
</header>

View File

@@ -6,9 +6,9 @@
<div class="flex flex-row justify-between">
<div class="flex flex-row gap-x-3">
<div class="grow-0">
<a href="/" class="no-underline"
><img class="h-14 w-14 border" src="/assets/favicon.png"
/></a>
<a href="/" class="no-underline">
<img class="h-14 w-14 border" src="/assets/favicon_transparent.png" />
</a>
</div>
<div class="flex flex-col">
<h1 class="font-bold text-2xl tracking-wide">

BIN
views/public/favicon.xcf Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -20,6 +20,9 @@
<div class="container-oversize mt-12 pb-0 mb-0">
<div class="pb-1.5 ml-32"><i class="ri-book-line"></i> Almanach</div>
{{- if $model.request.user -}}
DDD
{{- end -}}
<div class="pt-0 {{ if $hasContents -}}contentsentrydata{{- end -}}" id="entrydata">
<div class="container-normal !py-8">
<div class="flex flex-col">

View File

View File

View File

@@ -208,27 +208,48 @@
<div class="col-span-1 mt-12 justify-self-end self-end items-end flex flex-row justify-end">
{{ if not $model.user.Deactivated }}
<button
type="submit"
formmethod="POST"
formaction="/user/{{ $model.user.Id }}/deactivate"
type="button"
class="inline-flex justify-center py-2 px-3 underline decoration-dotted
hover:decoration-solid
rounded-lg text-sm font-medium text-red-800 cursor-pointer">
Deaktivieren
</button>
<form action="/user/{{ $model.user.Id }}/deactivate/" method="POST">
<input
type="hidden"
name="csrf_nonce"
id="csrf_nonce"
required
value="{{ $model.csrf_nonce }}" />
<input
type="hidden"
name="csrf_token"
id="csrf_token"
required
value="{{ $model.csrf_token }}" />
<button
type="submit"
type="button"
class="cursor-pointer text-red-700 hover:text-red-900 pr-4 mt-6">
<i class="ri-prohibited-2-line"></i>
Deaktivieren
</button>
</form>
{{ else }}
<button
type="submit"
formmethod="POST"
formaction="/user/{{ $model.user.Id }}/activate"
type="button"
class="inline-flex justify-center py-2 px-4 border border-transparent hover:border-red-800
rounded-lg text-sm font-medium text-red-800 bg-red-200 hover:bg-red-300 cursor-pointer
focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-slate-500 no-underline">
<i class="ri-restart-line"></i> Aktivieren
</button>
<form action="/user/{{ $model.user.Id }}/activate/" method="POST">
<input
type="hidden"
name="csrf_nonce"
id="csrf_nonce"
required
value="{{ $model.csrf_nonce }}" />
<input
type="hidden"
name="csrf_token"
id="csrf_token"
required
value="{{ $model.csrf_token }}" />
<button
type="submit"
type="button"
class="cursor-pointer text-green-700 hover:text-green-900 pr-4 mt-6">
<i class="ri-restart-line"></i> Aktivieren
</button>
</form>
{{ end }}
</div>
</div>

View File

@@ -107,26 +107,32 @@
value="{{ $model.access_url }}"
deactive
readonly />
<button
type="button"
class="ml-2 inline-flex justify-center py-2 px-3 border border-transparent
<tool-tip position="top">
<div class="data-tip font-bold hidden">Kopieren</div>
<button
type="button"
class="ml-2 inline-flex justify-center py-2 px-3 border border-transparent
rounded-xs
shadow-sm text-sm font-medium text-white bg-slate-700 hover:bg-slate-800 cursor-pointer
focus:outline-none no-underline
focus:ring-2 focus:ring-offset-2 focus:ring-slate-500"
onclick="navigator.clipboard.writeText('{{ $model.access_url }}')">
<i class="ri-file-copy-line"></i>
</button>
<a
href="{{ $model.relative_url }}"
target="_blank"
class="ml-2 inline-flex justify-center py-2 px-3 border border-transparent
onclick="navigator.clipboard.writeText('{{ $model.access_url }}')">
<i class="ri-file-copy-line"></i>
</button>
</tool-tip>
<tool-tip position="top">
<div class="data-tip font-bold hidden">In neuem Fenster öffnen</div>
<a
href="{{ $model.relative_url }}"
target="_blank"
class="ml-2 inline-flex justify-center py-2 px-3 border border-transparent
rounded-xs
shadow-sm text-sm font-medium text-white bg-slate-700 hover:bg-slate-800 cursor-pointer
focus:outline-none no-underline
focus:ring-2 focus:ring-offset-2 focus:ring-slate-500">
<i class="ri-external-link-line"></i>
</a>
<i class="ri-external-link-line"></i>
</a>
</tool-tip>
<form class="" method="POST">
<input
type="hidden"
@@ -141,15 +147,18 @@
required
value="{{ $model.csrf_token }}" />
<div class="col-span-9 flex flex-row items-center justify-center">
<button
type="submit"
class="ml-2 inline-flex justify-center py-2 px-3 border border-transparent
<tool-tip position="top">
<div class="data-tip font-bold hidden">Link invalidieren</div>
<button
type="submit"
class="ml-2 inline-flex justify-center py-2 px-3 border border-transparent
rounded-xs
shadow-sm text-sm font-medium text-white bg-slate-700 hover:bg-slate-800 cursor-pointer
focus:outline-none no-underline
focus:ring-2 focus:ring-offset-2 focus:ring-slate-500">
<i class="ri-loop-left-line"></i>
</button>
<i class="ri-loop-left-line"></i>
</button>
</tool-tip>
</div>
</form>
</div>

View File

@@ -52,7 +52,13 @@
<tr class="{{ if $u.Deactivated }}deactivated{{ end }}">
<td>{{ $u.Name }}</td>
<td>{{ $u.Email }}</td>
<td>{{ $u.Role }}</td>
{{- if eq $u.Role "Admin" -}}
<td class="">Administrator</td>
{{- else if eq $u.Role "Editor" -}}
<td class="">Redakteur</td>
{{- else -}}
<td class="">Benutzer</td>
{{- end -}}
<td>{{ index $model.session_counts $u.Id }}</td>
<td>
<form class="flex flex-row gap-x-4 justify-end">
@@ -71,34 +77,43 @@
value="{{ $model.csrf_token }}" />
<!-- INFO: we dont use request.fullpath here, since this can be /logout /activate
or /deactivate, which would not work with the redirectTo query param -->
<button
formmethod="GET"
formaction="/user/{{ $u.Id }}/edit?redirectTo=/user/management">
<i class="ri-pencil-line"></i>
</button>
<button
hx-push-url="false"
formmethod="POST"
formaction="/user/management/logout/"
class="text-orange-800 bg-orange-200 hover:bg-orange-300">
<i class="ri-logout-box-r-line"></i>
</button>
<tool-tip position="top">
<div class="data-tip font-bold hidden">Bearbeiten</div>
<button
formmethod="GET"
formaction="/user/{{ $u.Id }}/edit?redirectTo=/user/management">
<i class="ri-pencil-line"></i>
</button>
</tool-tip>
<tool-tip position="top">
<div class="data-tip font-bold hidden">Logout</div>
<button
formmethod="POST"
formaction="/user/management/logout/"
class="text-orange-800 bg-orange-200 hover:bg-orange-300">
<i class="ri-logout-box-r-line"></i>
</button>
</tool-tip>
{{- if $u.Deactivated }}
<button
hx-push-url="false"
formmethod="POST"
formaction="/user/management/activate/"
class="text-blue-800 bg-blue-200 hover:bg-blue-300">
<i class="ri-check-line"></i>
</button>
<tool-tip position="top">
<div class="data-tip font-bold hidden">Reaktivieren</div>
<button
formmethod="POST"
formaction="/user/management/activate/"
class="text-green-800 bg-green-200 hover:bg-green-300">
<i class="ri-restart-line"></i>
</button>
</tool-tip>
{{- else -}}
<button
hx-push-url="false"
formmethod="POST"
formaction="/user/management/deactivate/"
class="text-red-800 bg-red-200 hover:bg-red-300">
<i class="ri-prohibited-2-line"></i>
</button>
<tool-tip position="top">
<div class="data-tip font-bold hidden">Deaktivieren</div>
<button
formmethod="POST"
formaction="/user/management/deactivate/"
class="text-red-800 bg-red-200 hover:bg-red-300">
<i class="ri-prohibited-2-line"></i>
</button>
</tool-tip>
{{- end -}}
</form>
</td>

View File

@@ -594,14 +594,7 @@ class ToolTip extends HTMLElement {
}
connectedCallback() {
this.classList.add(
"w-full",
"h-full",
"relative",
"block",
"leading-none",
"[&>*]:leading-normal",
);
this.classList.add("relative", "block", "leading-none", "[&>*]:leading-normal");
const dataTipElem = this.querySelector(".data-tip");
const tipContent = dataTipElem ? dataTipElem.innerHTML : "Tooltip";