1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-10-30 19:56:16 +00:00
mycorrhiza/views/modal.qtpl

64 lines
2.3 KiB
Plaintext
Raw Normal View History

{% 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 MycorrhizaWiki 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(
2021-02-24 17:34:42 +00:00
"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) %}
2021-05-25 07:34:04 +00:00
<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 %}