32 lines
1.1 KiB
HTML
32 lines
1.1 KiB
HTML
{% 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 %}
|
|
<li><a class="dropdown-item" href="{{ item.1 }}">{{ item.0 }}</a></li>
|
|
{% endfor %}
|
|
</ul>
|
|
</div>
|
|
{% endmacro %}
|
|
|
|
{% macro crud_dropdown_button(book, label, sub_path, show = true) %}
|
|
<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 %}
|
|
<li><a class="dropdown-item" href="/{{ sub_path }}/{{ book.id }}">Show</a></li>
|
|
{% endif %}
|
|
<li><a class="dropdown-item" href="/{{ sub_path }}/{{ book.id }}/edit">Edit</a></li>
|
|
<li>
|
|
<form method="post" action="/{{ sub_path }}/{{ book.id }}/delete" class="mb-0">
|
|
<input class="dropdown-item" type="submit" value="Delete">
|
|
</form>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
{% endmacro %}
|