feat(postcards): add notes field to postcards with edit, detail, and truncated list display

This commit is contained in:
2026-07-06 21:07:28 +08:00
parent f6db3a4f55
commit 68c88a7910
6 changed files with 16 additions and 0 deletions

View File

@@ -61,6 +61,9 @@
{% endif %}
<dt>所属 Profile</dt><dd>{{ postcard.profile.nickname }}</dd>
</dl>
{% if postcard.notes %}
<div class="detail-notes">{{ postcard.notes }}</div>
{% endif %}
</div>
</div>
{% endblock %}

View File

@@ -33,6 +33,9 @@
<input type="date" name="receive_time" id="input-receive" value="{{ postcard.receive_time.strftime('%Y-%m-%d') if postcard and postcard.receive_time else '' }}">
</div>
<label>备注</label>
<textarea name="notes" rows="3" placeholder="可选备注信息">{{ postcard.notes if postcard else '' }}</textarea>
<div class="form-actions">
<button type="submit" class="btn btn-primary">保存</button>
<a href="/profiles/{{ profile.id }}/postcards" class="btn">取消</a>

View File

@@ -44,6 +44,7 @@
<span>{{ pc.country|flag }} {{ pc.country or '-' }}</span>
<span>→ {{ pc.recipient_name or '-' }}</span>
</div>
{% if pc.notes %}<span class="postcard-row-notes">{{ pc.notes[:50] }}{% if pc.notes|length > 50 %}…{% endif %}</span>{% endif %}
<span class="badge badge-{{ pc.status }}">{{ {'sent':'已寄出','delivered':'已送达'}.get(pc.status) }}</span>
<span class="postcard-row-date">
{% if pc.send_time %}{{ pc.send_time.strftime('%Y-%m-%d') }}寄出{% endif %}
@@ -80,6 +81,7 @@
<div class="postcard-row-detail">
<span>← {{ pc.sender_name or '-' }}</span>
</div>
{% if pc.notes %}<span class="postcard-row-notes">{{ pc.notes[:50] }}{% if pc.notes|length > 50 %}…{% endif %}</span>{% endif %}
{% if pc.receive_time %}<span class="postcard-row-date">{{ pc.receive_time.strftime('%Y-%m-%d') }}收到</span>{% endif %}
</div>
</a>