Files
family_home_lab/portal/templates/files.html

59 lines
3.9 KiB
HTML

{% extends "base.html" %}
{% block title %}Files — {{ settings.APP_NAME }}{% endblock %}
{% block content %}
<div class="page" style="max-width:760px">
<h1 class="greeting">My files</h1>
<p class="muted">Upload pictures here from your computer — they instantly appear in the <strong>GIMP</strong> (and video/audio) apps, under the shared <code>/media</code> folder, in your own <code>{{ user.username }}/</code> subfolder.</p>
{% if ok %}<div class="form-success" style="background:#e8f7ec;color:#1aae39;border:1px solid #b8e6c7;padding:10px 12px;border-radius:8px">✅ Uploaded. It's now in GIMP under <code>{{ user.username }}/…</code></div>{% endif %}
{% if error %}<div class="form-error">{{ error }}</div>{% endif %}
<div class="admin-panel">
<div class="linkout-card stack">
<h2 class="section-title">Upload a picture</h2>
<form method="post" action="/files/upload" enctype="multipart/form-data">
<div class="form-field">
<input class="text-input" type="file" name="file" accept="image/*,.pdf,.txt,.md" required>
</div>
<button class="button button-primary width-full" type="submit">Upload</button>
</form>
<p class="faint margin-top" style="font: var(--type-caption)">
On your computer (e.g. <code>.27</code>) uploads go to the lab's shared folder on <code>.13</code>, which GIMP opens at <code>/media/{{ user.username }}/</code>.
</p>
</div>
<section class="stack">
<h2 class="section-title">Uploaded ({{ files|length }})</h2>
{% if files %}
<ul class="file-list" style="list-style:none;padding:0;margin:0">
{% for f in files %}
<li style="display:flex;flex-direction:column;gap:6px;padding:10px;border:1px solid var(--hairline,#e6e6e6);border-radius:8px;margin-bottom:8px">
<div style="display:flex;align-items:center;gap:12px">
{% if f.img %}
<img src="/files/raw/{{ f.name }}" alt="{{ f.name }}" style="width:56px;height:56px;object-fit:cover;border-radius:8px;border:1px solid var(--hairline,#e6e6e6)">
{% else %}
<span style="width:56px;height:56px;display:inline-flex;align-items:center;justify-content:center;border:1px solid var(--hairline,#e6e6e6);border-radius:8px;color:#999;font-size:11px">file</span>
{% endif %}
<span class="faint" style="flex:none">{{ (f.size/1024)|round(1) }} KB</span>
<span style="flex:1"></span>
<a class="button button-utility" href="/files/raw/{{ f.name }}" target="_blank" title="View {{ f.name }}" style="width:32px;height:32px;display:inline-flex;align-items:center;justify-content:center;padding:0;font-size:15px">👁</a>
<a class="button button-utility" href="/files/dl/{{ f.name }}" title="Download {{ f.name }}" style="width:32px;height:32px;display:inline-flex;align-items:center;justify-content:center;padding:0;font-size:17px">↓</a>
<form method="post" action="/files/delete" style="display:inline-flex">
<input type="hidden" name="name" value="{{ f.name }}">
<button class="button button-utility" type="submit" title="Delete {{ f.name }}" style="width:32px;height:32px;display:inline-flex;align-items:center;justify-content:center;padding:0;font-size:15px;border-color:#b3261e;color:#b3261e">🗑</button>
</form>
</div>
<div title="{{ f.name }}" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%;font:var(--type-body-sm);color:var(--ink)">{{ f.name }}</div>
</li>
{% endfor %}
</ul>
<p class="faint margin-top" style="font: var(--type-caption)">
To open one in GIMP: go to <code>gimp.lab.audasmedia.com.au</code> → <strong>File → Open</strong> → <code>/media/{{ user.username }}/…</code>.
</p>
{% else %}
<p class="faint">Nothing uploaded yet.</p>
{% endif %}
</section>
</div>
</div>
{% endblock %}