{% extends "base_simple.html" %}
{% load i18n pagination_tags %}
{% load set_get from set_get %}

{% block settings %}
  {% load title %}
  {% trans "Przypisy" as title %}
  {% title title %}
{% endblock %}

{% block bodyid %}footnotes{% endblock %}

{% block titleextra %}{% trans "Przypisy" %}{% endblock %}


{% block body %}
  <h1>{% trans "Przypisy" %}</h1>

  <div class="normal-text">
    <p>
      {% trans "Pierwsza litera" %}:
      {% if letter %}
        <a href='?{% set_get "page" "ltr" %}'>{% trans "wszystkie" %}</a>
      {% else %}
        <strong>{% trans "wszystkie" %}</strong>
      {% endif %}

      {% for let in letters %}
        |
        {% if let == letter %}
          <strong>{{ let|upper }}</strong>
        {% else %}
          <a href='?{% set_get "page" ltr=let %}'>{{ let|upper }}</a>
        {% endif %}
      {% endfor %}
    </p>

    <p>
      {% trans "Według typu" %}:
      {% if fn_type %}
        <a href='?{% set_get "page" "type" %}'>{% trans "wszystkie" %}</a>
      {% else %}
        <strong>{% trans "wszystkie" %}</strong>
      {% endif %}

      {% for fnt, fnt_name in fn_types %}
        |
        {% if fnt == fn_type %}
          <strong>{{ fnt_name }}</strong>
        {% else %}
          <a href='?{% set_get "page" type=fnt %}'>{{ fnt_name }}</a>
        {% endif %}
      {% endfor %}
    </p>


    <p>
      {% trans "Według kwalifikatora" %}:
      {% if qualifier %}
        <a href='?{% set_get "page" "qual" %}'>{% trans "wszystkie" %}</a>
      {% else %}
        <strong>{% trans "wszystkie" %}</strong>
      {% endif %}

      {% for qual in qualifiers %}
        |
        {% if qual == qualifier %}
          <strong>{{ qual }}</strong>
        {% else %}
          <a href='?{% set_get "page" qual=qual.qualifier %}'>{{ qual }}</a>
        {% endif %}
      {% endfor %}
    </p>

    <p>
      {% trans "Według języka" %}:
      {% if language %}
        <a href='?{% set_get "page" "lang" %}'>{% trans "wszystkie" %}</a>
      {% else %}
        <strong>{% trans "wszystkie" %}</strong>
      {% endif %}

      {% for lang, lang_name in languages %}
        |
        {% if lang == language %}
          <strong>{{ lang_name }}</strong>
        {% else %}
          <a href='?{% set_get "page" lang=lang %}'>{{ lang_name }}</a>
        {% endif %}
      {% endfor %}
    </p>

    <hr/>

    <p>
      {% blocktrans trimmed count object_list.count as c %}
        Znaleziono {{ c }} przypis.
        {% plural %}
        Znaleziono {{ c }} przypisów.
      {% endblocktrans %}
    </p>

    {% if object_list.exists %}
      {% autopaginate object_list 100 %}
      {% paginate %}
      {% for obj in object_list %}
        <div class='dictionary-note'>
          {{ obj.html|safe }}
          {% for note_source in obj.notesource_set.all %}
            <div class='dictionary-note-source'>
              <a href='{% url "book_text" note_source.book.slug %}#{{ note_source.anchor }}'>{{ note_source.book.pretty_title }}</a>
              (<a href='{{ note_source.book.get_extra_info_json.about }}'>{% trans "źródło na Platformie Redakcyjnej" %}</a>)
            </div>
          {% endfor %}
        </div>
      {% endfor %}
      {% paginate %}
    {% endif %}
  </div>
{% endblock %}
