{% extends "base.html" %}

{% block extra_links %}
  <link href="/blog/rss" rel="alternate" type="application/rss+xml" title="the loopvid blog" />
{% endblock %}

{% block body %}
  <body class="blog">
{% endblock %}

{% block page_title %}
  {% if page_title %}
    <div class="title_container">
      <div id="{{ tags | e }}" class="title">
        {{ page_title | e }}
      </div>
    </div>
  {% endif %}
{% endblock %}

{% block top_navigation %}
  {# don't display if the page is empty, because it looks weird #}
  {# WARNING: if creating new page add test for it here #}
  {% if entries or tag_pairs or sources %}
    <div class="top_navigation">
      <div class="top_navigation_inner">

        <div class="top_navigation_left">
          {% block navigation %}
            {% if 'top_page' in page_links %}
              {% if not page_links['prev_page'] %}
                <span class="greyed_out prev_page" title="previous page">previous</span>
              {% else %}
                <a class="page_link prev_page" href="{{ page_links['prev_page'] | e }}" title="previous page">previous</a>
              {% endif %}

              &middot;
              <a class="page_link first_page" href="{{ page_links['top_page'] | e }}" title="first page">top</a>
              &middot;

              {% if not page_links['next_page'] %}
                <span class="greyed_out next_page" title="next page">next</span>
              {% else %}
                <a class="page_link next_page" href="{{ page_links['next_page'] | e}}" title="next page">next</a>
              {% endif %}

            <br />
            {% endif %}

            <a class="page_link first_page" href="/blog/" title="all videos posted to the loopvid blog">all videos</a>
            &middot;
            <a class="page_link" href="/blog/tag/" title="list of all tags">all tags</a>
            &middot;
            <a class="page_link" href="/blog/sources/" title="list of all sources">all sources</a>

            &middot;&middot;
            <a class="page_link" href="/blog/random/" title="a random set of videos">random</a>
          {% endblock %}
        </div>
        {#- can't have any spaces here -#}
        <div class="top_navigation_right">
          <div class="filtered_page_links">
            {% if page_links %}
              {% if 'admin' in page_links %}
                {% if page_links['admin'] %}
                  <a class="page_link" href="{{ page_links['admin'] }}"
                    title="administer the current selection of videos">admin</a>
                {% else %}
                  <span class="greyed_out">admin</span>
                {% endif %}
                &middot;
              {% endif %}
              {% if page_links['gallery'] %}
                <a class="page_link" href="{{ page_links['gallery'] }}">gallery</a>
                &middot;
              {% endif %}
              <a class="page_link" href="{{ page_links['rss'] }}"
                title="rss feed including the current parameters">rss</a>
            {% endif %}
          </div>
        </div>

      </div>
    </div>
  {% endif %}
{% endblock %}

{% block footer_left %}
  {# repeat navigation at footer #}
  {{ self.navigation() }}
{% endblock %}
