| {#
/**
 * @file
 * Template for the NBG Currency block.
 *
 * Available variables:
 * - currency_data: Array of currency data.
 * - module_path:   Path to module.
 */
#}
{% if currency_data is empty %}
  <h1>{{ 'The list of currencies is empty.'|trans }}</h1>
{% else %}
  <table>
    <tbody>
    {% for k, v in currency_data %}
      {% if v.rate == -1 %}
        {% set change_class = 'nbg-currency-decreased' %}
        {% set change_status = 'Decreased by %change%' %}
      {% elseif v.rate == 1 %}
        {% set change_class = 'nbg-currency-increased' %}
        {% set change_status = 'Increased by %change%' %}
      {% else %}
        {% set change_class = null %}
        {% set change_status = 'Unchanged' %}
      {% endif %}
      <tr>
        <td title="{{ v.title }}" class="nbg-currency-td-flag">
          <img src="/{{ module_path }}/images/flags/{{ k|lower }}.png" alt="{{ k }}">
        </td>
        <td title="{{ v.description|trans }}">{{ v.currency }}</td>
        <td class="{{ change_class }}"
            title="{{ change_status|trans({ '%change%': v.change|abs })|striptags }}">
          {{ v.change }}
        </td>
      </tr>
    {% endfor %}
    </tbody>
  </table>
{% endif %}
 |