mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Moved quick link logic into an macro
This commit is contained in:
parent
74a563a75a
commit
a01ed3acf6
5 changed files with 25 additions and 19 deletions
|
@ -22,5 +22,6 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block quick_links %}
|
||||
{% include 'QuickLinks/_company.html.twig' %}
|
||||
{% import "components/quick_links.macro.html.twig" as quick_links %}
|
||||
{{ quick_links.company(entity) }}
|
||||
{% endblock %}
|
|
@ -9,7 +9,8 @@
|
|||
{% embed "Parts/lists/_info_card.html.twig" with {'header_label': 'manufacturer.label'} %}
|
||||
{% block quick_links %}
|
||||
<div class="mb-2">
|
||||
{% include 'QuickLinks/_company.html.twig' %}
|
||||
{% import "components/quick_links.macro.html.twig" as quick_links %}
|
||||
{{ quick_links.company(entity) }}
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endembed %}
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
{% embed "Parts/lists/_info_card.html.twig" with {'header_label': 'supplier.label'} %}
|
||||
{% block quick_links %}
|
||||
<div class="mb-2">
|
||||
{% include 'QuickLinks/_company.html.twig' %}
|
||||
{% import "components/quick_links.macro.html.twig" as quick_links %}
|
||||
{{ quick_links.company(entity) }}
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endembed %}
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
<div class="btn-toolbar">
|
||||
<div class="btn-group">
|
||||
{% if entity.website is not empty %}
|
||||
<a class="btn btn-outline-secondary" href="{{ entity.website }}" title="{% trans %}company.edit.quick.website{% endtrans %}" data-turbo="false"><i class="fas fa-globe fa-fw"></i></a>
|
||||
{% endif %}
|
||||
{% if entity.emailAddress is not empty %}
|
||||
<a class="btn btn-outline-secondary" href="mailto:{{ entity.emailAddress }}" title="{% trans %}company.edit.quick.email{% endtrans %}" data-turbo="false"><i class="fas fa-envelope-open-text"></i></a>
|
||||
{% endif %}
|
||||
{% if entity.phoneNumber is not empty %}
|
||||
<a class="btn btn-outline-secondary" href="tel:{{ entity.phoneNumber | replace({' ': ''}) }}" title="{% trans %}company.edit.quick.phone{% endtrans %}" data-turbo="false"><i class="fas fa-phone"></i></a>
|
||||
{% endif %}
|
||||
{% if entity.faxNumber is not empty %}
|
||||
<a class="btn btn-outline-secondary" href="tel:{{ entity.faxNumber | replace({' ': ''}) }}" title="{% trans %}company.edit.quick.fax{% endtrans %}" data-turbo="false"><i class="fas fa-fax"></i></a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
19
templates/components/quick_links.macro.html.twig
Normal file
19
templates/components/quick_links.macro.html.twig
Normal file
|
@ -0,0 +1,19 @@
|
|||
{# Renders an btn toolbar to quickly call/email or visit the website of a company #}
|
||||
{% macro company(entity) %}
|
||||
<div class="btn-toolbar">
|
||||
<div class="btn-group">
|
||||
{% if entity.website is not empty %}
|
||||
<a class="btn btn-outline-secondary" href="{{ entity.website }}" title="{% trans %}company.edit.quick.website{% endtrans %}" target="_blank" rel="nofollow"><i class="fas fa-globe fa-fw"></i></a>
|
||||
{% endif %}
|
||||
{% if entity.emailAddress is not empty %}
|
||||
<a class="btn btn-outline-secondary" href="mailto:{{ entity.emailAddress }}" title="{% trans %}company.edit.quick.email{% endtrans %}" target="_blank" rel="nofollow"><i class="fas fa-envelope-open-text"></i></a>
|
||||
{% endif %}
|
||||
{% if entity.phoneNumber is not empty %}
|
||||
<a class="btn btn-outline-secondary" href="tel:{{ entity.phoneNumber | replace({' ': ''}) }}" title="{% trans %}company.edit.quick.phone{% endtrans %}" target="_blank" rel="nofollow"><i class="fas fa-phone"></i></a>
|
||||
{% endif %}
|
||||
{% if entity.faxNumber is not empty %}
|
||||
<a class="btn btn-outline-secondary" href="tel:{{ entity.faxNumber | replace({' ': ''}) }}" title="{% trans %}company.edit.quick.fax{% endtrans %}" target="_blank" rel="nofollow"><i class="fas fa-fax"></i></a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endmacro %}
|
Loading…
Add table
Add a link
Reference in a new issue