bookforge/templates/components/dropdown.html

31 lines
1.1 KiB
HTML
Raw Normal View History

2026-01-23 13:56:30 +01:00
{% macro dropdown_button(label, items = []) %}
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
{{ label }}
</button>
<ul class="dropdown-menu">
{% for item in items %}
2026-01-28 00:38:24 +01:00
<li><a class="dropdown-item" href="{{ item.1 }}">{{ item.0 }}</a></li>
2026-01-23 13:56:30 +01:00
{% endfor %}
</ul>
</div>
2026-01-28 00:38:24 +01:00
{% endmacro %}
2026-01-29 23:52:55 +01:00
{% macro crud_dropdown_button(book, label, sub_path, show = true) %}
2026-01-28 00:38:24 +01:00
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
Actions
</button>
<ul class="dropdown-menu">
{% if show %}
2026-01-29 23:52:55 +01:00
<li><a class="dropdown-item" href="/{{ sub_path }}/{{ book.id }}">Show</a></li>
2026-01-28 00:38:24 +01:00
{% endif %}
2026-01-29 23:52:55 +01:00
<li><a class="dropdown-item" href="/{{ sub_path }}/{{ book.id }}/edit">Edit</a></li>
2026-01-28 00:38:24 +01:00
<li>
2026-01-29 23:52:55 +01:00
<form method="post" action="/{{ sub_path }}/{{ book.id }}/delete" class="mb-0">
2026-01-28 00:38:24 +01:00
<input class="dropdown-item" type="submit" value="Delete">
</form>
</li>
</ul>
</div>
{% endmacro %}