From b4bc31556b10e37fd0b6fdb4c9424f19375c75b9 Mon Sep 17 00:00:00 2001 From: jessikitty Date: Mon, 12 Oct 2026 22:43:39 +1100 Subject: [PATCH] Label size controls, per-label preview with its mm size --- app/templates/admin/labels/tape.html | 104 +++++++++++++++++++++------ 1 file changed, 84 insertions(+), 20 deletions(-) diff --git a/app/templates/admin/labels/tape.html b/app/templates/admin/labels/tape.html index 0d12470..8ee54d8 100644 --- a/app/templates/admin/labels/tape.html +++ b/app/templates/admin/labels/tape.html @@ -15,13 +15,40 @@
{# Always submitted, so an unticked checkbox can be told apart from a page - opened with no options at all. Without it, "Rotate for tape feed" could + opened with no options at all. Without it, a default-on checkbox could never be turned off. #}
+
+
Label size
+
+ + + {% if options.is_fixed %} +
+ Labels are {{ label_width_mm|int }}mm wide and lie across the tape, so each one + only uses its height in tape length. +
+ +
+ Two part types in one drawer become a single 40 × 20mm label. + Matched on the drawer / location field. +
+ {% endif %} +
+
+
Tape & layout
@@ -54,12 +81,14 @@
+ {% if not options.is_fixed %}
+ {% endif %}
Rotate for tape feed @@ -78,6 +108,11 @@ If your print comes out sideways, untick this. To make the change permanent, set it in Settings.
+ {% else %} + {# Fixed sizes always lie across the tape, so there is nothing to + choose - carry the value through so the form round-trips. #} + + {% endif %}
@@ -151,28 +187,56 @@ Every field is unticked, so the labels will print blank. Tick something under Show on label.
{% endif %} + + {% if options.is_fixed and not tape_fits %} +
Tape too narrow + A {{ label_width_mm|int }}mm label needs 50mm tape. + {{ tape.name }} is {{ tape.printable_mm }}mm printable, so labels + will be scaled down. Load 50mm tape, or pick a different size.
+ {% endif %} +
- {% for label in labels[:12] %} - {{ label.display_title }} + {% for item in plan[:12] %} +
+ {{ item.labels | map(attribute='display_title') | join(' + ') }} + {% if item.width_mm %} +
+ {{ item.width_mm|int }} × {{ item.height_mm|int }}mm + {%- if item.labels|length > 1 %} · + {{ item.labels|length }} parts in {{ item.drawer or 'one drawer' }} + {%- elif item.drawer %} · {{ item.drawer }}{% endif %} +
+ {% endif %} +
{% endfor %}
- {% if labels|length > 12 %} + + {% if plan|length > 12 %}
- Showing the first 12 of {{ labels|length }}. All of them print. + Showing the first 12 of {{ plan|length }}. All of them print.
{% endif %}
- Rendered at 313 dpi on {{ tape.tape_mm }}mm tape - ({{ tape.printable_mm }}mm printable). Preview is shown flat; - the job is rotated if "Rotate for tape feed" is ticked. + 313 dpi on {{ tape.tape_mm }}mm tape ({{ tape.printable_mm }}mm printable). + {% if options.is_fixed %} + Labels lie across the tape, so this run uses about + {{ (tape_used_mm / 10)|round(1) }}cm of tape + ({{ options.copies }} cop{{ 'y' if options.copies == 1 else 'ies' }} each). + {% else %} + Preview shown flat; the job is rotated if "Rotate for tape feed" is ticked. + {% endif %}
@@ -214,8 +278,8 @@ document.getElementById('testBtn')?.addEventListener('click', function () { .catch(e => { out.innerHTML = 'Failed ' + e; }); }); -// Changing the tape re-renders the preview. -['tapeSelect'].forEach(id => { +// Changing the tape or the label size re-renders the preview. +['tapeSelect', 'sizeSelect'].forEach(id => { document.getElementById(id)?.addEventListener('change', () => document.getElementById('tapeForm').submit()); });