2020-11-16 15:26:03 +00:00
{% import "net/http" %}
2020-10-02 15:31:59 +00:00
This dialog is to be shown to a user when they try to rename a hypha.
2020-11-16 15:26:03 +00:00
{% func RenameAskHTML(rq *http.Request, hyphaName string, isOld bool) %}
2020-10-02 15:31:59 +00:00
<main>
2020-11-16 15:26:03 +00:00
{%= navHTML(rq, hyphaName, "rename-ask") %}
2020-10-02 15:31:59 +00:00
{%- if isOld -%}
<section>
<h1>Rename {%s hyphaName %}</h1>
<form action="/rename-confirm/{%s hyphaName %}" method="post" enctype="multipart/form-data">
2020-10-03 16:56:56 +00:00
<fieldset>
<legend>New name</legend>
<input type="text" value="{%s hyphaName %}" required autofocus id="new-name" name="new-name"/>
</fieldset>
<fieldset>
<legend>Settings</legend>
<input type="checkbox" id="recursive" name="recursive" value="true" checked/>
<label for="recursive">Keep subhyphae</label>
</fieldset>
<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>
2020-10-02 15:31:59 +00:00
<input type="submit"/>
</form>
</section>
{%- else -%}
{%= cannotRenameDueToNonExistence(hyphaName) %}
{%- endif -%}
</main>
{% endfunc %}
{% func cannotRenameDueToNonExistence(hyphaName string) %}
<section>
<h1>Cannot rename {%s hyphaName %}</h1>
<p>This hypha does not exist.</p>
<p><a href="/page/{%s hyphaName %}">Go back</a></p>
</section>
{% endfunc %}