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

{% block title %}{{block.super}} &gt; Profil utilisateur : {{ user.username }}{% 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 profile_actif %}actif{% endblock %}

{% block main_content %}
    <h2>Mon profil</h2>
    <p><a href="{% url 'renkan_new' %}" >Nouveau Renkan</a> - <a href="{% url 'auth_password_change' %}">Modification du mot de passe</a></p>
    <p>&nbsp;</p>
    <p>Mes renkans : </p>
    <p>{% if page.has_previous %}<a href="?page={{ page.previous_page_number }}&sort={{ sort_param }}&order={{ order_param }}" >{% trans 'Previous' %}</a>{% endif %}
       {% if page.has_previous and page.has_next %} - {% endif %}{% if page.has_next %}<a href="?page={{ page.next_page_number }}&sort={{ sort_param }}&order={{ order_param }}">{% trans 'Next' %}</a>{% endif %}</p>
    <table id="rk-table">
      <thead>
        <tr class="border_bottom">
          <th><a href="?sort=title&order={% if sort_param == 'title' %}{{ opposite }}{% else %}asc{% endif %}">{% trans 'Title' %}</a>
              {% if sort_param == 'title' %}<span class="ui-icon {% if opposite == 'asc' %}ui-icon-triangle-1-s{% else %}ui-icon-triangle-1-n{% endif %}"></span>{% endif %}</th>
          <th><a href="?sort=date&order={% if sort_param == 'date' %}{{ opposite }}{% else %}desc{% endif %}">{% trans 'Modification date' %}</a>
              {% if sort_param == 'date' %}<span class="ui-icon {% if opposite == 'asc' %}ui-icon-triangle-1-s{% else %}ui-icon-triangle-1-n{% endif %}"></span>{% endif %}</th>
          <th>{% trans 'Preview' %}</th>
          <th><a href="?sort=state&order={% if sort_param == 'state' %}{{ opposite }}{% else %}asc{% endif %}">{% trans 'State' %}</a>
              {% if sort_param == 'state' %}<span class="ui-icon {% if opposite == 'asc' %}ui-icon-triangle-1-s{% else %}ui-icon-triangle-1-n{% endif %}"></span>{% endif %}</th>
          <th>{% trans 'Actions' %}</th>
        </tr>
      </thead>
      <tbody>
      {% for hr in page.object_list %}
       {% with hr.renkan as r %}
        <tr class="border_bottom">
            <td>{{ r.title }}</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>
                {% if hr.state == 1 %}<a title="Edit renkan" href="{% url 'renkan_edit' %}?rk_id={{ r.rk_id }}" class="renkan-basic-action"><span class="ui-icon ui-icon-pencil"></span></a>
                {% else %}<span class="ui-icon ui-icon-blank renkan-basic-action"></span>{% endif %}
                <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>
                <a title="Copy renkan" href="{% url 'renkan_copy' rk_id=r.rk_id %}?next={% url 'profile_home' %}" class="renkan-basic-action" onclick="return confirm('{% trans "Are you sure you want to copy this renkan ?" %}');" ><span class="ui-icon ui-icon-copy"></span></a>
                <a title="Remove renkan" href="{% url 'renkan_delete' rk_id=r.rk_id %}?next={% url 'profile_home' %}" class="renkan-basic-action" onclick="return confirm('{% trans "Are you sure you want to delete this renkan ? You cannot undo this action." %}');" ><span class="ui-icon ui-icon-trash"></span></a>
                {% if hr.state == 1 %}<a title="Publish renkan" href="{% url 'renkan_moderate' rk_id=r.rk_id state=2 %}?next={% url 'profile_home' %}" class="renkan-basic-action" onclick="return confirm('{% trans "Are you sure you want to ask 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 'profile_home' %}" 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 %}
            </td>
        </tr>
       {% endwith %}
      {% endfor %}
      </tbody>
    </table>
    <p>{% if page.has_previous %}<a href="?page={{ page.previous_page_number }}&sort={{ sort_param }}&order={{ order_param }}" >{% trans 'Previous' %}</a>{% endif %}
       {% if page.has_previous and page.has_next %} - {% endif %}{% if page.has_next %}<a href="?page={{ page.next_page_number }}&sort={{ sort_param }}&order={{ order_param }}">{% trans 'Next' %}</a>{% endif %}</p>
{% endblock %}