33 lines
1.7 KiB
HTML
33 lines
1.7 KiB
HTML
{# GET /admin/validation/new — crate::pages::add_validation::ui::FieldValidationPage #}
|
|
{% extends "ui/form_page.html" %}
|
|
{% import "ui/alert.html" as alert %}
|
|
|
|
{% block title %}Add field validation{% endblock %}
|
|
{% block eyebrow %}Validation{% endblock %}
|
|
{% block heading %}Add field validation{% endblock %}
|
|
{% block lead %}<p>Attach validation to one column of one table.</p>{% endblock %}
|
|
|
|
{% block form %}
|
|
<form hx-post="/admin/validation" hx-target="#submission-status" hx-swap="innerHTML">
|
|
<div class="form-grid">
|
|
<label>Profile<input name="profile_name" list="profiles" value="{{ page.form.profile_name }}" required></label>
|
|
<label>Table<input name="table_name" list="tables" value="{{ page.form.table_name }}" required></label>
|
|
<label>Column<input name="data_key" value="{{ page.form.data_key }}" required></label>
|
|
<label class="wide">Apply named validation set instead
|
|
<input name="validation_set_name" value="{{ page.form.validation_set_name }}"
|
|
placeholder="Leave empty to save the rules below">
|
|
</label>
|
|
{% include "pages/add_validation/shared_fields.html" %}
|
|
</div>
|
|
<datalist id="profiles">{% for profile in page.profiles %}<option value="{{ profile }}"></option>{% endfor %}</datalist>
|
|
<datalist id="tables">{% for table in page.tables %}<option value="{{ table }}"></option>{% endfor %}</datalist>
|
|
<div id="submission-status" aria-live="polite">
|
|
{%- if let Some(message) = page.error %}{% call alert::error("Could not save validation", message) %}{% endcall %}{% endif -%}
|
|
</div>
|
|
<div class="form-actions">
|
|
<a href="/admin">Cancel</a>
|
|
<button type="submit">Save validation</button>
|
|
</div>
|
|
</form>
|
|
{% endblock %}
|