{% set last_contrib = contributions[-1].type == amo.CONTRIB_PURCHASE
and contributions[-1].id %}
{% for contribution in contributions %}
{# Show "Request Support" link if this is the last contribution
and is a purchase. #}
{% set get_support = contribution.id == last_contrib %}
{% if contribution.type == amo.CONTRIB_PURCHASE %}
{% trans date=contribution.created|datetime,
amt=contribution.get_amount_locale() %}
Purchased {{ date }} for {{ amt }}
{% endtrans %}
{% if get_support %}
{{ _('Request Support') }}
{% endif %}
{% elif contribution.type == amo.CONTRIB_REFUND %}
{% trans date=contribution.created|datetime,
amt=contribution.get_amount_locale() %}
Refunded {{ date }} for {{ amt }}
{% endtrans %}
{% elif contribution.type == amo.CONTRIB_CHARGEBACK %}
{% trans date=contribution.created|datetime,
amt=contribution.get_amount_locale() %}
Reversed {{ date }} for {{ amt }}
{% endtrans %}
{% endif %}
{% endfor %}
{% endif %}
{% endmacro %}
{% macro sort_vital(addon, field) %}
{% if field in ('popular', 'downloads') or not addon.show_adu() %}
{% with num=addon.weekly_downloads %}
{# L10n: {0} is the number of downloads. #}
{{ ngettext('{0} weekly download', '{0} weekly downloads',
num)|f(num|numberfmt) }}
{% endwith %}
{% else %}
{% with num=addon.average_daily_users %}
{# L10n: {0} is the number of users. #}
{{ ngettext('{0} user', '{0} users', num)|f(num|numberfmt) }}
{% endwith %}
{% endif %}
{% if field in ('created', 'updated') %}
{% if field == 'created' %}
{# L10n: {0} is a date. #}
{{ _('Added {0}')|f(addon.created|datetime) }}
{% else %}
{# L10n: {0} is a date. #}
{{ _('Updated {0}')|f(addon.last_updated|datetime) }}
{% endif %}