Skip to main content

max / makenotwork

5.4 KB · 117 lines History Blame Raw
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.") %}{% endcall %}
6 {% else %}
7 <table class="data-table well">
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 id="version-row-{{ version.id }}">
21 <td><span class="badge"{% if version.is_current %} data-tone="success"{% 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 {{ crate::quasi::version_delete_act::html(item.id.to_string().as_str(), version.id.to_string().as_str())|safe }}
35 </td>
36 </tr>
37 {% endfor %}
38 </tbody>
39 </table>
40 {% endif %}
41
42 <!-- New Version Form -->
43 <div id="new-version-form">
44 <div class="item-version-upload-grid">
45 <div class="form-group">
46 <label for="new-version-number">Version Number</label>
47 <input type="text" id="new-version-number" placeholder="e.g., 1.0">
48 </div>
49 <div class="form-group">
50 <label for="version-changelog">Notes (optional)</label>
51 <input type="text" id="version-changelog" placeholder="What changed in this version...">
52 </div>
53 </div>
54
55 <div class="form-group">
56 <label>Files</label>
57 <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>
58
59 <table class="item-version-upload-file-table" id="version-file-table">
60 <thead>
61 <tr>
62 <th>File</th>
63 <th>Label</th>
64 <th></th>
65 </tr>
66 </thead>
67 <tbody id="version-file-rows"></tbody>
68 </table>
69
70 {#- What the queue takes and how many of them is described, not
71 written out here: `crate::quasi::upload_field::version_queue`.
72 It carries no destination on purpose, because nothing is sent
73 until Upload All names the version. -#}
74 <div class="item-version-upload-add-row" id="version-file-picker">
75 {{ crate::quasi::upload_field::version_queue()|safe }}
76 </div>
77 </div>
78
79 <button class="btn-primary" id="create-version-btn">Upload All</button>
80 </div>
81
82 <!-- Upload to existing version (hidden by default) -->
83 {#- One described field per version that has no file yet. Each carries its
84 own address, so picking a file uploads it to that version and nothing
85 has to remember which button was pressed. -#}
86 {% for version in versions %}{% if !version.has_file %}
87 <div class="hidden existing-version-upload" id="existing-version-upload-{{ version.id }}"
88 data-upload-refreshes="#tab-files">
89 {{ crate::quasi::upload_field::existing_version(version.id.as_str())|safe }}
90 <button class="btn-secondary cancel-existing-upload-btn" type="button">Cancel</button>
91 </div>
92 {% endif %}{% endfor %}
93
94 <!-- Shared upload progress/status (outside both forms so always visible) -->
95 <div class="upload-progress hidden" id="version-upload-progress">
96 <div class="item-version-upload-queue" id="version-upload-queue"></div>
97 <div class="progress-info">
98 <span id="version-upload-filename">filename.zip</span>
99 <span id="version-upload-percent">0%</span>
100 </div>
101 <div class="progress-bar-container">
102 <div class="progress-bar" id="version-progress-bar"></div>
103 </div>
104 <div class="item-version-upload-speed" id="version-upload-speed"></div>
105 <button type="button" class="btn-secondary" id="cancel-version-upload-btn">Cancel</button>
106 </div>
107
108 <div class="upload-success hidden" id="version-upload-success">
109 <span>Upload complete.</span>
110 </div>
111
112 <div class="upload-error hidden" id="version-upload-error">
113 <span class="error-message" id="version-error-message"></span>
114 <button type="button" class="btn-secondary" id="retry-version-upload-btn">Try Again</button>
115 </div>
116 </div>
117