myWebLog/src/admin-theme/redirect-edit.liquid
Daniel J. Summers dc6b066e79 Rule add/edit/move/delete works (#39)
- Begin moving auth to route definition where practical
- Fix typo on post list page
2023-07-30 21:00:31 -04:00

49 lines
2.3 KiB
Plaintext

<h3>{% if model.rule_id < 0 %}Add{% else %}Edit{% endif %} Redirect Rule</h3>
{%- assign post_url = "admin/settings/redirect-rules/" | append: model.rule_id | relative_link -%}
<form action="{{ post_url }}" hx-post="{{ post_url }}" hx-target="body" method="POST" class="container">
<input type="hidden" name="{{ csrf.form_field_name }}" value="{{ csrf.request_token }}">
<input type="hidden" name="RuleId" value="{{ model.rule_id }}">
<div class="row">
<div class="col-12 col-lg-5 mb-3">
<div class="form-floating">
<input type="text" name="From" id="from" class="form-control" placeholder="From local URL/pattern" autofocus
required value="{{ model.from | escape }}">
<label for="from">From</label>
</div>
</div>
<div class="col-12 col-lg-5 mb-3">
<div class="form-floating">
<input type="text" name="To" id="to" class="form-control" placeholder="To URL/pattern" required
value="{{ model.to | escape }}">
<label for="from">To</label>
</div>
</div>
<div class="col-12 col-lg-2 mb-3">
<div class="form-check form-switch">
<input type="checkbox" name="IsRegex" id="isRegex" class="form-check-input" value="true"
{%- if model.is_regex %} checked="checked"{% endif %}>
<label for="isRegex">Use RegEx</label>
</div>
</div>
</div>
{% if model.rule_id < 0 %}
<div class="row mb-3">
<div class="col-12 text-center">
<label>Add Rule</label>
<div class="btn-group btn-group-sm" role="group" aria-label="New rule placement button group">
<input type="radio" name="InsertAtTop" id="insert_top" class="btn-check" value="true">
<label class="btn btn-sm btn-outline-secondary" for="insert_top">Top</label>
<input type="radio" name="InsertAtTop" id="insert_bottom" class="btn-check" value="false" checked="checked">
<label class="btn btn-sm btn-outline-secondary" for="insert_bottom">Bottom</label>
</div>
</div>
</div>
{% endif %}
<div class="row mb-3">
<div class="col text-center">
<button type="submit" class="btn btn-sm btn-primary">Save Changes</button>
<a href="{{ "admin/settings/redirect-rules" | relative_link }}" class="btn btn-sm btn-secondary ms-3">Cancel</a>
</div>
</div>
</form>