{% extends "newsboard/base.html" %}
{% load i18n %}

{% block newsboard_action %}
{% if user.is_staff %}
<form action="" method="POST">
  {% csrf_token %}
  {% for stream in object_list %}
  <input type="hidden" name="stream_id" value="{{ stream.id }}">
  {% endfor %}
  <button type="submit" name="mode" value="async">{% trans "Update" %}</button>
  <button type="submit" name="mode" value="sync">{% trans "Update sync" %}</button>
</form>
{% endif %}
{% endblock %}

{% block newsboard_content %}
<div class="streams">
{% for stream in object_list %}
   <div class="stream" id="stream-{{ stream.slug }}">
    <h3>
    <a href="{{ stream.get_absolute_url }}">{{ stream.name }}</a>
     {% if user.is_staff %}
     <form action="" method="POST">
       {% csrf_token %}
       <input type="hidden" name="stream_id" value="{{ stream.id }}">
       <button type="submit" name="mode" value="async">{% trans "Update" %}</button>
       <button type="submit" name="mode" value="sync">{% trans "Update sync" %}</button>
     </form>
     {% endif %}
    </h3>
    <ul>
    {% for post in stream.last_posts %}
    <hr>
    <li id="post-{{ post.id }}"><a href="{{ post.url }}" target="_blank">{{ post.title|truncatechars:75 }}</a></li>
    {% empty %}
    <li>{% trans "(Empty)" %}</li>
    {% endfor %}
    </ul>
  </div>
{% endfor %}
</div>
{% endblock %}
