Redesign: clear active nav state, Shipping labels + Receipts get free-text/raw print, shared label repository
deploy / deploy (push) Successful in 10s

- Home page is now just the print server overview, no more unrelated
  network links (3D printers, Cockpit) left over from when this was a
  general landing page.
- Navbar shows which section is active; Brother's per-printer buttons
  now live under a dedicated Brother nav item instead of always-visible.
- Shipping labels: paste raw ZPL directly (no need to save to a file
  first), with a Labelary preview link alongside it.
- Receipts: paste already-formatted ESC/POS text directly, printed as-is.
- Both can save what they just printed into a shared label repository
  (lib/label_repository.rb, one JSON file per label under data/labels/)
  for reprinting later -- saving happens independently of whether the
  print itself succeeds, so a failed/offline printer doesn't lose the
  content.
This commit is contained in:
randy committed 2026-09-13 11:11:12 +02:00
1 parent afae57aff4
commit 66e2e7a5c0
8 files changed
+226 -53

No files matched your search

+40
View File
@@ -1,3 +1,4 @@
<h5>Formatted receipt</h5>
<form action="/epson/print" method="POST">
<div class="mb-3">
<label for="title" class="form-label">Title (bold, centered)</label>
@@ -13,3 +14,42 @@
</div>
<button class="btn btn-secondary" type="submit">Print</button>
</form>
<hr class="mt-4">
<h5>Free text (already-formatted ESC/POS)</h5>
<p>Sent as-is (just reset + code page prefix and a trailing cut), no title/body template applied.</p>
<form action="/epson/raw" method="POST">
<div class="mb-3">
<textarea name="content" class="form-control" rows="8" style="font-family: monospace;"></textarea>
</div>
<div class="row g-2 align-items-end">
<div class="col-auto">
<label for="save_as_escpos" class="form-label">Save as (optional)</label>
<input name="save_as" class="form-control" type="text" id="save_as_escpos" placeholder="receipt name" />
</div>
<div class="col-auto">
<button class="btn btn-secondary" type="submit">Print</button>
</div>
</div>
</form>
<% if @labels && !@labels.empty? %>
<hr class="mt-4">
<h5>Saved receipts</h5>
<div class="list-group">
<% @labels.each do |label| %>
<div class="list-group-item d-flex justify-content-between align-items-center">
<%= label['name'] %>
<div class="d-flex gap-2">
<form action="/labels/<%= label['id'] %>/print" method="POST">
<button class="btn btn-sm btn-secondary" type="submit">Print</button>
</form>
<form action="/labels/<%= label['id'] %>/delete" method="POST">
<button class="btn btn-sm btn-outline-danger" type="submit">Delete</button>
</form>
</div>
</div>
<% end %>
</div>
<% end %>