lens @ 52276ba99540d6c61195772ccdd50944e96f4959

feat: Move settings from `html/template` to qtpl
diff --git a/pkg/view/settings.go b/pkg/view/settings.go
index 14f4e49fbaa75c5258c946507e6163b8ff1b02f8..bee3dc201b1f21d24ceb66ed7ae59df7cb95b491 100644
--- a/pkg/view/settings.go
+++ b/pkg/view/settings.go
@@ -3,9 +3,9 @@
 import (
 	"github.com/valyala/fasthttp"
 
-	"git.sr.ht/~gabrielgio/img"
 	"git.sr.ht/~gabrielgio/img/pkg/database/repository"
 	"git.sr.ht/~gabrielgio/img/pkg/ext"
+	"git.sr.ht/~gabrielgio/img/templates"
 )
 
 type (
@@ -13,11 +13,6 @@ 	SettingsView struct {
 		// there is not need to create a controller for this
 		settingsRepository repository.SettingsRepository
 		userRepository     repository.UserRepository
-	}
-
-	SettingsPage struct {
-		Settings *repository.Settings
-		Users    []*repository.User
 	}
 )
 
@@ -42,13 +37,12 @@ 	if err != nil {
 		return err
 	}
 
-	return img.Render(ctx, "settings.html", &img.HTMLView[*SettingsPage]{
-		Title: "Settings",
-		Data: &SettingsPage{
-			Settings: s,
-			Users:    users,
-		},
+	templates.WritePageTemplate(ctx, &templates.SettingsPage{
+		Settings: s,
+		Users:    users,
 	})
+
+	return nil
 }
 
 func (self *SettingsView) Save(ctx *fasthttp.RequestCtx) error {
diff --git a/templates/settings.html b/templates/settings.qtpl
rename from templates/settings.html
rename to templates/settings.qtpl
index 8c08773338919637ec0c3cb18e2b050f22945a66..509cddd76e1a34dadd953a7d84a2f838cd3ade31 100644
--- a/templates/settings.html
+++ b/templates/settings.qtpl
@@ -1,13 +1,22 @@
-{{template "layout.html" .}}
-{{define "title"}} {{.Title}} {{end}}
-{{define "content"}}
+{% import "git.sr.ht/~gabrielgio/img/pkg/database/repository" %}
+
+{% code
+type SettingsPage struct {
+    Settings *repository.Settings
+    Users    []*repository.User
+}
+%}
+
+{% func (p *SettingsPage) Title() %}Settings{% endfunc %}
+
+{% func (p *SettingsPage) Content() %}
 <div class="columns">
     <div class="column is-one-third">
         <form action="/settings/", method="post">
             <div class="field">
                 <div class="control">
                     <label class="checkbox">
-                        <input type="checkbox" id="showMode" name="showMode" {{if .Data.Settings.ShowMode}}checked{{end}}>
+                        <input type="checkbox" id="showMode" name="showMode" {% if p.Settings.ShowMode %}checked{% endif %}>
                         Show File Modes
                     </label>
                 </div>
@@ -15,7 +24,7 @@             </div>
             <div class="field">
                 <div class="control">
                     <label class="checkbox">
-                        <input type="checkbox" id="showOwner" name="showOwner" {{if .Data.Settings.ShowOwner}}checked{{end}}>
+                        <input type="checkbox" id="showOwner" name="showOwner" {% if p.Settings.ShowOwner %}checked{% endif %}>
                         Show File Owner
                     </label>
                 </div>
@@ -26,19 +35,22 @@             </div>
         </form>
     </div>
     <div class="column">
-        {{range .Data.Users}}
+    {% for _, user := range p.Users %}
         <div class="panel-block">
             <div class="columns wide-column is-gapless is-mobile">
                 <div class="column">
-                    {{.Username}}
+                    {%s user.Username %}
                 </div>
                 <div class="column">
-                    {{.Path}}
+                    {%s user.Path %}
                 </div>
                 <div class="column  has-text-right"><a href="#">Edit</a> / <a href="#" class="is-danger">Delete</a></div>
             </div>
         </div>
-        {{end}}
+    {% endfor %}
     </div>
 </div>
-{{end}}
+{% endfunc %}
+
+{% func (p *SettingsPage) Script() %}
+{% endfunc %}