{% extends "sveedocuments/board/subbase_pages.html" %}
{% load i18n autobreadcrumb crispy_forms_tags %}

{% block head_base_js %}{{ block.super }}
    <script type="text/javascript">
    //<![CDATA[
    $(document).ready(function() {
        $("#id_slug").slugify("#id_title");
    });
    //]]>
    </script>
{% endblock %}

{% block board_content %}
    <div class="clearfix">
        {% if page_instance and page_instance.visible %}<a class="secondary button right" href="{% url 'sveedocuments:page-details' page_instance.slug %}">{% trans "View on site" %}</a>{% endif %}
        <h2>{% current_title_from_breadcrumbs %}</h2>
    </div>
    
    {% include "sveedocuments/board/includes/page_form_subnav.html" with active_tab="attachments" %}
    
    <ul class="feed">{% for item in object_list %}
        <li>
            <p class="ago">
                {% blocktrans with created=item.created|timesince author=item.author.get_full_name %}{{ created }} ago - By <em>{{ author }}</em>{% endblocktrans %}
            </p>
            <p><strong>{% trans "Title" %} :</strong> {{ item.title }}</p>
            <p><strong>{% trans "Slug" %} :</strong> {{ item.slug }}</p>
            <p>
                {% if ATTACHMENTS_WITH_SENDFILE %}
                    <a class="tiny round secondary button" target="_blank" href="{% url 'sveedocuments:page-attachment-download' slug=page_instance.slug attachment_id=item.id %}">{% trans "View" %}</a>
                {% else %}
                    <a class="tiny round secondary button" target="_blank" href="{{ item.file.url }}">{% trans "View" %}</a>
                {% endif %}
                <a class="tiny round alert button" href="{% url 'sveedocuments:page-attachments-delete' slug=page_instance.slug pk=item.id %}">{% trans "Delete" %}</a>
            </p>
        </li>
    {% empty %}
        <li class="empty">{% trans "There is no attachments" %}</li>
    {% endfor %}</ul>
    
    <hr>
    
    <h3>{% trans "Add a new attachment" %}</h3>
    {% crispy form %}
{% endblock %}