{% from "macro.html" import render_pagination %}
{% extends "base.html" %}

{% block title %}{{ label }}{% endblock %}

{% block content %}
<div class="m-3">
  <h1>{{ self.title() }}</h1>

  <p><a href="{{ url_for('browse_page') }}">back to index</a></p>

  {#
  <p>Sort order:
  {% if order == 'name' %}
    <b>name</b> or <a href="{{ set_url_args(sort='count') }}">count</a>
  {% else %}
    <a href="{{ set_url_args(sort='name') }}">name</a> or <b>count</b>
  {% endif %}
  </p>
  #}

  <p>Total: {{ '{:,d}'.format(pager.total_count) }}</p>

  {{ render_pagination(pager) }}

  <ul>
  {% for hit in hits %}
    <li>
      <a href="{{ url_for('browse_page', **{pid: hit.qid}) }}">{{ hit.label }}</a>

    ({{ '{:,d}'.format(hit.count) }} artworks)

    {% if not hit.label %}
      <a href="https://wikidata.org/wiki/{{ hit.qid }}">view in Wikidata</a>
    {% endif %}
    </li>
  {% endfor %}
  </ul>

  {{ render_pagination(pager) }}

</div>

{% endblock %}