phase 1 backup - support for multi-file versioned upload

This commit is contained in:
JakeBreath
2026-08-03 22:46:22 -05:00
parent 5e58b8a183
commit f09acedbcf
14 changed files with 375 additions and 91 deletions
+68
View File
@@ -2705,3 +2705,71 @@ a.deletelink {
font-size: 0.75rem;
color: var(--md-sys-color-on-surface-variant);
}
/* ========== Project ID badge ========== */
.project-id-badge {
display: inline-block;
padding: 2px 8px;
border-radius: 999px;
background: var(--md-sys-color-surface-variant);
color: var(--md-sys-color-on-surface-variant);
font-size: 0.72rem;
font-weight: 600;
vertical-align: middle;
margin-left: 6px;
}
/* ========== Per-file version list ========== */
.version-downloads {
display: inline-block;
margin-left: 12px;
font-size: 0.75rem;
color: var(--md-sys-color-on-surface-variant);
}
.version-files {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin-top: 8px;
}
.version-file {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 6px 8px;
border-radius: 8px;
border: 1px solid var(--md-sys-color-outline-variant);
background: var(--md-sys-color-surface-variant);
max-width: 100%;
}
.version-file-thumb {
width: 40px;
height: 40px;
object-fit: cover;
border-radius: 6px;
}
.version-file-icon {
font-size: 1.4rem;
color: var(--md-sys-color-on-surface-variant);
}
.version-file-name {
font-size: 0.8rem;
word-break: break-all;
}
/* ========== Per-file caption on media previews ========== */
.file-caption {
position: absolute;
top: 6px;
left: 6px;
width: calc(100% - 44px);
background: rgba(0, 0, 0, 0.55);
color: #fff;
border: none;
border-radius: 6px;
font-size: 0.7rem;
padding: 3px 6px;
}
.file-caption::placeholder {
color: rgba(255, 255, 255, 0.7);
}
+1 -1
View File
@@ -12,7 +12,7 @@
const autosaveStatus = document.getElementById('autosave-status');
const csrf = getCookie('csrftoken');
const csrfHeader = csrf ? { 'X-CSRFToken': csrf } : {};
const FIELDS = ['title', 'summary', 'category', 'description', 'caption', 'version_name', 'changelog'];
const FIELDS = ['title', 'summary', 'category', 'description', 'version_name', 'changelog'];
function setStatus(text, state) {
autosaveStatus.innerHTML = text;
+11 -2
View File
@@ -30,10 +30,10 @@
zones[kind] = {
zone,
kind,
single: kind === 'thumbnail' || kind === 'version',
single: kind === 'thumbnail',
drop: zone.querySelector('.drop-zone'),
input: zone.querySelector('input[type=file]'),
preview: zone.querySelector('.upload-preview, #media-preview'),
preview: zone.querySelector('.file-preview-grid, .upload-preview'),
batch: zone.querySelector('.upload-batch'),
current: null,
busy: false,
@@ -78,6 +78,15 @@
name.textContent = upload.filename || '';
card.appendChild(name);
if (z.kind === 'media') {
const cap = document.createElement('input');
cap.type = 'text';
cap.className = 'file-caption';
cap.name = 'caption_' + upload.uuid;
cap.placeholder = 'caption…';
card.appendChild(cap);
}
if (upload.removable !== false) {
const remove = document.createElement('button');
remove.type = 'button';