{% load seahub_tags i18n %}

{% for dirent in dir_entries %}
{% if dirent.is_dir %}
<tr>
    <td class="alc"><img src="{{ MEDIA_URL }}img/folder-24.png" alt="{% trans "Folder" %}" /></td>
    {% if show_recycle_root %}
    <td><a href="?commit_id={{ dirent.commit_id }}&base={{ dirent.basedir|urlencode }}&p=/{{ dirent.obj_name|urlencode }}&dir_path={{dir_path|urlencode}}&referer={{referer|urlencode}}">{{ dirent.obj_name }}</a></td>
    <td>{{ dirent.delete_time|translate_seahub_time }}</td>
    <td></td>
    <td><a class="op restore-dir vh" href="#" data-commit_id="{{dirent.commit_id}}" data-path="{{dirent.basedir}}{{dirent.obj_name}}" data-url="{% url 'api2-dir-revert' repo.id %}">{% trans "Restore" %}</a></td>
    {% else %}
    <td><a href="?commit_id={{ commit_id }}&base={{ basedir|urlencode }}&p={{ path|urlencode }}{{ dirent.obj_name|urlencode }}&dir_path={{dir_path|urlencode}}&referer={{referer|urlencode}}">{{ dirent.obj_name }}</a></td>
    <td></td>
    <td></td>
    <td></td>
    {% endif %}
</tr>
{% else %}
<tr>
    <td class="alc"><img src="{{ MEDIA_URL }}img/file/{{ dirent.obj_name|file_icon_filter }}" alt="{% trans "File" %}" /></td>
    {% if show_recycle_root %}
    <td><a class="normal" href="{% url 'view_trash_file' repo.id %}?obj_id={{ dirent.obj_id }}&commit_id={{ dirent.commit_id }}&base={{ dirent.basedir|urlencode }}&p=/{{ dirent.obj_name|urlencode }}" target="_blank">{{ dirent.obj_name }}</a></td>
    <td>{{ dirent.delete_time|translate_seahub_time }}</td>
    <td>{{ dirent.file_size|filesizeformat }}</td>
    <td><a class="op restore-file vh" href="#" data-commit_id="{{dirent.commit_id}}" data-path="{{dirent.basedir}}{{dirent.obj_name}}" data-url="{% url 'api2-file-revert' repo.id %}">{% trans "Restore" %}</a></td>
    {% else %}
    <td><a class="normal" href="{% url 'view_trash_file' repo.id %}?obj_id={{ dirent.obj_id }}&commit_id={{ commit_id }}&base={{ basedir|urlencode }}&p={{ path|urlencode }}{{ dirent.obj_name|urlencode }}" target="_blank">{{ dirent.obj_name }}</a></td>
    <td></td>
    <td>{{ dirent.file_size|filesizeformat }}</td>
    <td></td>
    {% endif %}
</tr>
{% endif %}
{% endfor %}
