This commit is contained in:
julien 2025-06-20 17:05:28 +02:00
parent 05a20e6253
commit 6454d436ae
3 changed files with 100 additions and 76 deletions

View File

@ -1,13 +1,14 @@
<div class="box">
<h4 class="title is-5">{{ .Entry.Name }}</h4>
<p><strong>Type :</strong> {{ ext .Entry.Name }}</p>
<p><strong>Taille :</strong> {{ printf "%.1f KB" (toKB .Entry.Size) }}</p>
<p><strong>Modifié :</strong> {{ .Entry.ModTime.Format "02 Jan 2006 15:04" }}</p>
{{ if and (not .Entry.IsDir) (or (hasSuffix .Entry.Name ".jpg") (hasSuffix .Entry.Name ".png")) }}
{{ with .Entry }}
<h4 class="title is-5">{{ .Name }}</h4>
<p><strong>Type :</strong> {{ ext .Name }}</p>
<p><strong>Taille :</strong> {{ printf "%.1f KB" (toKB .Size) }}</p>
<p><strong>Modifié le :</strong> {{ .ModTime.Format "02 Jan 2006 15:04" }}</p>
{{ if and (not .IsDir) (or (hasSuffix .Name ".jpg") (hasSuffix .Name ".png")) }}
<figure class="image">
<img src="/static/uploads/{{ .Entry.Path }}">
<img src="/app/upload/{{ .Path }}">
</figure>
{{ end }}
{{ end }}
</div>

View File

@ -1,16 +1,30 @@
<div class="columns is-multiline">
{{- range .Entries }}
<div class="column is-4-mobile is-3-tablet">
<div class="card"
hx-get="{{ if .IsDir }}/folders?path={{ urlquery .Path }}{{ else }}/folders/detail?path={{ urlquery .Path }}{{ end }}"
hx-get="{{ if .IsDir }}
/folders?path={{ urlquery .Path }}
{{ else }}
/folders/detail?path={{ urlquery .Path }}
{{ end }}"
hx-target="{{ if .IsDir }}#file-list{{ else }}#detail-panel{{ end }}"
hx-swap="innerHTML"
hx-push-url="true"
style="cursor:pointer">
<!-- … contenu de la carte … -->
<div class="card-image">
<figure class="image is-4by3">
{{ if .IsDir }}
<i class="fas fa-folder fa-3x has-text-warning" style="margin:1rem"></i>
{{ else if or (hasSuffix .Name ".jpg") (hasSuffix .Name ".png") }}
<img src="/app/upload/{{ .Path }}" alt="{{ .Name }}">
{{ else }}
<i class="fas fa-file fa-3x"></i>
{{ end }}
</figure>
</div>
<div class="card-content">
<p class="title is-6">{{ .Name }}</p>
</div>
</div>
</div>
{{- end }}
</div>

View File

@ -1,8 +1,10 @@
<section class="section">
<div class="container is-fluid">
<div class="columns">
<!-- Sidebar interne si besoin -->
<!-- Sidebar -->
<div class="column is-2">
<aside class="menu">
<p class="menu-label">Dossiers</p>
@ -10,11 +12,10 @@
{{- range .Dirs }}
<li>
<a
hx-get="/folders?path={{ urlquery .Path }}"
hx-get="/folders?path={{ urlquery .Name }}"
hx-target="#file-list"
hx-swap="innerHTML"
hx-push-url="true"
class="{{ if eq $.CurrentPath .Path }}is-active{{ end }}"
class="{{ if eq $.CurrentPath .Name }}is-active{{ end }}"
>
{{ .Name }}
</a>
@ -24,15 +25,16 @@
</aside>
</div>
<!-- Grille principale -->
<!-- Grille -->
<div class="column is-7">
<nav class="breadcrumb" aria-label="breadcrumbs">
<ul>
<li>
<a hx-get="/folders"
<a
hx-get="/folders"
hx-target="#file-list"
hx-swap="innerHTML"
hx-push-url="true">
hx-push-url="true"
>
Home
</a>
</li>
@ -42,10 +44,11 @@
{{- if ne $p "" }}
{{- $acc = printf "%s/%s" $acc $p }}
<li class="is-active">
<a hx-get="/folders?path={{ urlquery (trimPrefix "/" $acc) }}"
<a
hx-get="/folders?path={{ urlquery (trimPrefix "/" $acc) }}"
hx-target="#file-list"
hx-swap="innerHTML"
hx-push-url="true">
hx-push-url="true"
>
{{ $p }}
</a>
</li>
@ -54,17 +57,23 @@
</ul>
</nav>
<div id="file-list">
{{ template "_file_list" . }}
<div
id="file-list"
hx-trigger="load"
hx-get="/folders?path={{ urlquery .CurrentPath }}"
hx-target="#file-list"
>
{{ template "_file_list.pages.tmpl" . }}
</div>
</div>
<!-- Détails -->
<div class="column is-3">
<div id="detail-panel">
<em>Sélectionnez un fichier ou un dossier…</em>
<em>Sélectionnez un fichier ou dossier…</em>
</div>
</div>
</div>
</div>
</section>