{% extends "newbase.html" %}
{% load staticfiles %}
{% load rowerfilters %}

{% block title %}Rowsandall Recent Video Analyses{% endblock %}

{% block scripts %}
{% include "monitorjobs.html" %}
{% endblock %}

{% block main %}
<h1>Recent videos</h1>

<ul class="main-content">
	<li class="grid_2">
    <form id="searchform" action="."
          method="get" accept-charset="utf-8">
      {{ searchform }}
      <input type="submit" value="GO"></input>
    </form>
  </li>
  {% if analyses %}

  <li class="grid_2">
    <p>
      <span>
        {% if analyses.has_previous %}
        {% if request.GET.q %}
        <a href="?page=1&q={{ request.GET.q }}">
          <i class="fas fa-arrow-alt-to-left"></i>
        </a>
        <a href="?page={{ analyses.previous_page_number }}&q={{ request.GET.q }}">
          <i class="fas fa-arrow-alt-left"></i>
        </a>
        {% else %}
        <a href="?page=1">
          <i class="fas fa-arrow-alt-to-left"></i>
        </a>
        <a href="?page={{ analyses.previous_page_number }}">
          <i class="fas fa-arrow-alt-left"></i>
        </a>
        {% endif %}
        {% endif %}

        <span>
          Page {{ analyses.number }} of {{ analyses.paginator.num_pages }}.
        </span>

        {% if analyses.has_next %}
        {% if request.GET.q %}
        <a href="?page={{ analyses.next_page_number }}&q={{ request.GET.q }}">
          <i class="fas fa-arrow-alt-right"></i>
        </a>
        <a href="?page={{ analyses.paginator.num_pages }}&q={{ request.GET.q }}">
          <i class="fas fa-arrow-alt-to-right">
        </a>
        {% else %}
        <a href="?page={{ analyses.next_page_number }}">
          <i class="fas fa-arrow-alt-right"></i>
        </a>
        <a href="?page={{ analyses.paginator.num_pages }}">
          <i class="fas fa-arrow-alt-to-right"></i>
        </a>
        {% endif %}
        {% endif %}
      </span>
    </p>
  </li>
  {% for video in analyses %}
  <li>
		<div>{{ video.name }}</div>
		<a href="/rowers/video/{{ video.id|encode }}/">
			<img src="https://img.youtube.com/vi/{{ video.video_id }}/hqdefault.jpg"/>
		</a>
	</li>
  {% endfor %}
  {% else %}
  <li class="grid_4">
    <p>
      No videos found
    </p>
  </li>
  {% endif %}
</ul>

{% endblock %}

{% block sidebar %}
{% include 'menu_analytics.html' %}
{% endblock %}
