alpinux-static/app/templates/_file_table.html
Alpinux b3af420d36 feat: corbeille avec purge automatique 30 jours
- Suppression déplace dans .trash/ (arborescence préservée + .trashinfo)
- /trash : liste, restauration (conflit overwrite/rename), suppression
  définitive, vidage complet
- Purge automatique des fichiers > 30 jours à chaque visite /trash
- Badge rouge dans la nav avec le nombre de fichiers en corbeille
- Extraction du tableau de fichiers en partial _file_table.html
  partagé entre browse et trash

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 10:40:35 +02:00

124 lines
4.4 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{#
Partial : tableau de fichiers.
Paramètres de contexte :
entries liste de dicts (champs _entry ou _trash_list)
mode "browse" | "trash"
has_hits booléen (browse uniquement)
humansize filtre taille
subpath chemin courant (browse uniquement, pour la ligne "..")
breadcrumb liste de crumbs (browse uniquement)
#}
<table class="file-table">
<thead>
<tr>
<th class="col-icon"></th>
<th>Nom</th>
{% if mode == 'trash' %}
<th class="col-origin">Emplacement d'origine</th>
<th class="col-date">Supprimé le</th>
<th class="col-size">Taille</th>
{% else %}
<th class="col-size">Taille</th>
<th class="col-date">Modifié le</th>
{% if has_hits %}<th class="col-hits">Vues</th>{% endif %}
{% endif %}
<th class="col-actions"></th>
</tr>
</thead>
<tbody>
{% if mode == 'browse' and subpath %}
<tr>
<td class="col-icon"></td>
<td>
{% if breadcrumb | length > 1 %}
<a href="{{ url_for('browse', subpath=breadcrumb[-2].path) }}">.. (dossier parent)</a>
{% else %}
<a href="{{ url_for('browse') }}">.. (racine)</a>
{% endif %}
</td>
<td></td><td></td>
{% if has_hits %}<td></td>{% endif %}
<td></td>
</tr>
{% endif %}
{% for e in entries %}
<tr>
<td class="col-icon">
{%- if e.is_dir -%}📁
{%- elif e.is_image -%}🖼
{%- elif e.is_pdf -%}📕
{%- elif e.is_text -%}📄
{%- else -%}📎
{%- endif -%}
</td>
<td>
<div class="col-name">
{% if e.is_image %}
<img class="thumb-sm"
src="{{ url_for('trash_raw' if mode == 'trash' else 'raw_file', subpath=e.path) }}"
alt="{{ e.name }}" loading="lazy">
{% endif %}
{% if mode == 'trash' %}
<span class="trash-filename">{{ e.name }}</span>
{% else %}
<a href="{{ url_for('browse', subpath=e.path) }}">
{{ e.name }}{% if e.is_dir %}/{% endif %}
</a>
{% endif %}
{% if e.ext and not e.is_dir %}
<span class="type-badge">{{ e.ext }}</span>
{% endif %}
</div>
</td>
{% if mode == 'trash' %}
<td class="col-origin" title="{{ e.original_path }}">{{ e.original_path }}</td>
<td class="col-date">{{ e.deleted_at.strftime('%d/%m/%Y %H:%M') }}</td>
<td class="col-size">{{ humansize(e.size) }}</td>
{% else %}
<td class="col-size">{{ humansize(e.size) if e.size is not none else '—' }}</td>
<td class="col-date">{{ e.mtime.strftime('%d/%m/%Y %H:%M') }}</td>
{% if has_hits %}
<td class="col-hits">
{% if not e.is_dir %}
{% if e.hits %}
<span class="hits-badge hits-active" title="{{ e.hits }} requête(s) dans les stats">{{ e.hits }}</span>
{% else %}
<span class="hits-badge hits-zero" title="Aucune vue">0</span>
{% endif %}
{% endif %}
</td>
{% endif %}
{% endif %}
<td class="col-actions">
{% if mode == 'browse' and not e.is_dir %}
<div class="row-actions">
<button type="button" class="btn-rename"
data-path="{{ e.path }}" data-name="{{ e.name }}"
title="Renommer">✏️</button>
<form method="post" action="{{ url_for('delete_file') }}" style="display:contents">
<input type="hidden" name="path" value="{{ e.path }}">
<button type="submit" class="btn-del" title="Mettre à la corbeille">🗑</button>
</form>
</div>
{% elif mode == 'trash' %}
<div class="row-actions">
<button type="button" class="btn-restore"
data-path="{{ e.path }}" title="Restaurer">♻️</button>
<form method="post" action="{{ url_for('trash_delete') }}" style="display:contents">
<input type="hidden" name="path" value="{{ e.path }}">
<button type="submit" class="btn-del btn-del--perm"
title="Supprimer définitivement"
onclick="return confirm('Supprimer définitivement {{ e.name|replace("'","\\'")|replace('"','&quot;') }} ?')">🗑</button>
</form>
</div>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>