Adding ISOThread and UNC Thread
This commit is contained in:
1 parent
9285a021c0
commit
35e8a61b1d
22 files changed
+796
-3
No files matched your search
@@ -8,6 +8,12 @@
|
||||
{% if user.is_superuser or "roles:read" in user.permissions %}
|
||||
<a href="/admin/roles">Roles</a>
|
||||
{% endif %}
|
||||
{% if user.is_superuser or "iso_threads:read" in user.permissions %}
|
||||
<a href="/admin/iso-threads">ISO Threads</a>
|
||||
{% endif %}
|
||||
{% if user.is_superuser or "unc_threads:read" in user.permissions %}
|
||||
<a href="/admin/unc-threads">UNC Threads</a>
|
||||
{% endif %}
|
||||
<a href="/docs" target="_blank">API docs</a>
|
||||
</nav>
|
||||
<form method="post" action="/logout" class="logout">
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<tr id="iso-thread-{{ t.id }}">
|
||||
<td>{{ t.id }}</td>
|
||||
<td>{{ t.diameter_mm }}</td>
|
||||
<td>{{ t.pitch_mm }}</td>
|
||||
<td>{{ t.depth_mm if t.depth_mm is not none else "—" }}</td>
|
||||
<td class="row-actions">
|
||||
<button class="btn btn-ghost"
|
||||
hx-get="/admin/iso-threads/{{ t.id }}/edit"
|
||||
hx-target="#iso-thread-{{ t.id }}"
|
||||
hx-swap="outerHTML">Edit</button>
|
||||
<button class="btn btn-danger"
|
||||
hx-delete="/admin/iso-threads/{{ t.id }}"
|
||||
hx-target="#iso-thread-{{ t.id }}"
|
||||
hx-swap="outerHTML"
|
||||
hx-confirm="Delete ISO thread #{{ t.id }}?">Delete</button>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -0,0 +1,20 @@
|
||||
<tr id="iso-thread-{{ t.id }}">
|
||||
<td colspan="5">
|
||||
<form hx-post="/admin/iso-threads/{{ t.id }}"
|
||||
hx-target="#iso-thread-{{ t.id }}"
|
||||
hx-swap="outerHTML"
|
||||
class="inline-edit">
|
||||
<span class="muted">#{{ t.id }}</span>
|
||||
<label>Diameter (mm) <input type="number" name="diameter_mm" step="0.001" min="0" value="{{ t.diameter_mm }}" required></label>
|
||||
<label>Pitch (mm) <input type="number" name="pitch_mm" step="0.001" min="0" value="{{ t.pitch_mm }}" required></label>
|
||||
<label>Depth (mm) <input type="number" name="depth_mm" step="0.001" min="0" value="{{ t.depth_mm if t.depth_mm is not none else '' }}" placeholder="optional"></label>
|
||||
<div class="row-actions">
|
||||
<button type="submit" class="btn btn-primary">Save</button>
|
||||
<button type="button" class="btn btn-ghost"
|
||||
hx-get="/admin/iso-threads/{{ t.id }}/row"
|
||||
hx-target="#iso-thread-{{ t.id }}"
|
||||
hx-swap="outerHTML">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -0,0 +1,16 @@
|
||||
<div id="iso-thread-list" class="card">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th><th>Diameter (mm)</th><th>Pitch (mm)</th><th>Depth (mm)</th><th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for t in threads %}
|
||||
{% include "admin/_iso_thread_row.html" %}
|
||||
{% else %}
|
||||
<tr><td colspan="5" class="muted">No threads recorded.</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -0,0 +1,18 @@
|
||||
<tr id="unc-thread-{{ t.id }}">
|
||||
<td>{{ t.id }}</td>
|
||||
<td>{{ t.diameter_fraction }}"</td>
|
||||
<td>{{ t.tpi }}</td>
|
||||
<td>{{ t.series.value }}</td>
|
||||
<td>{{ t.depth_in if t.depth_in is not none else "—" }}</td>
|
||||
<td class="row-actions">
|
||||
<button class="btn btn-ghost"
|
||||
hx-get="/admin/unc-threads/{{ t.id }}/edit"
|
||||
hx-target="#unc-thread-{{ t.id }}"
|
||||
hx-swap="outerHTML">Edit</button>
|
||||
<button class="btn btn-danger"
|
||||
hx-delete="/admin/unc-threads/{{ t.id }}"
|
||||
hx-target="#unc-thread-{{ t.id }}"
|
||||
hx-swap="outerHTML"
|
||||
hx-confirm="Delete UNC thread #{{ t.id }}?">Delete</button>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -0,0 +1,27 @@
|
||||
<tr id="unc-thread-{{ t.id }}">
|
||||
<td colspan="6">
|
||||
<form hx-post="/admin/unc-threads/{{ t.id }}"
|
||||
hx-target="#unc-thread-{{ t.id }}"
|
||||
hx-swap="outerHTML"
|
||||
class="inline-edit">
|
||||
<span class="muted">#{{ t.id }}</span>
|
||||
<label>Diameter <input type="text" name="diameter_fraction" value="{{ t.diameter_fraction }}" required></label>
|
||||
<label>TPI <input type="number" name="tpi" min="1" step="1" value="{{ t.tpi }}" required></label>
|
||||
<label>Series
|
||||
<select name="series">
|
||||
{% for s in series_options %}
|
||||
<option value="{{ s.value }}" {{ "selected" if s == t.series }}>{{ s.value }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</label>
|
||||
<label>Depth (in) <input type="number" name="depth_in" step="0.001" min="0" value="{{ t.depth_in if t.depth_in is not none else '' }}" placeholder="optional"></label>
|
||||
<div class="row-actions">
|
||||
<button type="submit" class="btn btn-primary">Save</button>
|
||||
<button type="button" class="btn btn-ghost"
|
||||
hx-get="/admin/unc-threads/{{ t.id }}/row"
|
||||
hx-target="#unc-thread-{{ t.id }}"
|
||||
hx-swap="outerHTML">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -0,0 +1,16 @@
|
||||
<div id="unc-thread-list" class="card">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th><th>Diameter</th><th>TPI</th><th>Series</th><th>Depth (in)</th><th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for t in threads %}
|
||||
{% include "admin/_unc_thread_row.html" %}
|
||||
{% else %}
|
||||
<tr><td colspan="6" class="muted">No threads recorded.</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -0,0 +1,20 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}ISO Threads · {{ app_name }}{% endblock %}
|
||||
{% block body %}
|
||||
{% include "_nav.html" %}
|
||||
<main class="container">
|
||||
<h1>ISO Threads</h1>
|
||||
|
||||
<div class="card">
|
||||
<h2>Add thread</h2>
|
||||
<form hx-post="/admin/iso-threads" hx-target="#iso-thread-list" hx-swap="outerHTML" class="form-grid">
|
||||
<label>Diameter (mm) <input type="number" name="diameter_mm" step="0.001" min="0" required></label>
|
||||
<label>Pitch (mm) <input type="number" name="pitch_mm" step="0.001" min="0" required></label>
|
||||
<label>Depth (mm) <input type="number" name="depth_mm" step="0.001" min="0" placeholder="optional"></label>
|
||||
<button type="submit" class="btn btn-primary">Add</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{% include "admin/_iso_threads_table.html" %}
|
||||
</main>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,27 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}UNC Threads · {{ app_name }}{% endblock %}
|
||||
{% block body %}
|
||||
{% include "_nav.html" %}
|
||||
<main class="container">
|
||||
<h1>UNC Threads</h1>
|
||||
|
||||
<div class="card">
|
||||
<h2>Add thread</h2>
|
||||
<form hx-post="/admin/unc-threads" hx-target="#unc-thread-list" hx-swap="outerHTML" class="form-grid">
|
||||
<label>Diameter <input type="text" name="diameter_fraction" placeholder='e.g. 1/4, 3/8, 1-1/2' required></label>
|
||||
<label>TPI <input type="number" name="tpi" min="1" step="1" required></label>
|
||||
<label>Series
|
||||
<select name="series">
|
||||
{% for s in series_options %}
|
||||
<option value="{{ s.value }}">{{ s.value }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</label>
|
||||
<label>Depth (in) <input type="number" name="depth_in" step="0.001" min="0" placeholder="optional"></label>
|
||||
<button type="submit" class="btn btn-primary">Add</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{% include "admin/_unc_threads_table.html" %}
|
||||
</main>
|
||||
{% endblock %}
|
||||
Reference in new issue
Block a user