1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-12-12 05:20:26 +00:00
mycorrhiza/templates/http_mutators.qtpl
2021-01-20 18:53:30 +05:00

36 lines
1.4 KiB
Plaintext

{% import "net/http" %}
{% func EditHTML(rq *http.Request, hyphaName, textAreaFill, warning string) %}
{%s= navHTML(rq, hyphaName, "edit") %}
<main class="edit edit_no-preview">
<h1>Edit {%s hyphaName %}</h1>
{%s= warning %}
<form method="post" class="edit-form"
action="/upload-text/{%s hyphaName %}">
<textarea name="text">{%s textAreaFill %}</textarea>
<br/>
<input type="submit" name="action" value="Save" class="edit-form__save"/>
<input type="submit" name="action" value="Preview" class="edit-form__preview">
<a href="/page/{%s hyphaName %}" class="edit-form__cancel">Cancel</a>
</form>
</main>
{% endfunc %}
{% func PreviewHTML(rq *http.Request, hyphaName, textAreaFill, warning string, renderedPage string) %}
{%s= navHTML(rq, hyphaName, "edit") %}
<main class="edit edit_with-preview">
<h1>Edit {%s hyphaName %} (preview)</h1>
{%s= warning %}
<form method="post" class="edit-form"
action="/upload-text/{%s hyphaName %}">
<textarea name="text">{%s textAreaFill %}</textarea>
<br/>
<input type="submit" name="action" value="Save" class="edit-form__save"/>
<input type="submit" name="action" value="Preview" class="edit-form__preview">
<a href="/page/{%s hyphaName %}" class="edit-form__cancel">Cancel</a>
</form>
<p class="warning">Note that the hypha is not saved yet. You can preview the changes ↓</p>
<section class="edit__preview">{%s= renderedPage %}</section>
</main>
{% endfunc %}