From 1d9d5f40fe4092657f529bdba18f6f52511eea00 Mon Sep 17 00:00:00 2001 From: Gabriel Arakaki Giovanini Date: Wed, 19 Jul 2023 19:50:54 +0200 Subject: feat: Move login from `html/template` to qtpl --- pkg/view/auth.go | 4 +++- templates/login.html | 24 ------------------------ templates/login.qtpl | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 25 deletions(-) delete mode 100644 templates/login.html create mode 100644 templates/login.qtpl diff --git a/pkg/view/auth.go b/pkg/view/auth.go index 6b096d9..5d73b22 100644 --- a/pkg/view/auth.go +++ b/pkg/view/auth.go @@ -8,6 +8,7 @@ import ( "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" ) type AuthView struct { @@ -21,7 +22,8 @@ func NewAuthView(userController *service.AuthController) *AuthView { } func (v *AuthView) LoginView(ctx *fasthttp.RequestCtx) error { - return img.Render[interface{}](ctx, "login.html", nil) + templates.WritePageTemplate(ctx, &templates.LoginPage{}) + return nil } func (v *AuthView) Logout(ctx *fasthttp.RequestCtx) error { diff --git a/templates/login.html b/templates/login.html deleted file mode 100644 index 607faa1..0000000 --- a/templates/login.html +++ /dev/null @@ -1,24 +0,0 @@ -{{template "layout.html" .}} -{{define "title"}} Login {{end}} -{{define "content"}} -
-
- -
- -
-
-
- -
- -
-
- -
- -
-
-{{end}} diff --git a/templates/login.qtpl b/templates/login.qtpl new file mode 100644 index 0000000..b8aa98c --- /dev/null +++ b/templates/login.qtpl @@ -0,0 +1,33 @@ +{% code +type LoginPage struct {} +%} + +{% func (p *LoginPage) Title() %} +Login +{% endfunc %} + +{% func (p *LoginPage) Content() %} +
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+
+{% endfunc %} + +{% func (p *LoginPage) Script() %} +{% endfunc %} -- cgit v1.2.3