1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-12-12 13:30:26 +00:00
mycorrhiza/views/modal.qtpl
2021-06-12 22:04:43 +07:00

64 lines
2.3 KiB
Plaintext

{% import "net/http" %}
{% import "github.com/bouncepaw/mycorrhiza/util" %}
{% func DeleteAskHTML(rq *http.Request, hyphaName string, isOld bool) %}
{%= NavHTML(rq, hyphaName, "delete-ask") %}
{%= modalBegin(
"delete-confirm",
hyphaName,
"",
"Delete "+util.BeautifulName(hyphaName)+"?") %}
{%= modalReallyWant(hyphaName, "unattach") %}
<p>In this version of Mycorrhiza Wiki you cannot undelete a deleted hypha but the history can still be accessed.</p>
{%= modalEnd(hyphaName, true) %}
{% endfunc %}
{% func UnattachAskHTML(rq *http.Request, hyphaName string, isOld bool) %}
{%= NavHTML(rq, hyphaName, "unattach-ask") %}
{%= modalBegin(
"unattach",
hyphaName,
"",
"Unattach "+util.BeautifulName(hyphaName)+"?") %}
{%= modalReallyWant(hyphaName, "unattach") %}
{%= modalEnd(hyphaName, true) %}
{% endfunc %}
{% func RenameAskHTML(rq *http.Request, hyphaName string, isOld bool) %}
{%= NavHTML(rq, hyphaName, "rename-ask") %}
{%= modalBegin(
"rename-confirm",
hyphaName,
` method="post" enctype="multipart/form-data"`,
"Rename "+util.BeautifulName(hyphaName)) %}
<label for="new-name">New name</label>
<input type="text" value="{%s hyphaName %}" required autofocus id="new-name" name="new-name"/>
<input type="checkbox" id="recursive" name="recursive" value="true" checked/>
<label for="recursive">Rename subhyphae too</label>
<p>If you rename this hypha, all incoming links and all relative outcoming links will break. You will also lose all history for the new name. Rename carefully.</p>
{%= modalEnd(hyphaName, false) %}
{% endfunc %}
{% func modalReallyWant(hyphaName, verb string) %}
<p class="modal__confirmation-msg">Do you really want to {%s verb %} hypha <em>{%s hyphaName %}</em>?</p>
{% endfunc %}
{% func modalBegin(path, hyphaName, formAttrs, legend string) %}
<div class="layout">
<main class="main-width">
<form class="modal" action="/{%s path %}/{%s hyphaName %}"{%s= formAttrs %}>
<fieldset class="modal__fieldset">
<legend class="modal__title">{%s= legend %}</legend>
{% endfunc %}
{% func modalEnd(hyphaName string, shouldFocusOnConfirm bool) %}
<input type="submit" value="Confirm" class="btn" {% if shouldFocusOnConfirm %}autofocus{% endif %}>
<a href="/hypha/{%s hyphaName %}" class="btn btn_weak">Cancel</a>
</fieldset>
</form>
</main>
</div>
{% endfunc %}