style: adopt ep-design 1.2.0 dashboard cards and replace the hover dropdown with a click menu
This commit is contained in:
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>
|
||||
Reference in new issue
Block a user