up
This commit is contained in:
parent
4072e9888c
commit
86c3b88f97
@ -1,14 +1,13 @@
|
||||
{{ define "_file_detail" }}
|
||||
<div class="box">
|
||||
{{ 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="/app/upload/{{ .Path }}">
|
||||
</figure>
|
||||
{{ end }}
|
||||
<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")) }}
|
||||
<figure class="image">
|
||||
<img src="/static/uploads/{{ .Entry.Path }}">
|
||||
</figure>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
{{ end }}
|
||||
|
||||
@ -1,30 +1,16 @@
|
||||
{{ define "_file_list" }}
|
||||
<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">
|
||||
<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>
|
||||
<!-- … contenu de la carte … -->
|
||||
</div>
|
||||
</div>
|
||||
{{- end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
@ -43,7 +43,11 @@
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a hx-get="/folders" class="nav-link" hx-target="#content" hx-swap-oob="beforeend">Folders</a></li>
|
||||
<li> <a hx-get="/folders"
|
||||
hx-target="#content"
|
||||
hx-swap="innerHTML">
|
||||
Folders
|
||||
</li>
|
||||
<li><a hx-get="/settings" class="nav-link" hx-target="#content" hx-swap-oob="beforeend">Settings</a></li>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@ -1,80 +1,71 @@
|
||||
{{ define "folders" }}
|
||||
<section class="section">
|
||||
<div class="container is-fluid">
|
||||
<div class="columns">
|
||||
<!-- Sidebar interne si besoin -->
|
||||
<div class="column is-2">
|
||||
<aside class="menu">
|
||||
<p class="menu-label">Dossiers</p>
|
||||
<ul class="menu-list">
|
||||
{{- range .Dirs }}
|
||||
<li>
|
||||
<a
|
||||
hx-get="/folders?path={{ urlquery .Path }}"
|
||||
hx-target="#file-list"
|
||||
hx-swap="innerHTML"
|
||||
hx-push-url="true"
|
||||
class="{{ if eq $.CurrentPath .Path }}is-active{{ end }}"
|
||||
>
|
||||
{{ .Name }}
|
||||
</a>
|
||||
</li>
|
||||
{{- end }}
|
||||
</ul>
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
|
||||
<section class="section">
|
||||
<div class="container is-fluid">
|
||||
<div class="columns">
|
||||
|
||||
<!-- Sidebar -->
|
||||
<div class="column is-2">
|
||||
<aside class="menu">
|
||||
<p class="menu-label">Dossiers</p>
|
||||
<ul class="menu-list">
|
||||
{{- range .Dirs }}
|
||||
<li>
|
||||
<a
|
||||
hx-get="/folders?path={{ urlquery .Name }}"
|
||||
hx-target="#file-list"
|
||||
hx-push-url="true"
|
||||
class="{{ if eq $.CurrentPath .Name }}is-active{{ end }}"
|
||||
>
|
||||
{{ .Name }}
|
||||
</a>
|
||||
</li>
|
||||
<!-- Grille principale -->
|
||||
<div class="column is-7">
|
||||
<nav class="breadcrumb" aria-label="breadcrumbs">
|
||||
<ul>
|
||||
<li>
|
||||
<a hx-get="/folders"
|
||||
hx-target="#file-list"
|
||||
hx-swap="innerHTML"
|
||||
hx-push-url="true">
|
||||
Home
|
||||
</a>
|
||||
</li>
|
||||
{{- $parts := split .CurrentPath "/" }}
|
||||
{{- $acc := "" }}
|
||||
{{- range $i, $p := $parts }}
|
||||
{{- if ne $p "" }}
|
||||
{{- $acc = printf "%s/%s" $acc $p }}
|
||||
<li class="is-active">
|
||||
<a hx-get="/folders?path={{ urlquery (trimPrefix "/" $acc) }}"
|
||||
hx-target="#file-list"
|
||||
hx-swap="innerHTML"
|
||||
hx-push-url="true">
|
||||
{{ $p }}
|
||||
</a>
|
||||
</li>
|
||||
{{- end }}
|
||||
</ul>
|
||||
</aside>
|
||||
{{- end }}
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<div id="file-list">
|
||||
{{ template "_file_list" . }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Grille -->
|
||||
<div class="column is-7">
|
||||
<nav class="breadcrumb" aria-label="breadcrumbs">
|
||||
<ul>
|
||||
<li>
|
||||
<a
|
||||
hx-get="/folders"
|
||||
hx-target="#file-list"
|
||||
hx-push-url="true"
|
||||
>
|
||||
Home
|
||||
</a>
|
||||
</li>
|
||||
{{- $parts := split .CurrentPath "/" }}
|
||||
{{- $acc := "" }}
|
||||
{{- range $i, $p := $parts }}
|
||||
{{- if ne $p "" }}
|
||||
{{- $acc = printf "%s/%s" $acc $p }}
|
||||
<li class="is-active">
|
||||
<a
|
||||
hx-get="/folders?path={{ urlquery (trimPrefix "/" $acc) }}"
|
||||
hx-target="#file-list"
|
||||
hx-push-url="true"
|
||||
>
|
||||
{{ $p }}
|
||||
</a>
|
||||
</li>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<div
|
||||
id="file-list"
|
||||
hx-trigger="load"
|
||||
hx-get="/folders?path={{ urlquery .CurrentPath }}"
|
||||
hx-target="#file-list"
|
||||
>
|
||||
{{ template "_file_list.pages.tmpl" . }}
|
||||
</div>
|
||||
<!-- Détails -->
|
||||
<div class="column is-3">
|
||||
<div id="detail-panel">
|
||||
<em>Sélectionnez un fichier ou un dossier…</em>
|
||||
</div>
|
||||
|
||||
<!-- Détails -->
|
||||
<div class="column is-3">
|
||||
<div id="detail-panel">
|
||||
<em>Sélectionnez un fichier ou dossier…</em>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
{{ end }}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user