lens @ e359eaaebd7270476075ca9e08b7b53fb9e69f24

feat: Move register from `html/template` to qtpl
  1diff --git a/pkg/view/auth.go b/pkg/view/auth.go
  2index 5d73b226372f028795f49131ca60be3cf10a8996..631cfb30815cde5ec8694a09073da6a597b8e0a4 100644
  3--- a/pkg/view/auth.go
  4+++ b/pkg/view/auth.go
  5@@ -5,7 +5,6 @@ 	"encoding/base64"
  6 
  7 	"github.com/valyala/fasthttp"
  8 
  9-	"git.sr.ht/~gabrielgio/img"
 10 	"git.sr.ht/~gabrielgio/img/pkg/ext"
 11 	"git.sr.ht/~gabrielgio/img/pkg/service"
 12 	"git.sr.ht/~gabrielgio/img/templates"
 13@@ -71,7 +70,8 @@ 	ctx.Redirect("/login", 307)
 14 }
 15 
 16 func (v *AuthView) InitialRegisterView(ctx *fasthttp.RequestCtx) error {
 17-	return img.Render[interface{}](ctx, "register.html", nil)
 18+	templates.WritePageTemplate(ctx, &templates.RegisterPage{})
 19+	return nil
 20 }
 21 
 22 func (v *AuthView) InitialRegister(ctx *fasthttp.RequestCtx) error {
 23diff --git a/templates/error.qtpl b/templates/error.qtpl
 24index b71adc8794e3bfc0f43978ccb594900210cc38af..d82ca1c98904e31f12e80771a9c44664a105dc41 100644
 25--- a/templates/error.qtpl
 26+++ b/templates/error.qtpl
 27@@ -4,9 +4,7 @@     Err string
 28 }
 29 %}
 30 
 31-{% func (p *ErrorPage) Title() %}
 32-Error
 33-{% endfunc %}
 34+{% func (p *ErrorPage) Title() %}Error{% endfunc %}
 35 
 36 {% func (p *ErrorPage) Content() %}
 37 {%s p.Err %}
 38diff --git a/templates/login.qtpl b/templates/login.qtpl
 39index b8aa98c327c66c6d406ff87ecb76d615480e2fab..d0490f94ddc82b479fa317fd6bdb3b5ce859bb79 100644
 40--- a/templates/login.qtpl
 41+++ b/templates/login.qtpl
 42@@ -2,9 +2,7 @@ {% code
 43 type LoginPage struct {}
 44 %}
 45 
 46-{% func (p *LoginPage) Title() %}
 47-Login
 48-{% endfunc %}
 49+{% func (p *LoginPage) Title() %}Login{% endfunc %}
 50 
 51 {% func (p *LoginPage) Content() %}
 52 <form action="/login" method="post">
 53diff --git a/templates/media.qtpl b/templates/media.qtpl
 54index b9b3bf55abe33232484b8d4d7f4b200cf75d3699..65b39c426344118fbbe8e1336ddb02c5e36e8e77 100644
 55--- a/templates/media.qtpl
 56+++ b/templates/media.qtpl
 57@@ -7,9 +7,7 @@ 	Next   *repository.Pagination
 58 }
 59 %}
 60 
 61-{% func (p *MediaPage) Title() %}
 62-Media
 63-{% endfunc %}
 64+{% func (p *MediaPage) Title() %}Media{% endfunc %}
 65 
 66 {% func (p *MediaPage) Content() %}
 67 <div class="columns is-multiline">
 68diff --git a/templates/register.qtpl b/templates/register.qtpl
 69new file mode 100644
 70index 0000000000000000000000000000000000000000..115edfeab3e33fe1f11b2dbf6afc9f3587e40a88
 71--- /dev/null
 72+++ b/templates/register.qtpl
 73@@ -0,0 +1,35 @@
 74+{% code
 75+type RegisterPage struct {}
 76+%}
 77+
 78+{% func (p *RegisterPage) Title() %}Login{% endfunc %}
 79+
 80+{% func (p *RegisterPage) Content() %}
 81+<h1>Initial Setup</h1>
 82+<form action="/initial" method="post">
 83+    <div class="field">
 84+        <label class="label">Username</label>
 85+        <div class="control">
 86+            <input class="input" name="username" type="text">
 87+        </div>
 88+    </div>
 89+    <div class="field">
 90+        <label class="label">Password</label>
 91+        <div class="control">
 92+            <input class="input" name="password" type="password">
 93+        </div>
 94+    </div>
 95+    <div class="field">
 96+        <label class="label">Root folder</label>
 97+        <div class="control">
 98+            <input class="input" name="path" type="text">
 99+        </div>
100+    </div>
101+    <div class="field">
102+        <input class="button is-pulled-right" value="Save" type="submit">
103+    </div>
104+</form>
105+{% endfunc %}
106+
107+{% func (p *RegisterPage) Script() %}
108+{% endfunc %}