mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-20 17:15:51 +02:00
24 lines
No EOL
1.6 KiB
Twig
24 lines
No EOL
1.6 KiB
Twig
{% macro profile_dropdown(type, id = null, include_text = true, btn_type = 'btn-secondary') %}
|
|
<div class="dropdown">
|
|
<button type="button" class="btn {{ btn_type }} dropdown-toggle" title="{% trans %}label_generator.label_btn{% endtrans %}"
|
|
data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" {% if not is_granted("@labels.create_labels") %}disabled{% endif %}>
|
|
<i class="fas fa-fw fa-qrcode"></i> {% if include_text %}{% trans %}label_generator.label_btn{% endtrans %}{% endif %}
|
|
</button>
|
|
<div class="dropdown-menu">
|
|
{% if is_granted('@labels.read_profiles') %}
|
|
{% set profiles = label_profile_dropdown_helper.dropdownProfiles(type) %}
|
|
{% else %}
|
|
{% set profiles = [] %}
|
|
{% endif %}
|
|
{% for profile in profiles %}
|
|
<a class="dropdown-item" href="{{ path('label_dialog_profile', {'profile': profile.id, 'target_type': type, 'target_id': id, 'generate': true}) }}">{{ profile.name }}</a>
|
|
{% endfor %}
|
|
{% if profiles is not empty and is_granted('@labels.edit_options') %}
|
|
<div class="dropdown-divider"></div>
|
|
{% endif %}
|
|
{% if is_granted('@labels.edit_options') %} {# An empty dialog does not make much sense, when you can not edit the options... #}
|
|
<a class="dropdown-item" href="{{ path('label_dialog', {'target_type': type, 'target_id': id}) }}">{% trans %}label_generator.label_empty{% endtrans %}</a>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% endmacro %} |