style: adopt ep-design 1.2.0 dashboard cards and replace the hover dropdown with a click menu

This commit is contained in:
fromme committed 2026-11-13 12:25:24 +01:00
1 parent 99e6119311
commit 6dbc6efa78
16 files changed
+381 -554

No files matched your search

@@ -0,0 +1,30 @@
{#-
One line of a dashboard:widget. Its text is `parts` (shown with dots between them) or the content
block; `icon` in front. With `url` the line is a link, without one but with hx-* attributes a
button (opening a modal, say), otherwise plain text.
-#}
{% set url = url ?? null %}
{% set icon = icon ?? null %}
{% set parts = parts ?? null %}
{% set is_button = not url and attributes.all|keys|filter(k => k starts with 'hx-')|length > 0 %}
{% set body %}
{% if icon %}{{ include('_partials/_icon.html.twig', {icon: icon, class: 'size-4 text-muted'}) }}{% endif %}
{% if parts is not null %}
{% for part in parts|filter(p => p is not empty) %}
{% if not loop.first %}<span class="entry-dot" aria-hidden="true">·</span>{% endif %}
<span>{{ part }}</span>
{% endfor %}
{% else %}
<span>{{ block('content') }}</span>
{% endif %}
{% endset %}
{% set attrs = attributes.defaults({class: 'entry-link'}).without('url', 'icon', 'parts') %}
<li>
{% if url %}
<a href="{{ url }}" {{ attrs }}>{{ body }}</a>
{% elseif is_button %}
<button type="button" {{ attributes.defaults({class: 'entry-link', 'hx-target': 'body', 'hx-swap': 'beforeend'}).without('url', 'icon', 'parts') }}>{{ body }}</button>
{% else %}
<div {{ attrs }}>{{ body }}</div>
{% endif %}
</li>
@@ -0,0 +1,25 @@
{#-
A card of entries, as on a dashboard. `title`; optional `meta` (a short count beside the title,
such as "3 neu, 2 in Bearbeitung"), `emptyText` and `scroll` (for work queues that would grow the
card without limit); the `actions` block goes to the right of the header, typically "alle anzeigen".
-#}
{% set emptyText = emptyText ?? 'Keine Einträge vorhanden.' %}
{% set meta = meta ?? null %}
{% set scroll = scroll ?? false %}
{% set entries %}{% block content %}{% endblock %}{% endset %}
<section {{ attributes.defaults({class: 'card p-5'}).without('title', 'meta', 'emptyText', 'scroll') }}>
<div class="flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1 pb-3">
<h2 class="section-title">{{ title }}</h2>
<div class="flex items-baseline gap-x-4">
{% if meta %}<span class="text-sm text-muted">{{ meta }}</span>{% endif %}
{% block actions %}{% endblock %}
</div>
</div>
{% if entries|trim is empty %}
{% block empty %}
<p class="text-sm text-muted">{{ emptyText }}</p>
{% endblock %}
{% else %}
<ul class="entry-list {{ scroll ? 'entry-list--scroll' }}">{{ entries }}</ul>
{% endif %}
</section>
-15
View File
@@ -1,15 +0,0 @@
<div class="relative inline-block text-left group"
{{ stimulus_controller('dropdown') }}
{{ stimulus_action('dropdown', 'open', 'mouseenter')|stimulus_action('dropdown', 'close', 'mouseleave') }}>
<button type="button" class="flex items-center text-gray-400 hover:text-gray-600 focus:outline-hidden focus:ring-0" aria-expanded="true" aria-haspopup="true" {{ stimulus_target('dropdown', 'button') }}>
<span class="sr-only">Funktionen</span>
{{ icon('dots', 'w-6 h-6') }}
</button>
<div class="hidden group-hover:block absolute right-0 top-0 z-10 w-56 origin-top-right pt-4" role="menu" aria-orientation="vertical" aria-labelledby="menu-button" tabindex="-1" {{ stimulus_target('dropdown', 'menu') }}>
<div class="rounded-md bg-white shadow-lg ring-1 ring-black/5 focus:outline-hidden">
<div class="py-1 menu menu--pulldown" role="none">
{% block content %}{% endblock %}
</div>
</div>
</div>
</div>
+13
View File
@@ -0,0 +1,13 @@
{#-
A "⋯" menu (menu_controller.js), opened by click or tap, never by hover. The items go in the
content block: links or buttons with the class `menu-item` (or `menu-item-danger`) and
role="menuitem". Choosing one closes the menu.
-#}
{% set label = label ?? 'Aktionen' %}
<div class="relative inline-block" {{ stimulus_controller('menu') }}>
<button type="button" class="btn-more" aria-haspopup="menu" aria-expanded="false" aria-label="{{ label }}"
{{ stimulus_target('menu', 'button') }} {{ stimulus_action('menu', 'toggle') }}>⋯</button>
<div class="menu-panel" role="menu" hidden {{ stimulus_target('menu', 'panel') }} {{ stimulus_action('menu', 'choose') }}>
{% block content %}{% endblock %}
</div>
</div>