Files
fitguide/app/templates/admin/_augmented_part_ap_row_edit.html

47 lines
2.5 KiB
HTML

{% if apoint.iso_thread_id %}{% set current_type = "iso_thread" %}
{% elif apoint.unc_thread_id %}{% set current_type = "unc_thread" %}
{% elif apoint.clamp_connection_id %}{% set current_type = "clamp_connection" %}
{% elif apoint.static_connection_id %}{% set current_type = "static_connection" %}
{% else %}{% set current_type = "manual" %}{% endif %}
{# _attachment_point_connection_select.html expects `ap` for pre-selection #}
{% set ap = apoint %}
{% set connection_type = current_type %}
<div id="augmented-part-ap-{{ apoint.id }}">
<form hx-post="/admin/augmented-parts/{{ apoint.augmented_part_id }}/attachment-points/{{ apoint.id }}"
hx-target="#augmented-part-ap-{{ apoint.id }}"
hx-swap="outerHTML"
class="inline-edit" style="padding:0.3rem 0">
<label>Name
<select name="attachment_point_name_id" required>
{% for apn in attachment_point_names %}
<option value="{{ apn.id }}" {{ "selected" if apn.id == apoint.attachment_point_name_id }}>{{ apn.name }}</option>
{% endfor %}
</select>
</label>
<label>Type
<select name="connection_type" required
hx-get="/admin/attachment-points/connection-options"
hx-target="#edit-ap-{{ apoint.id }}-connection-options"
hx-trigger="change"
hx-include="[name='connection_type']">
<option value="">— type —</option>
<option value="iso_thread" {{ "selected" if current_type == "iso_thread" }}>ISO Thread</option>
<option value="unc_thread" {{ "selected" if current_type == "unc_thread" }}>UNC Thread</option>
<option value="clamp_connection" {{ "selected" if current_type == "clamp_connection" }}>Clamp Connection</option>
<option value="static_connection" {{ "selected" if current_type == "static_connection" }}>Static Connection</option>
<option value="manual" {{ "selected" if current_type == "manual" }}>Manual</option>
</select>
</label>
<div id="edit-ap-{{ apoint.id }}-connection-options">
{% include "admin/_attachment_point_connection_select.html" %}
</div>
<div class="row-actions">
<button type="submit" class="btn btn-primary">Save</button>
<button type="button" class="btn btn-ghost"
hx-get="/admin/augmented-parts/{{ apoint.augmented_part_id }}/attachment-points/{{ apoint.id }}/row"
hx-target="#augmented-part-ap-{{ apoint.id }}"
hx-swap="outerHTML">Cancel</button>
</div>
</form>
</div>