From 66c3c1570d409fcbe1a6be7d1b76c9731473eb1a Mon Sep 17 00:00:00 2001
From: Timur Ismagilov
Date: Thu, 16 Jun 2022 13:40:37 +0300
Subject: [PATCH] Remove those ridiculous helper functions
---
views/modal.qtpl | 88 ++++----
views/modal.qtpl.go | 511 ++++++++++++++++++++------------------------
2 files changed, 276 insertions(+), 323 deletions(-)
diff --git a/views/modal.qtpl b/views/modal.qtpl
index 30994d6..c692862 100644
--- a/views/modal.qtpl
+++ b/views/modal.qtpl
@@ -6,44 +6,61 @@
{% code
lc := l18n.FromRequest(rq)
%}
-{%= modalBegin(
- "delete",
- hyphaName,
- ` method="post"`,
- fmt.Sprintf(lc.Get("ui.ask_delete"), beautifulLink(hyphaName))) %}
-
- {%s= lc.Get("ui.ask_really", &l18n.Replacements{"verb": lc.Get("ui.ask_delete_verb"), "name": fmt.Sprintf("%s", hyphaName)}) %}
-
-{%s lc.Get("ui.ask_delete_tip") %}
-{%= modalEnd(hyphaName, true, lc) %}
+
+
+
{% endfunc %}
{% func RemoveMediaAsk(rq *http.Request, hyphaName string) %}
{% code
lc := l18n.FromRequest(rq)
%}
-{%= modalBegin(
- "remove-media",
- hyphaName,
- ` method="post"`,
- fmt.Sprintf(lc.Get("ui.ask_remove_media"), beautifulLink(hyphaName))) %}
-
- {%s= lc.Get("ui.ask_really", &l18n.Replacements{"verb": lc.Get("ui.ask_remove_media_verb"), "name": fmt.Sprintf("%s", hyphaName)}) %}
-
-{%= modalEnd(hyphaName, true, lc) %}
+
+
+
{% endfunc %}
-bloody hell !!
-
{% func RenameAsk(rq *http.Request, hyphaName string) %}
{% code
lc := l18n.FromRequest(rq)
%}
-{%= modalBegin(
- "rename",
- hyphaName,
- ` method="post" enctype="multipart/form-data"`,
- fmt.Sprintf(lc.Get("ui.ask_rename"), beautifulLink(hyphaName))) %}
+
+
`)
-//line views/modal.qtpl:53
- qw422016.E().S(lc.Get("ui.rename_tip"))
-//line views/modal.qtpl:53
+//line views/modal.qtpl:18
+ qw422016.E().S(lc.Get("ui.ask_delete_tip"))
+//line views/modal.qtpl:18
qw422016.N().S(`
-`)
-//line views/modal.qtpl:54
- streammodalEnd(qw422016, hyphaName, false, lc)
-//line views/modal.qtpl:54
- qw422016.N().S(`
-`)
-//line views/modal.qtpl:55
-}
-
-//line views/modal.qtpl:55
-func WriteRenameAsk(qq422016 qtio422016.Writer, rq *http.Request, hyphaName string) {
-//line views/modal.qtpl:55
- qw422016 := qt422016.AcquireWriter(qq422016)
-//line views/modal.qtpl:55
- StreamRenameAsk(qw422016, rq, hyphaName)
-//line views/modal.qtpl:55
- qt422016.ReleaseWriter(qw422016)
-//line views/modal.qtpl:55
-}
-
-//line views/modal.qtpl:55
-func RenameAsk(rq *http.Request, hyphaName string) string {
-//line views/modal.qtpl:55
- qb422016 := qt422016.AcquireByteBuffer()
-//line views/modal.qtpl:55
- WriteRenameAsk(qb422016, rq, hyphaName)
-//line views/modal.qtpl:55
- qs422016 := string(qb422016.B)
-//line views/modal.qtpl:55
- qt422016.ReleaseByteBuffer(qb422016)
-//line views/modal.qtpl:55
- return qs422016
-//line views/modal.qtpl:55
-}
-
-//line views/modal.qtpl:57
-func streammodalBegin(qw422016 *qt422016.Writer, path, hyphaName, formAttrs, legend string) {
-//line views/modal.qtpl:57
- qw422016.N().S(`
-
-
`)
-//line views/modal.qtpl:70
+//line views/modal.qtpl:28
}
-//line views/modal.qtpl:70
-func writemodalEnd(qq422016 qtio422016.Writer, hyphaName string, shouldFocusOnConfirm bool, lc *l18n.Localizer) {
-//line views/modal.qtpl:70
+//line views/modal.qtpl:28
+func WriteDeleteAsk(qq422016 qtio422016.Writer, rq *http.Request, hyphaName string) {
+//line views/modal.qtpl:28
qw422016 := qt422016.AcquireWriter(qq422016)
-//line views/modal.qtpl:70
- streammodalEnd(qw422016, hyphaName, shouldFocusOnConfirm, lc)
-//line views/modal.qtpl:70
+//line views/modal.qtpl:28
+ StreamDeleteAsk(qw422016, rq, hyphaName)
+//line views/modal.qtpl:28
qt422016.ReleaseWriter(qw422016)
-//line views/modal.qtpl:70
+//line views/modal.qtpl:28
}
-//line views/modal.qtpl:70
-func modalEnd(hyphaName string, shouldFocusOnConfirm bool, lc *l18n.Localizer) string {
-//line views/modal.qtpl:70
+//line views/modal.qtpl:28
+func DeleteAsk(rq *http.Request, hyphaName string) string {
+//line views/modal.qtpl:28
qb422016 := qt422016.AcquireByteBuffer()
-//line views/modal.qtpl:70
- writemodalEnd(qb422016, hyphaName, shouldFocusOnConfirm, lc)
-//line views/modal.qtpl:70
+//line views/modal.qtpl:28
+ WriteDeleteAsk(qb422016, rq, hyphaName)
+//line views/modal.qtpl:28
qs422016 := string(qb422016.B)
-//line views/modal.qtpl:70
+//line views/modal.qtpl:28
qt422016.ReleaseByteBuffer(qb422016)
-//line views/modal.qtpl:70
+//line views/modal.qtpl:28
return qs422016
-//line views/modal.qtpl:70
+//line views/modal.qtpl:28
+}
+
+//line views/modal.qtpl:30
+func StreamRemoveMediaAsk(qw422016 *qt422016.Writer, rq *http.Request, hyphaName string) {
+//line views/modal.qtpl:30
+ qw422016.N().S(`
+`)
+//line views/modal.qtpl:32
+ lc := l18n.FromRequest(rq)
+
+//line views/modal.qtpl:33
+ qw422016.N().S(`
+
+
+
+`)
+//line views/modal.qtpl:50
+}
+
+//line views/modal.qtpl:50
+func WriteRemoveMediaAsk(qq422016 qtio422016.Writer, rq *http.Request, hyphaName string) {
+//line views/modal.qtpl:50
+ qw422016 := qt422016.AcquireWriter(qq422016)
+//line views/modal.qtpl:50
+ StreamRemoveMediaAsk(qw422016, rq, hyphaName)
+//line views/modal.qtpl:50
+ qt422016.ReleaseWriter(qw422016)
+//line views/modal.qtpl:50
+}
+
+//line views/modal.qtpl:50
+func RemoveMediaAsk(rq *http.Request, hyphaName string) string {
+//line views/modal.qtpl:50
+ qb422016 := qt422016.AcquireByteBuffer()
+//line views/modal.qtpl:50
+ WriteRemoveMediaAsk(qb422016, rq, hyphaName)
+//line views/modal.qtpl:50
+ qs422016 := string(qb422016.B)
+//line views/modal.qtpl:50
+ qt422016.ReleaseByteBuffer(qb422016)
+//line views/modal.qtpl:50
+ return qs422016
+//line views/modal.qtpl:50
+}
+
+//line views/modal.qtpl:52
+func StreamRenameAsk(qw422016 *qt422016.Writer, rq *http.Request, hyphaName string) {
+//line views/modal.qtpl:52
+ qw422016.N().S(`
+`)
+//line views/modal.qtpl:54
+ lc := l18n.FromRequest(rq)
+
+//line views/modal.qtpl:55
+ qw422016.N().S(`
+
+
+
+`)
+//line views/modal.qtpl:76
+}
+
+//line views/modal.qtpl:76
+func WriteRenameAsk(qq422016 qtio422016.Writer, rq *http.Request, hyphaName string) {
+//line views/modal.qtpl:76
+ qw422016 := qt422016.AcquireWriter(qq422016)
+//line views/modal.qtpl:76
+ StreamRenameAsk(qw422016, rq, hyphaName)
+//line views/modal.qtpl:76
+ qt422016.ReleaseWriter(qw422016)
+//line views/modal.qtpl:76
+}
+
+//line views/modal.qtpl:76
+func RenameAsk(rq *http.Request, hyphaName string) string {
+//line views/modal.qtpl:76
+ qb422016 := qt422016.AcquireByteBuffer()
+//line views/modal.qtpl:76
+ WriteRenameAsk(qb422016, rq, hyphaName)
+//line views/modal.qtpl:76
+ qs422016 := string(qb422016.B)
+//line views/modal.qtpl:76
+ qt422016.ReleaseByteBuffer(qb422016)
+//line views/modal.qtpl:76
+ return qs422016
+//line views/modal.qtpl:76
}