Adding AttachmentPointNames
This commit is contained in:
1 parent
ae50ec7049
commit
2767fb1c8e
14 files changed
+406
-3
No files matched your search
@@ -2,7 +2,7 @@
|
||||
{% set p = user.permissions %}
|
||||
{% set can_admin = su or "users:read" in p or "roles:read" in p or "audit_log:read" in p %}
|
||||
{% set can_connections = su or "clamp_connections:read" in p or "iso_threads:read" in p or "static_connections:read" in p or "unc_threads:read" in p %}
|
||||
{% set can_labels = su or "manufacturers:read" in p or "part_colours:read" in p or "part_types:read" in p or "scope_models:read" in p or "sub_part_types:read" in p %}
|
||||
{% set can_labels = su or "attachment_point_names:read" in p or "manufacturers:read" in p or "part_colours:read" in p or "part_types:read" in p or "scope_models:read" in p or "sub_part_types:read" in p %}
|
||||
{% set can_database = su or "imported_parts:read" in p or "augmented_parts:read" in p %}
|
||||
{% set can_parts = can_connections or can_labels or can_database %}
|
||||
|
||||
@@ -103,6 +103,10 @@
|
||||
<path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"/>
|
||||
<path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 0 3-3h7z"/>
|
||||
</symbol>
|
||||
<symbol id="icon-map-pin" viewBox="0 0 24 24">
|
||||
<path d="M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z"/>
|
||||
<circle cx="12" cy="10" r="3"/>
|
||||
</symbol>
|
||||
</svg>
|
||||
|
||||
{# ── Nav macro for DRY icon use ────────────────────────────────────────────── #}
|
||||
@@ -159,6 +163,9 @@
|
||||
<div class="nav-group">
|
||||
<span class="nav-label">{{ icon("tag") }} Labels <i class="nav-chevron">▶</i></span>
|
||||
<div class="nav-dropdown">
|
||||
{% if su or "attachment_point_names:read" in p %}
|
||||
<a href="/admin/attachment-point-names">{{ icon("map-pin") }} Attachment Point Names</a>
|
||||
{% endif %}
|
||||
{% if su or "manufacturers:read" in p %}
|
||||
<a href="/admin/manufacturers">{{ icon("building-2") }} Manufacturers</a>
|
||||
{% endif %}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<tr id="attachment-point-name-{{ apn.id }}">
|
||||
<td>{{ apn.id }}</td>
|
||||
<td>{{ apn.name }}</td>
|
||||
<td class="row-actions">
|
||||
<button class="btn btn-ghost"
|
||||
hx-get="/admin/attachment-point-names/{{ apn.id }}/edit"
|
||||
hx-target="#attachment-point-name-{{ apn.id }}"
|
||||
hx-swap="outerHTML">Edit</button>
|
||||
<button class="btn btn-danger"
|
||||
hx-delete="/admin/attachment-point-names/{{ apn.id }}"
|
||||
hx-target="#attachment-point-name-{{ apn.id }}"
|
||||
hx-swap="outerHTML"
|
||||
hx-confirm="Delete {{ apn.name }}?">Delete</button>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -0,0 +1,18 @@
|
||||
<tr id="attachment-point-name-{{ apn.id }}">
|
||||
<td colspan="3">
|
||||
<form hx-post="/admin/attachment-point-names/{{ apn.id }}"
|
||||
hx-target="#attachment-point-name-{{ apn.id }}"
|
||||
hx-swap="outerHTML"
|
||||
class="inline-edit">
|
||||
<span class="muted">#{{ apn.id }}</span>
|
||||
<label>Name <input type="text" name="name" value="{{ apn.name }}" required></label>
|
||||
<div class="row-actions">
|
||||
<button type="submit" class="btn btn-primary">Save</button>
|
||||
<button type="button" class="btn btn-ghost"
|
||||
hx-get="/admin/attachment-point-names/{{ apn.id }}/row"
|
||||
hx-target="#attachment-point-name-{{ apn.id }}"
|
||||
hx-swap="outerHTML">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -0,0 +1,18 @@
|
||||
<div id="attachment-point-name-list" class="card">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Name</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for apn in attachment_point_names %}
|
||||
{% include "admin/_attachment_point_name_row.html" %}
|
||||
{% else %}
|
||||
<tr><td colspan="3" class="muted">No attachment point names recorded.</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -0,0 +1,21 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Attachment Point Names · {{ app_name }}{% endblock %}
|
||||
{% block body %}
|
||||
{% include "_nav.html" %}
|
||||
<main class="container">
|
||||
<h1>Attachment Point Names</h1>
|
||||
|
||||
<div class="card">
|
||||
<h2>Add attachment point name</h2>
|
||||
<form hx-post="/admin/attachment-point-names"
|
||||
hx-target="#attachment-point-name-list"
|
||||
hx-swap="outerHTML"
|
||||
class="form-grid">
|
||||
<label>Name <input type="text" name="name" required></label>
|
||||
<button type="submit" class="btn btn-primary">Add</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{% include "admin/_attachment_point_names_table.html" %}
|
||||
</main>
|
||||
{% endblock %}
|
||||
Reference in new issue
Block a user