{% extends "base.html" %}
{% load static wagtailcore_tags %}

{% block body_class %}template-{{ self.get_verbose_name|slugify }}{% endblock %}

{% block extra_css %}
{% endblock %}

{% block title %}Feeds{% endblock %}

{% block content %}

<section id="article-index" class="article-index-page">
	<div class="container">
		<h2>{{ page.title }}</h2>
		{% if page.intro %}
			<p class="lead">{{ page.intro|richtext }}</p>
		{% endif %}
	</div>
</section>


<!-- Page body -->
<section id="news" class="feedpage-body">
	<div class="container">

		<!-- Pagination -->
		<center>
			<ul class="pagination">
			  {% if feedentries.has_previous %}
			    <li><a href="?page={{ feedentries.previous_page_number }}" title="Previous">
						<span class="glyphicon glyphicon-arrow-left" aria-hidden="true"></span></a></li>
			  {% endif %}
			  {% for page_num in feedentries.paginator.page_range %}
			    <li {% if page_num == feedentries.number %}class="active"{% endif %}>
						<a href="?page={{ page_num }}">{{ page_num }}</a></li>
			  {% endfor %}
				{% if feedentries.has_next %}
				  <li><a href="?page={{ feedentries.next_page_number }}" title="Next">
						<span class="glyphicon glyphicon-arrow-right" aria-hidden="true"></span></a></li>
				{% endif %}
			</ul>
		</center>

		<div class="row">
      {% for entry in feedentries %}
			<div class="col-md-4 col-sm-6 col-xs-12 news-entry">
				{% if entry.visual %}
				<div class="panel panel-default">
					<img src="{{ entry.visual }}">
				{% else %}
				<div class="panel panel-fulltext">
				{% endif %}
					<div class="panel-body">
						<h3><span>{{ entry.title|striptags|truncatewords_html:10 }}</span></h3>
						<p>
							{{ entry.content|striptags|truncatewords_html:25 }}
							<em><span>{{ entry.author }}</span></em>
						</p>
					</div>
					<a href="{{ entry.link }}" target="_blank" class="fill"></a>
				</div>
			</div>
			{% empty %}
			    <!-- No news today -->
	    {% endfor %}
		</div>
	</div>
</section>

{% endblock %}
