{% extends 'speeches/base.html' %}
{% load url from future %}
{% load i18n %}
{% load humanize %}
{% load speech_utils %}

{% block title %}Home{% endblock %}

{% block content %}

<div class="page-content__row">

  {% if paginator.count %}

    <div class="homepage-search">
        <h2>{% block instance_search_title %}{% trans 'Search' %}{% endblock %}</h2>
        <form class="site-search site-search--homepage" action="{% url "speeches:haystack_search" %}" method="get" >
            <div class="search-wrapper">
                <input type="search" class="site-search__input" placeholder="{% trans 'Search' %}" name="q"/>
                <input type="submit" class="icon-search icon-search" value="{% trans 'Search' %}"/>
            </div>
        </form>
    </div>


        </div>
    </div>
</div> <!-- closing off the opening tags in base so we can go full width here -->
<div class="homepage-stats">
  <div class="full-page__row">
      <div class="full-page__unit">
        {% url "speeches:speaker-list" as url_speaker_list %}
        {% url "speeches:section-list" as url_section_list %}
        {% if LANGUAGE_CODE == 'en' %}
          <strong>{{ count_speeches|intcomma }}</strong>
          speech{{ count_speeches|pluralize:"es" }}{% if count_speakers %}, by
          <a href="{{ url_speaker_list }}"><strong>{{ count_speakers|intcomma }}</strong></a>
          speaker{{ count_speakers|pluralize }}{% endif %}{% if count_sections %}, in
          <a href="{{ url_section_list }}"><strong>{{ count_sections|intcomma }}</strong></a>
          section{{ count_sections|pluralize }}{% endif %}
        {% else %}
          {# Hideously long lines, until blocktrans adds trimmed option in Django 1.7... #}
          {% blocktrans with n=count_speeches|intcomma count c=count_speeches %}<strong>One</strong> speech{% plural %}<strong>{{ n }}</strong> speeches{% endblocktrans %}{% if count_speakers %};
          {% blocktrans with n=count_speakers|intcomma count c=count_speakers %}<a href="{{ url_speaker_list }}"><strong>one</strong></a> speaker{% plural %}<a href="{{ url_speaker_list }}"><strong>{{ n }}</strong></a> speakers{% endblocktrans %}{% endif %}{% if count_sections %};
          {% blocktrans with n=count_sections|intcomma count c=count_sections %}<a href="{{ url_section_list }}"><strong>one</strong></a> section{% plural %}<a href="{{ url_section_list }}"><strong>{{ n }}</strong></a> sections{% endblocktrans %}{% endif %}
        {% endif %}

{% block instance_blocks %}
{% endblock %}

  {% else %}

    <div class="nothing-here-yet-message">
        {% url "speeches:speech-add" as url_add_speech %}
        {% url "speeches:section-add" as url_add_section %}
        <h2>{% blocktrans %}Nothing has been uploaded yet. Why not <a href='{{ url_add_speech }}'>add a speech</a> or a <a href='{{ url_add_section }}'>section</a>?{% endblocktrans %}</h2>
    </div>

  {% endif %}

</div>

{% endblock %}
