diff options
| author | Gabriel Arakaki Giovanini <mail@gabrielgio.me> | 2023-07-18 23:20:15 +0200 | 
|---|---|---|
| committer | Gabriel Arakaki Giovanini <mail@gabrielgio.me> | 2023-07-18 23:21:38 +0200 | 
| commit | 55448bc974f71f83e6a6c6d70afe9cfc63d275f4 (patch) | |
| tree | 40a392a2af845ebb07ead41b2fb0d25fd40f5fb8 /pkg | |
| parent | 8448f93e179e03d4ba46af7ae457675146f93d6b (diff) | |
| download | lens-55448bc974f71f83e6a6c6d70afe9cfc63d275f4.tar.gz lens-55448bc974f71f83e6a6c6d70afe9cfc63d275f4.tar.bz2 lens-55448bc974f71f83e6a6c6d70afe9cfc63d275f4.zip | |
feat: Move media from `html/template` to qtpl
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/view/media.go | 25 | 
1 files changed, 10 insertions, 15 deletions
| diff --git a/pkg/view/media.go b/pkg/view/media.go index 6d380e2..4bf8d68 100644 --- a/pkg/view/media.go +++ b/pkg/view/media.go @@ -5,9 +5,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 ( @@ -15,11 +15,6 @@ type (  		mediaRepository repository.MediaRepository  		userRepository  repository.UserRepository  	} - -	Page struct { -		Medias []*repository.Media -		Next   *repository.Pagination -	}  )  func getPagination(ctx *fasthttp.RequestCtx) *repository.Pagination { @@ -77,16 +72,16 @@ func (self *MediaView) Index(ctx *fasthttp.RequestCtx) error {  		return err  	} -	err = img.Render(ctx, "media.html", &img.HTMLView[*Page]{ -		Title: "Media", -		Data: &Page{ -			Medias: medias, -			Next: &repository.Pagination{ -				Size: p.Size, -				Page: p.Page + 1, -			}, +	page := &templates.MediaPage{ +		Medias: medias, +		Next: &repository.Pagination{ +			Size: p.Size, +			Page: p.Page + 1,  		}, -	}) +	} + +	templates.WritePageTemplate(ctx, page) +  	if err != nil {  		return err  	} | 
