2021-09-06 17:46:34 +00:00
|
|
|
{% import "fmt" %}
|
2021-02-22 18:11:37 +00:00
|
|
|
{% import "net/http" %}
|
2021-09-06 17:46:34 +00:00
|
|
|
{% import "github.com/bouncepaw/mycorrhiza/l18n" %}
|
2021-02-22 18:11:37 +00:00
|
|
|
|
2022-03-20 21:24:40 +00:00
|
|
|
{% func DeleteAsk(rq *http.Request, hyphaName string) %}
|
2021-09-06 17:46:34 +00:00
|
|
|
{% code
|
|
|
|
lc := l18n.FromRequest(rq)
|
|
|
|
%}
|
2021-02-22 18:11:37 +00:00
|
|
|
{%= modalBegin(
|
2022-02-19 21:12:28 +00:00
|
|
|
"delete",
|
2021-02-22 18:11:37 +00:00
|
|
|
hyphaName,
|
2022-03-08 20:12:35 +00:00
|
|
|
` method="post"`,
|
2021-09-06 17:46:34 +00:00
|
|
|
fmt.Sprintf(lc.Get("ui.ask_delete"), beautifulLink(hyphaName))) %}
|
|
|
|
{%= modalReallyWant(hyphaName, lc.Get("ui.ask_delete_verb"), lc) %}
|
|
|
|
<p>{%s lc.Get("ui.ask_delete_tip") %}</p>
|
|
|
|
{%= modalEnd(hyphaName, true, lc) %}
|
2021-02-22 18:11:37 +00:00
|
|
|
{% endfunc %}
|
|
|
|
|
2022-03-20 21:24:40 +00:00
|
|
|
{% func RemoveMediaAsk(rq *http.Request, hyphaName string) %}
|
2021-09-06 17:46:34 +00:00
|
|
|
{% code
|
|
|
|
lc := l18n.FromRequest(rq)
|
|
|
|
%}
|
2021-02-22 18:11:37 +00:00
|
|
|
{%= modalBegin(
|
2022-02-19 21:12:28 +00:00
|
|
|
"remove-media",
|
2021-02-22 18:11:37 +00:00
|
|
|
hyphaName,
|
2022-03-08 20:12:35 +00:00
|
|
|
` method="post"`,
|
2022-02-19 21:12:28 +00:00
|
|
|
fmt.Sprintf(lc.Get("ui.ask_remove_media"), beautifulLink(hyphaName))) %}
|
|
|
|
{%= modalReallyWant(hyphaName, lc.Get("ui.ask_remove_media_verb"), lc) %}
|
2021-09-06 17:46:34 +00:00
|
|
|
{%= modalEnd(hyphaName, true, lc) %}
|
2021-02-22 18:11:37 +00:00
|
|
|
{% endfunc %}
|
|
|
|
|
2022-02-19 21:12:28 +00:00
|
|
|
bloody hell !!
|
|
|
|
|
2022-03-20 21:24:40 +00:00
|
|
|
{% func RenameAsk(rq *http.Request, hyphaName string) %}
|
2021-09-06 17:46:34 +00:00
|
|
|
{% code
|
|
|
|
lc := l18n.FromRequest(rq)
|
|
|
|
%}
|
2021-02-22 18:11:37 +00:00
|
|
|
{%= modalBegin(
|
2022-02-19 21:12:28 +00:00
|
|
|
"rename",
|
2021-02-22 18:11:37 +00:00
|
|
|
hyphaName,
|
|
|
|
` method="post" enctype="multipart/form-data"`,
|
2021-09-06 17:46:34 +00:00
|
|
|
fmt.Sprintf(lc.Get("ui.ask_rename"), beautifulLink(hyphaName))) %}
|
|
|
|
<label for="new-name">{%s lc.Get("ui.rename_to") %}</label>
|
2021-02-22 18:11:37 +00:00
|
|
|
<input type="text" value="{%s hyphaName %}" required autofocus id="new-name" name="new-name"/>
|
|
|
|
|
|
|
|
<input type="checkbox" id="recursive" name="recursive" value="true" checked/>
|
2021-09-06 17:46:34 +00:00
|
|
|
<label for="recursive">{%s lc.Get("ui.rename_recurse") %}</label>
|
2021-02-22 18:11:37 +00:00
|
|
|
|
2021-09-06 17:46:34 +00:00
|
|
|
<p>{%s lc.Get("ui.rename_tip") %}</p>
|
|
|
|
{%= modalEnd(hyphaName, false, lc) %}
|
2021-02-22 18:11:37 +00:00
|
|
|
{% endfunc %}
|
|
|
|
|
2021-09-06 17:46:34 +00:00
|
|
|
{% func modalReallyWant(hyphaName, verb string, lc *l18n.Localizer) %}
|
|
|
|
<p class="modal__confirmation-msg">{%s= lc.Get("ui.ask_really", &l18n.Replacements{"verb": verb, "name": fmt.Sprintf("<em>%s</em>", hyphaName)}) %}</p>
|
2021-02-22 18:11:37 +00:00
|
|
|
{% endfunc %}
|
|
|
|
|
|
|
|
{% func modalBegin(path, hyphaName, formAttrs, legend string) %}
|
|
|
|
<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 %}
|
|
|
|
|
2021-09-06 17:46:34 +00:00
|
|
|
{% func modalEnd(hyphaName string, shouldFocusOnConfirm bool, lc *l18n.Localizer) %}
|
|
|
|
<button type="submit" value="Confirm" class="btn" {% if shouldFocusOnConfirm %}autofocus{% endif %}>{%s lc.Get("ui.confirm") %}</button>
|
|
|
|
<a href="/hypha/{%s hyphaName %}" class="btn btn_weak">{%s lc.Get("ui.cancel") %}</a>
|
2021-02-22 18:11:37 +00:00
|
|
|
</fieldset>
|
|
|
|
</form>
|
|
|
|
</main>
|
|
|
|
{% endfunc %}
|