106 lines
5.0 KiB
Plaintext
106 lines
5.0 KiB
Plaintext
<h2 class="my-3">{{ page_title }}</h2>
|
|
<article>
|
|
<form action="{{ "admin/page/save" | relative_link }}" method="post" hx-push-url="true">
|
|
<input type="hidden" name="{{ csrf.form_field_name }}" value="{{ csrf.request_token }}">
|
|
<input type="hidden" name="pageId" value="{{ model.page_id }}">
|
|
<div class="container">
|
|
<div class="row mb-3">
|
|
<div class="col-9">
|
|
<div class="form-floating pb-3">
|
|
<input type="text" name="title" id="title" class="form-control" autofocus required
|
|
value="{{ model.title }}">
|
|
<label for="title">Title</label>
|
|
</div>
|
|
<div class="form-floating pb-3">
|
|
<input type="text" name="permalink" id="permalink" class="form-control" required
|
|
value="{{ model.permalink }}">
|
|
<label for="permalink">Permalink</label>
|
|
{%- if model.page_id != "new" %}
|
|
{%- capture perm_edit %}admin/page/{{ model.page_id }}/permalinks{% endcapture -%}
|
|
<span class="form-text"><a href="{{ perm_edit | relative_link }}">Manage Permalinks</a></span>
|
|
{% endif -%}
|
|
</div>
|
|
<div class="mb-2">
|
|
<label for="text">Text</label>
|
|
<input type="radio" name="source" id="source_html" class="btn-check" value="HTML"
|
|
{%- if model.source == "HTML" %} checked="checked"{% endif %}>
|
|
<label class="btn btn-sm btn-outline-secondary" for="source_html">HTML</label>
|
|
<input type="radio" name="source" id="source_md" class="btn-check" value="Markdown"
|
|
{%- if model.source == "Markdown" %} checked="checked"{% endif %}>
|
|
<label class="btn btn-sm btn-outline-secondary" for="source_md">Markdown</label>
|
|
</div>
|
|
<div class="mb-3">
|
|
<textarea name="text" id="text" class="form-control">{{ model.text }}</textarea>
|
|
</div>
|
|
</div>
|
|
<div class="col-3">
|
|
<div class="form-floating pb-3">
|
|
<select name="template" id="template" class="form-control">
|
|
{% for tmpl in templates -%}
|
|
<option value="{{ tmpl[0] }}"{% if model.template == tmpl[0] %} selected="selected"{% endif %}>
|
|
{{ tmpl[1] }}
|
|
</option>
|
|
{%- endfor %}
|
|
</select>
|
|
<label for="template">Page Template</label>
|
|
</div>
|
|
<div class="form-check form-switch">
|
|
<input type="checkbox" name="isShownInPageList" id="showList" class="form-check-input" value="true"
|
|
{%- if model.is_shown_in_page_list %} checked="checked"{% endif %}>
|
|
<label for="showList" class="form-check-label">Show in Page List</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row mb-3">
|
|
<div class="col">
|
|
<button type="submit" class="btn btn-primary">Save Changes</button>
|
|
</div>
|
|
</div>
|
|
<div class="row mb-3">
|
|
<div class="col">
|
|
<fieldset>
|
|
<legend>
|
|
Metadata
|
|
<button type="button" class="btn btn-sm btn-secondary" data-bs-toggle="collapse"
|
|
data-bs-target="#metaItemContainer">
|
|
show
|
|
</button>
|
|
</legend>
|
|
<div id="metaItemContainer" class="collapse">
|
|
<div id="metaItems" class="container">
|
|
{%- for meta in metadata %}
|
|
<div id="meta_{{ meta[0] }}" class="row mb-3">
|
|
<div class="col-1 text-center align-self-center">
|
|
<button type="button" class="btn btn-sm btn-danger" onclick="Admin.removeMetaItem({{ meta[0] }})">
|
|
−
|
|
</button>
|
|
</div>
|
|
<div class="col-3">
|
|
<div class="form-floating">
|
|
<input type="text" name="metaNames" id="metaNames_{{ meta[0] }}" class="form-control"
|
|
placeholder="Name" value="{{ meta[1] }}">
|
|
<label for="metaNames_{{ meta[0] }}">Name</label>
|
|
</div>
|
|
</div>
|
|
<div class="col-8">
|
|
<div class="form-floating">
|
|
<input type="text" name="metaValues" id="metaValues_{{ meta[0] }}" class="form-control"
|
|
placeholder="Value" value="{{ meta[2] }}">
|
|
<label for="metaValues_{{ meta[0] }}">Value</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endfor -%}
|
|
</div>
|
|
<button type="button" class="btn btn-sm btn-secondary" onclick="Admin.addMetaItem()">Add an Item</button>
|
|
<script>
|
|
document.addEventListener("DOMContentLoaded", () => Admin.setNextMetaIndex({{ metadata | size }}))
|
|
</script>
|
|
</div>
|
|
</fieldset>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</article>
|