{% extends "admin/filer/base_site.html" %}
{% load i18n staticfiles filer_admin_tags %}

{% block extrahead %}{{ block.super }}
{# upload stuff #}
{{ media.js }}
<script type="text/javascript" src="{% static "admin/js/jquery.min.js" %}"></script>
<script type="text/javascript" src="{% static "filer/js/jquery.cookie.js" %}"></script>
<script type="text/javascript" src="{% static "filer/js/fileuploader.js" %}"></script>
<script type="text/javascript" src="{% static "filer/js/retina.js" %}"></script>
<script type="text/javascript" src="{% static "admin/js/admin/RelatedObjectLookups.js" %}"></script>
<script type="text/javascript" src="{% static "filer/js/popup_handling.js" %}"></script>
{% if action_form %}{% if actions_on_top or actions_on_bottom %}
<script type="text/javascript">
(function($) {
    $(document).ready(function($) {
        $("tr input.action-select").actions();
    });
})(django.jQuery);
</script>
{% endif %}{% endif %}
{% endblock %}

{% block coltype %}{% endblock %}
{% block bodyclass %}change-list filebrowser{% endblock %}


{% block extrastyle %}{{ block.super }}
<link rel="stylesheet" type="text/css" href="{% static "admin/css/changelists.css" %}" />
{{ media.css }}
{% if action_form %}
  {% url 'admin:jsi18n' as jsi18nurl %}
  <script type="text/javascript" src="{{ jsi18nurl|default:'../../jsi18n/' }}"></script>
{% endif %}
{% if query.pop %}
<style type="text/css">
    #header { display: none; }
</style>
{% endif %}
{% if not actions_on_top and not actions_on_bottom %}
<style>
    #changelist table thead th:first-child {width: inherit}
</style>
{% endif %}
{% endblock %}

{% block breadcrumbs %}
{% with folder as instance %}
{% include "admin/filer/breadcrumbs.html" %}
{% endwith %}
{% endblock %}


{% block sidebar %}{% endblock %}


{% block content_title %}<h2>&nbsp;</h2>{% endblock %}
{% block content %}
<div id="content-top-bar">
    {% if not folder.is_root %}
            <h1 class="folder_header">
                {% if folder.parent %}
                    <a class="backtoroot" href="{% url 'admin:filer-directory_listing' folder.parent.id %}{% if is_popup %}?_popup=1{% if select_folder %}&select_folder=1{% endif %}{% endif %}" title="{% trans "Go back to the parent folder" %}">&uarr;</a>
                {% else %}
                    <a class="backtoroot" href="{% url 'admin:filer-directory_listing-root' %}{% if is_popup %}?_popup=1{% if select_folder %}&select_folder=1{% endif %}{% endif %}" title="{% trans "Go back to" %} {% trans "root"|title %} {% trans "folder" %}">&uarr;</a>
                {% endif %}
                <img src="{{ folder.icons.32 }}" alt="" /> {{ folder.name }}
                <span class="small quiet">({% blocktrans count folder.children_count as counter %}{{ counter }} folder{% plural %}{{ counter }} folders{% endblocktrans %}, {% blocktrans count folder.file_count as counter %}{{ counter }} file{% plural %}{{ counter }} files{% endblocktrans %})</span>
            </h1>
    {% else %}
        {% if folder.is_smart_folder %}
            <h1 class="folder_header"><a class="backtoroot" href="{% url 'admin:filer-directory_listing-root' %}{% if is_popup %}?_popup=1{% if select_folder %}&select_folder=1{% endif %}{% endif %}">&uarr;</a>
                <img src="{{ folder.icons.32 }}" alt="" /> {{ folder.name }}
            </h1>
        {% endif %}
    {% endif %}
    {% block object-tools %}
        <ul class="object-tools">
            <li>
                {% if is_popup %}
                    {% if select_folder and folder.file_type == 'Folder' %}<a class="insertlink insertlinkButton" href="" onclick="opener.dismissRelatedFolderLookupPopup(window, {{ folder.id }}, '{{ folder.quoted_logical_path }}'); return false;" >&nbsp;</a>{% endif %}
                {% else %}
                    {% if permissions.has_edit_permission %}
                        <a style="display: block; float: right;" class="changelink" href="{% url 'admin:filer_folder_change' folder.id %}" title="{% trans "Change current folder details" %}">{% trans "Change" %}</a>
                    {% endif %}
                {% endif %}
            </li>
            {% block object-tools-items %}
                {% if folder.can_have_subfolders %}{% if can_make_folder %}<li><a id="id_new_folder" href="{% url 'admin:filer-directory_listing-make_root_folder' %}?parent_id={{ folder.id }}" class="addlink" onclick="return showAddAnotherPopup(this);" title="{% trans "Adds a new Folder" %}">{% trans "New Folder" %}</a>{% endif %}{% endif %}</li>
                <li><a id="id_upload_button" href="#" class="addlink" title="{% trans 'upload files' %}">{% trans 'Upload' %}</a></li>
                {% include 'admin/filer/tools/upload_button_js.html' %}
            {% endblock %}
        </ul>
    {% endblock %}
</div>
<div id="content-main">

    <div class="module" id="changelist">
        {% include "admin/filer/tools/search_form.html" %}
        <form id="changelist-form" action="" method="post">{% csrf_token %}
        {% if is_popup %}<input type="hidden" name="_popup" value="1" />{% endif %}
        {% if action_form and actions_on_top and paginator.count and not select_folder and not is_popup %}{% filer_actions %}{% endif %}
        {% include "admin/filer/folder/directory_table.html" %}
        {% if action_form and actions_on_bottom and paginator.count and not select_folder and not is_popup %}{% filer_actions %}{% endif %}
        </form>
        {% include "admin/filer/tools/clipboard/clipboard.html" %}
    </div>
</div>

{% endblock %}
