{% macro boolean(value) %}
{% if value %}
{% trans %}bool.true{% endtrans %}
{% else %}
{% trans %}bool.false{% endtrans %}
{% endif %}
{% endmacro %}
{% macro attachment_icon(attachment, attachment_helper, class = "fa-fw fas fa-3x", link = true) %}
{% set disabled = attachment.secure and not is_granted("show_secure", attachment) %}
{% if not attachment_helper or attachment_helper.fileExisting(attachment) %}
{% if link and not disabled %}
{% endif %}
{% if attachment.picture %}
{% else %}
{% endif %}
{% if link and not disabled %}
{% endif %}
{% elseif not attachment_helper.fileExisting(attachment) %}
{% endif %}
{% endmacro %}
{% macro string_to_tags(string, class="badge badge-info") %}
{% for tag in string|split(',') %}
{{ tag | trim }}
{% endfor %}
{% endmacro %}
{% macro m_status_to_badge(status, class="badge") %}
{% if status is not empty %}
{% set color = " badge-secondary" %}
{% if status == "active" %}
{% set color = " badge-success" %}
{% elseif status == "nrfnd" %}
{% set color = " badge-warning" %}
{% elseif status == "eol" %}
{% set color = " badge-warning" %}
{% elseif status == "discontinued" %}
{% set color = " badge-danger" %}
{% endif %}
{{ ("m_status." ~ status) | trans }}
{% endif %}
{% endmacro %}
{% macro structural_entity_link(entity, link_type = "list_parts") %}
{# @var entity \App\Entity\Base\StructuralDBElement #}
{% if entity %}
{% trans %}specifications.property{% endtrans %} | {% trans %}specifications.value{% endtrans %} |
---|---|
{{ param.name }} {% if param.symbol is not empty %}${{ param.symbol }}${% endif %} | {{ param.formattedValue }} |