{% macro render_displayed_entries_fragment(displayed_num, total_num, id='filtering-state') -%}
    <span id="{{ id }}" class="i-button label icon-list"
          title="{% trans %}{{ displayed_num }} out of {{ total_num }} displayed{% endtrans %}">
        <span><strong>{{ displayed_num }}</strong> / {{ total_num }}</span>
    </span>
{%- endmacro %}

{% macro render_filter_statistics(displayed_num, total_num, total_duration) %}
    {{ render_displayed_entries_fragment(displayed_num, total_num) }}
    <span id="total-duration" class="i-button label icon-time"
          title="{% trans total=total_duration[0]|format_human_timedelta, scheduled=total_duration[1]|format_human_timedelta %}{{ total }} total duration of which {{ scheduled }} are scheduled{% endtrans %}">
        <strong>{{ total_duration[0] | format_human_timedelta }}</strong>
    </span>
{% endmacro %}

{% macro render_num_reviews_tooltip(proposal, render_contrib_types=none) -%}
    {% if proposal.reviews %}
        <div class="num-reviews-tooltip">
            <div class="title"><strong>{% trans %}Reviews{% endtrans %}</strong></div>
            {% for action, review_list in proposal.reviews|groupby('proposed_action') -%}
                <div class="semantic-text {{ action.css_class }}">
                    <strong>{{ review_list|selectattr('proposed_action', 'equalto', action)|list|length }}</strong>
                    {{ action.title }}
                    {% if render_contrib_types and action.name == 'accept' %}
                        <div class="contrib-types">
                            ({{- render_contrib_types(review_list) -}})
                        </div>
                    {% endif %}
                </div>
            {% endfor %}
        </div>
    {% endif %}
{% endmacro %}
