add image flow

This commit is contained in:
2026-04-19 12:54:25 +02:00
parent 57800f2123
commit 5fdf3f4ab2
14 changed files with 606 additions and 21 deletions
+19 -1
View File
@@ -9,7 +9,7 @@
<a href="/items/{{ item.id }}">返回物品</a>
</div>
<form method="post" action="{{ form_action }}" class="stack">
<form method="post" action="{{ form_action }}" class="stack" enctype="multipart/form-data">
<label>
名称
<input type="text" name="name" value="{{ subitem.name if subitem else '' }}" required>
@@ -22,6 +22,24 @@
备注
<textarea name="note" rows="4">{{ subitem.note if subitem and subitem.note else '' }}</textarea>
</label>
<label>
图片
<input type="file" name="image_file" accept="image/*">
</label>
{% if subitem and subitem.image_blob %}
<section class="card">
<p><strong>当前图片:</strong></p>
<img src="/subitems/{{ subitem.id }}/image" alt="{{ subitem.name }}" class="detail-image">
<button
type="submit"
class="link-button"
formaction="/subitems/{{ subitem.id }}/image/delete"
formmethod="post"
>
删除当前图片
</button>
</section>
{% endif %}
<button type="submit">{{ submit_label }}</button>
</form>
{% endblock %}