Files
2026-moving-helper/app/templates/subitems/form.html
T
tliu93 4955c87d78
test / pytest (push) Successful in 41s
ui change move image element
2026-04-27 20:31:12 +02:00

85 lines
3.2 KiB
HTML

{% extends "base.html" %}
{% block content %}
<div class="breadcrumb">
<a href="/boxes">箱子</a>
<span>/</span>
<a href="/boxes/{{ item.box.id }}">{{ item.box.name }}</a>
<span>/</span>
<a href="/items/{{ item.id }}">{{ item.name }}</a>
<span>/</span>
<strong>{{ "新建 SubItem" if not subitem else "编辑 SubItem" }}</strong>
</div>
<div class="page-header">
<div>
<div class="type-tag type-subitem">SubItem</div>
<h1>{{ page_title }}</h1>
<p class="muted">上级物品:<a href="/items/{{ item.id }}">{{ item.name }}</a></p>
<p class="muted">
{% if subitem %}
你当前正在编辑一个最后一级内容。
{% else %}
你当前正在这个容器型 Item 下面添加最后一级内容。
{% endif %}
</p>
</div>
<a class="button button-secondary button-small" href="/items/{{ item.id }}">返回物品</a>
</div>
<form method="post" action="{{ form_action }}" class="stack form-panel" enctype="multipart/form-data">
<section class="context-panel">
<div class="context-title">当前上下文</div>
<div class="context-body">
<span class="type-tag type-box">Box</span>
<span>{{ item.box.name }}</span>
</div>
<div class="context-body">
<span class="type-tag type-container">容器型 Item</span>
<span>{{ item.name }}</span>
</div>
<div class="context-body">
<span class="type-tag type-subitem">SubItem</span>
<span>{{ "创建最后一级内容" if not subitem else "编辑最后一级内容" }}</span>
</div>
</section>
<label class="form-field">
名称
<input type="text" name="name" value="{{ subitem.name if subitem else '' }}" required autofocus>
</label>
<label class="form-field">
图片
<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="button button-danger button-small"
formaction="/subitems/{{ subitem.id }}/image/delete"
formmethod="post"
>
删除当前图片
</button>
</section>
{% endif %}
<label class="form-field">
数量
<input type="number" name="quantity" min="0" value="{{ subitem.quantity if subitem and subitem.quantity is not none else '1' }}">
</label>
<label class="form-field">
备注
<textarea name="note" rows="4">{{ subitem.note if subitem and subitem.note else '' }}</textarea>
</label>
<div class="form-actions">
<button type="submit" name="submit_action" value="save" class="button button-primary">{{ submit_label }}</button>
{% if not subitem %}
<button type="submit" name="submit_action" value="save_and_add_next" class="button button-secondary">
保存并添加下一个
</button>
{% endif %}
</div>
</form>
{% endblock %}