| 1 |
{%- import "partials/_ui.html" as ui -%} |
| 2 |
<div class="version-upload" id="version-upload" data-item-id="{{ item.id }}"> |
| 3 |
|
| 4 |
{% if versions.is_empty() %} |
| 5 |
{% call ui::empty_state("", "No versions uploaded yet. Create your first version below.") %} |
| 6 |
{% else %} |
| 7 |
<table class="data-table"> |
| 8 |
<thead> |
| 9 |
<tr> |
| 10 |
<th>Version</th> |
| 11 |
<th>Label</th> |
| 12 |
<th>File</th> |
| 13 |
<th>Size</th> |
| 14 |
<th>Downloads</th> |
| 15 |
<th>Actions</th> |
| 16 |
</tr> |
| 17 |
</thead> |
| 18 |
<tbody> |
| 19 |
{% for version in versions %} |
| 20 |
<tr> |
| 21 |
<td><span class="badge{% if version.is_current %} current{% endif %}">v{{ version.number }}</span></td> |
| 22 |
<td class="item-version-upload-cell-sm">{% if let Some(label) = version.label %}{{ label }}{% endif %}</td> |
| 23 |
<td class="item-version-upload-cell-sm">{% if version.has_file %}{% match version.file_name %}{% when Some with (name) %}{{ name }}{% when None %}1 file{% endmatch %}{% else %}<span class="item-version-upload-no-file">No file</span>{% endif %}</td> |
| 24 |
<td>{{ version.size }}</td> |
| 25 |
<td>{{ version.downloads }}</td> |
| 26 |
<td> |
| 27 |
{% if version.has_file %} |
| 28 |
<button class="btn-secondary download-version-btn item-version-upload-btn" |
| 29 |
data-version-id="{{ version.id }}">Download</button> |
| 30 |
{% else %} |
| 31 |
<button class="btn-secondary upload-to-version-btn item-version-upload-btn" |
| 32 |
data-version-id="{{ version.id }}">Upload File</button> |
| 33 |
{% endif %} |
| 34 |
<button class="btn-secondary delete-version-btn item-version-upload-btn" |
| 35 |
data-version-id="{{ version.id }}">Delete</button> |
| 36 |
</td> |
| 37 |
</tr> |
| 38 |
{% endfor %} |
| 39 |
</tbody> |
| 40 |
</table> |
| 41 |
{% endif %} |
| 42 |
|
| 43 |
|
| 44 |
<div id="new-version-form"> |
| 45 |
<div class="item-version-upload-grid"> |
| 46 |
<div class="form-group"> |
| 47 |
<label for="new-version-number">Version Number</label> |
| 48 |
<input type="text" id="new-version-number" placeholder="e.g., 1.0"> |
| 49 |
</div> |
| 50 |
<div class="form-group"> |
| 51 |
<label for="version-changelog">Notes (optional)</label> |
| 52 |
<input type="text" id="version-changelog" placeholder="What changed in this version..."> |
| 53 |
</div> |
| 54 |
</div> |
| 55 |
|
| 56 |
<div class="form-group"> |
| 57 |
<label>Files</label> |
| 58 |
<div class="upload-hint item-version-upload-hint">Add one file per platform. Each gets its own label (e.g. "macOS (arm)", "Linux (x86_64)").</div> |
| 59 |
|
| 60 |
<table class="item-version-upload-file-table" id="version-file-table"> |
| 61 |
<thead> |
| 62 |
<tr> |
| 63 |
<th>File</th> |
| 64 |
<th>Label</th> |
| 65 |
<th></th> |
| 66 |
</tr> |
| 67 |
</thead> |
| 68 |
<tbody id="version-file-rows"></tbody> |
| 69 |
</table> |
| 70 |
|
| 71 |
<div class="item-version-upload-add-row"> |
| 72 |
<input type="file" id="version-file-input" class="sr-only" |
| 73 |
accept=".zip,.dmg,.exe,.appimage,.deb,.tar.gz,.clap,.vst3" multiple> |
| 74 |
<button type="button" class="btn-secondary item-version-upload-add-btn" id="add-version-file-btn">Add Files</button> |
| 75 |
</div> |
| 76 |
</div> |
| 77 |
|
| 78 |
<button class="btn-primary" id="create-version-btn">Upload All</button> |
| 79 |
</div> |
| 80 |
|
| 81 |
|
| 82 |
<div class="hidden" id="existing-version-upload"> |
| 83 |
<div class="file-upload-area" id="existing-version-dropzone"> |
| 84 |
<div class="upload-text">Drop file to upload for this version</div> |
| 85 |
<div class="upload-hint">ZIP, DMG, EXE, AppImage, DEB, tar.gz, CLAP, VST3</div> |
| 86 |
<input type="file" id="existing-version-file-input" class="sr-only" |
| 87 |
accept=".zip,.dmg,.exe,.appimage,.deb,.tar.gz,.clap,.vst3"> |
| 88 |
</div> |
| 89 |
<button class="btn-secondary" id="cancel-existing-upload-btn">Cancel</button> |
| 90 |
</div> |
| 91 |
|
| 92 |
|
| 93 |
<div class="upload-progress hidden" id="version-upload-progress"> |
| 94 |
<div class="item-version-upload-queue" id="version-upload-queue"></div> |
| 95 |
<div class="progress-info"> |
| 96 |
<span id="version-upload-filename">filename.zip</span> |
| 97 |
<span id="version-upload-percent">0%</span> |
| 98 |
</div> |
| 99 |
<div class="progress-bar-container"> |
| 100 |
<div class="progress-bar" id="version-progress-bar"></div> |
| 101 |
</div> |
| 102 |
<div class="item-version-upload-speed" id="version-upload-speed"></div> |
| 103 |
<button type="button" class="btn-secondary" id="cancel-version-upload-btn">Cancel</button> |
| 104 |
</div> |
| 105 |
|
| 106 |
<div class="upload-success hidden" id="version-upload-success"> |
| 107 |
<span>Upload complete.</span> |
| 108 |
</div> |
| 109 |
|
| 110 |
<div class="upload-error hidden" id="version-upload-error"> |
| 111 |
<span class="error-message" id="version-error-message"></span> |
| 112 |
<button type="button" class="btn-secondary" id="retry-version-upload-btn">Try Again</button> |
| 113 |
</div> |
| 114 |
</div> |
| 115 |
|