weiro/views/pages/edit.html

54 lines
2.3 KiB
HTML
Raw Normal View History

<main class="container py-2">
{{ if .isNew }}
<form method="post" action="/sites/{{ .site.ID }}/pages">
{{ else }}
<form method="post" action="/sites/{{ .site.ID }}/pages/{{ .page.ID }}">
{{ end }}
<input type="hidden" name="guid" value="{{ .page.GUID }}">
<div class="row">
<div class="col-md-9">
<div class="mb-2">
<input type="text" name="title" class="form-control" placeholder="Title" value="{{ .page.Title }}">
</div>
<div class="mb-3">
<textarea name="body" class="form-control" rows="20">{{ .page.Body }}</textarea>
</div>
<div>
<button type="submit" class="btn btn-primary">{{ if .isNew }}Create{{ else }}Save{{ end }}</button>
{{ if not .isNew }}
<button type="button" class="btn btn-outline-danger ms-2"
onclick="if(confirm('Delete this page?')) { document.getElementById('delete-form').submit(); }">Delete</button>
{{ end }}
</div>
</div>
<div class="col-md-3">
<div class="card mb-3">
<div class="card-header">Page Settings</div>
<div class="card-body">
<div class="mb-3">
<label for="pageSlug" class="form-label">Slug</label>
<input type="text" class="form-control" id="pageSlug" name="slug" value="{{ .page.Slug }}">
<div class="form-text">Auto-generated from title if left blank.</div>
</div>
<div class="mb-3">
<label for="pageType" class="form-label">Page Type</label>
<select class="form-select" id="pageType" name="page_type">
<option value="0" {{ if eq .page.PageType 0 }}selected{{ end }}>Normal</option>
</select>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="show_in_nav" value="true" id="showInNav"
{{ if .page.ShowInNav }}checked{{ end }}>
<label class="form-check-label" for="showInNav">Show in Nav</label>
</div>
</div>
</div>
</div>
</div>
</form>
{{ if not .isNew }}
<form id="delete-form" method="post" action="/sites/{{ .site.ID }}/pages/{{ .page.ID }}/delete" style="display:none;"></form>
{{ end }}
</main>