{% comment %}
For displaying a list of objects in a chart.

Expects:
* object_list - A list/QuerySet of objects, each with a num_publications property.

* score_attr - The name of the attribute on each object that contains the score for the chart. e.g. 'num_visits'

* name_attr - The name of the attribute on each object to be used for its display value. Default is 'name'.

* in_card - Boolean, default is False. Is this displayed within a .card element?

* use_cite - If True, then wrap the name in <cite></cite> tags. Default: False.
{% endcomment %}

{% load spectator_core %}

<ol{% if in_card|default_if_none:False %} class="mb-0"{% endif %}>
    {% for obj in object_list %}
        <li value="{{ obj.chart_position }}">
            {% with use_cite|default_if_none:False as use_cite %}
                <a href="{{ obj.get_absolute_url }}">{% if use_cite %}<cite>{% endif %}{% if name_attr %}{{ obj|get_attr:name_attr }}{% else %}{{ obj.name }}{% endif %}{% if use_cite %}</cite>{% endif %}</a>
                <small class="text-muted">({{ obj|get_attr:score_attr }})</small>
            {% endwith %}
        </li>
    {% endfor %}
</ol>
