{% extends "base.html" %}
{% load i18n %}
{% load static %}
{% load thumbnail %}
{% load hdalab_tags %}

{% block title %}{{block.super}} &gt; {% trans 'Manage renkan publication' %}{% endblock %}

{% block css_import %}
{{block.super}}
    <link rel="stylesheet" type="text/css" href="{% static 'hdalab/css/index.css' %}" />
    <link rel="stylesheet" type="text/css" href="{% static 'hdalab/css/ui-lightness/jquery-ui-1.10.4.min.css' %}" />
    <link rel="stylesheet" type="text/css" href="{% static 'hdalab/css/profile.css' %}" />
{% endblock %}

{% block js_import %}
{{block.super}}
    <script src="{% static 'hdalab/js/profile.js' %}"></script>
    <script src="{% static 'hdalab/lib/jquery.tablesorter.min.js' %}"></script> 
    <script type="text/javascript">
    $(document).ready(function(){
        $("#rk-table").tablesorter({headers: { 3: { sorter: false }, 5: { sorter: false } }}); 
    });
    </script>
{% endblock %}

{% block main_content %}
    <table id="rk-table">
      <thead>
        <tr class="border_bottom"><th>Nom</th><th>Utilisateur</th><th>Date de modification</th><th>Preview</th><th>Statut</th><th>Actions</th></tr>
      </thead>
      <tbody>
      {% for hr in renkan_list %}
       {% with hr.renkan as r %}
        <tr class="border_bottom">
            <td>{{ r.title }}</td>
            <td>{{ r.owner.username }}</td>
            <td>{{ r.modification_date|date:"Y-m-d H:i" }}</td>
            <td>{% thumbnail r.image 100x100 as thumb %}<img src="{{ thumb.url }}" width="{{ thumb.width }}" height="{{ thumb.height }}" /></td>
            <td>{{ hr.state|state_to_str }}</td>
            <td>
                <a title="View renkan" href="{% url 'renkan_view' %}?rk_id={{ r.rk_id }}" class="renkan-basic-action"><span class="ui-icon ui-icon-eye"></span></a>
                {% if hr.state == 2 or hr.state == 4 %}<a title="Publish renkan" href="{% url 'renkan_moderate' rk_id=r.rk_id state=3 %}?next={% url 'manage_renkans' %}" class="renkan-basic-action" onclick="return confirm('{% trans "Are you sure you want to PUBLISH this renkan ?" %}');" ><span class="ui-icon ui-icon-unlocked"></span></a>
                {% else %}<a title="Unpublish renkan" href="{% url 'renkan_moderate' rk_id=r.rk_id state=1 %}?next={% url 'manage_renkans' %}" class="renkan-basic-action" onclick="return confirm('{% trans "Are you sure you want to UNPUBLISH this renkan ?" %}');" ><span class="ui-icon ui-icon-locked"></span></a>{% endif %}
                {% if hr.state != 4 %}<a title="Reject renkan" href="{% url 'renkan_moderate' rk_id=r.rk_id state=4 %}?next={% url 'manage_renkans' %}" class="renkan-basic-action" onclick="return confirm('{% trans "Are you sure you want to REJECT this renkan ?" %}');" ><span class="ui-icon ui-icon-close"></span></a>{% endif %}
            </td>
        </tr>
       {% endwith %}
      {% endfor %}
      </tbody>
    </table>
{% endblock %}