Add sub-component support via self-referential device hierarchy
This commit is contained in:
@@ -2,10 +2,16 @@
|
||||
{% block title %}Add Device — Battery Tracker{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Add Device</h1>
|
||||
<h1>{% if prefill_parent %}Add Sub-component to {{ prefill_parent.name }}{% else %}Add Device{% endif %}</h1>
|
||||
|
||||
<div class="card">
|
||||
<form method="post" action="{{ url_for('device_add') }}">
|
||||
{% if prefill_parent %}
|
||||
<input type="hidden" name="parent_id" value="{{ prefill_parent.id }}">
|
||||
<p class="text-muted" style="margin-bottom:0.75rem;">
|
||||
Adding as a sub-component of <a href="{{ url_for('device_detail', device_id=prefill_parent.id) }}">{{ prefill_parent.name }}</a>.
|
||||
</p>
|
||||
{% endif %}
|
||||
<div class="form-group">
|
||||
<label for="name">Device Name <span class="text-danger">*</span></label>
|
||||
<input type="text" id="name" name="name" value="{{ form_name|default('') }}"
|
||||
|
||||
Reference in New Issue
Block a user