Add label settings page

This commit is contained in:
jessikitty committed 2026-10-03 00:56:52 +10:00
1 parent a4c760beac
commit e36331e2d6
1 file changed
+95
+95
View File
@@ -0,0 +1,95 @@
{% extends "base.html" %}
{% block title %}Label Settings - Admin{% endblock %}
{% block content %}
<div class="row mb-4">
<div class="col">
<h1><i class="bi bi-sliders"></i> Label Settings</h1>
</div>
<div class="col-auto">
<a href="{{ url_for('labels.index') }}" class="btn btn-outline-secondary">
<i class="bi bi-arrow-left"></i> Back to labels
</a>
</div>
</div>
<div class="row">
<div class="col-lg-7">
<form method="POST">
<div class="card mb-3">
<div class="card-header"><strong>Rebrickable</strong></div>
<div class="card-body">
<p class="small text-muted">
Brickset's API covers sets, minifigs and instructions &mdash; it has no parts endpoint,
so part numbers, names and artwork come from Rebrickable instead. A key is free from
<a href="https://rebrickable.com/api/" target="_blank" rel="noopener">rebrickable.com/api</a>.
Leave this blank to work entirely by hand with your own uploaded images.
</p>
<label class="form-label">API key</label>
<input type="text" name="rebrickable_api_key" class="form-control"
value="{{ api_key }}" placeholder="{{ 'Set in .env - leave blank to keep using it' if env_key_present else 'Paste your key' }}">
{% if env_key_present %}
<div class="form-text">
REBRICKABLE_API_KEY is also set in your environment. A key entered here takes priority.
</div>
{% endif %}
</div>
</div>
<div class="card mb-3">
<div class="card-header"><strong>Print defaults</strong></div>
<div class="card-body row g-3">
<div class="col-12">
<label class="form-label">Default sheet</label>
<select name="label_default_preset" class="form-select">
{% for key, preset in presets.items() %}
<option value="{{ key }}" {% if key == default_preset %}selected{% endif %}>{{ preset.name }}</option>
{% endfor %}
</select>
</div>
<div class="col-md-6">
<label class="form-label">Printer offset X (mm)</label>
<input type="number" step="0.1" name="offset_x" class="form-control" value="{{ offset_x }}">
</div>
<div class="col-md-6">
<label class="form-label">Printer offset Y (mm)</label>
<input type="number" step="0.1" name="offset_y" class="form-control" value="{{ offset_y }}">
</div>
<div class="col-12">
<div class="form-text">
Most printers are a few tenths of a millimetre out. Print one sheet with
"outline each label" ticked, measure the drift, and put it here.
</div>
</div>
</div>
</div>
<button class="btn btn-danger"><i class="bi bi-check-lg"></i> Save settings</button>
</form>
</div>
<div class="col-lg-5">
<div class="card">
<div class="card-header"><strong>PDF export</strong></div>
<div class="card-body">
{% if pdf_available %}
<p class="mb-0 text-success small">
<i class="bi bi-check-circle"></i> ReportLab is installed, so the PDF button is available
on the print page.
</p>
{% else %}
<p class="small text-muted">
PDF export is optional and needs ReportLab:
</p>
<pre class="bg-light p-2 small mb-2"><code>pip install reportlab</code></pre>
<p class="small text-muted mb-0">
Printing straight from the browser works without it and is usually the more
accurate of the two anyway.
</p>
{% endif %}
</div>
</div>
</div>
</div>
{% endblock %}