From e359eaaebd7270476075ca9e08b7b53fb9e69f24 Mon Sep 17 00:00:00 2001 From: Gabriel Arakaki Giovanini Date: Wed, 19 Jul 2023 20:12:07 +0200 Subject: feat: Move register from `html/template` to qtpl --- pkg/view/auth.go | 4 ++-- templates/error.qtpl | 4 +--- templates/login.qtpl | 4 +--- templates/media.qtpl | 4 +--- templates/register.qtpl | 35 +++++++++++++++++++++++++++++++++++ 5 files changed, 40 insertions(+), 11 deletions(-) create mode 100644 templates/register.qtpl diff --git a/pkg/view/auth.go b/pkg/view/auth.go index 5d73b22..631cfb3 100644 --- a/pkg/view/auth.go +++ b/pkg/view/auth.go @@ -5,7 +5,6 @@ import ( "github.com/valyala/fasthttp" - "git.sr.ht/~gabrielgio/img" "git.sr.ht/~gabrielgio/img/pkg/ext" "git.sr.ht/~gabrielgio/img/pkg/service" "git.sr.ht/~gabrielgio/img/templates" @@ -71,7 +70,8 @@ func Index(ctx *fasthttp.RequestCtx) { } func (v *AuthView) InitialRegisterView(ctx *fasthttp.RequestCtx) error { - return img.Render[interface{}](ctx, "register.html", nil) + templates.WritePageTemplate(ctx, &templates.RegisterPage{}) + return nil } func (v *AuthView) InitialRegister(ctx *fasthttp.RequestCtx) error { diff --git a/templates/error.qtpl b/templates/error.qtpl index b71adc8..d82ca1c 100644 --- a/templates/error.qtpl +++ b/templates/error.qtpl @@ -4,9 +4,7 @@ type ErrorPage struct { } %} -{% func (p *ErrorPage) Title() %} -Error -{% endfunc %} +{% func (p *ErrorPage) Title() %}Error{% endfunc %} {% func (p *ErrorPage) Content() %} {%s p.Err %} diff --git a/templates/login.qtpl b/templates/login.qtpl index b8aa98c..d0490f9 100644 --- a/templates/login.qtpl +++ b/templates/login.qtpl @@ -2,9 +2,7 @@ type LoginPage struct {} %} -{% func (p *LoginPage) Title() %} -Login -{% endfunc %} +{% func (p *LoginPage) Title() %}Login{% endfunc %} {% func (p *LoginPage) Content() %}
diff --git a/templates/media.qtpl b/templates/media.qtpl index b9b3bf5..65b39c4 100644 --- a/templates/media.qtpl +++ b/templates/media.qtpl @@ -7,9 +7,7 @@ type MediaPage struct { } %} -{% func (p *MediaPage) Title() %} -Media -{% endfunc %} +{% func (p *MediaPage) Title() %}Media{% endfunc %} {% func (p *MediaPage) Content() %}
diff --git a/templates/register.qtpl b/templates/register.qtpl new file mode 100644 index 0000000..115edfe --- /dev/null +++ b/templates/register.qtpl @@ -0,0 +1,35 @@ +{% code +type RegisterPage struct {} +%} + +{% func (p *RegisterPage) Title() %}Login{% endfunc %} + +{% func (p *RegisterPage) Content() %} +

Initial Setup

+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +{% endfunc %} + +{% func (p *RegisterPage) Script() %} +{% endfunc %} -- cgit v1.2.3