From 99a7e9ab02ae1980874be35f6a2651ca4bfdb951 Mon Sep 17 00:00:00 2001 From: Gabriel Arakaki Giovanini Date: Fri, 6 Oct 2023 18:30:34 +0200 Subject: feat: Simplify mosaic The old implementation was not good and would render the list on mobile in the wrong order --- templates/album.qtpl | 16 ++++++++-------- templates/media.qtpl | 2 -- templates/mosaic.qtpl | 27 +++++++-------------------- 3 files changed, 15 insertions(+), 30 deletions(-) (limited to 'templates') diff --git a/templates/album.qtpl b/templates/album.qtpl index 58fc499..246c77c 100644 --- a/templates/album.qtpl +++ b/templates/album.qtpl @@ -20,15 +20,15 @@ func (m *AlbumPage) PreloadAttr() string { {% func (p *AlbumPage) Title() %}Media{% endfunc %} {% func (p *AlbumPage) Content() %} -

{%s p.Name %}

-
-{% for _, a := range p.Albums %} - {%s a.Name %} -{% endfor %} -
-
+
+

{%s p.Name %}

+
+ {% for _, a := range p.Albums %} + {%s a.Name %} + {% endfor %} +
+
{%= Mosaic(p.Medias, p.PreloadAttr()) %} -
next
diff --git a/templates/media.qtpl b/templates/media.qtpl index 737d03d..6a13827 100644 --- a/templates/media.qtpl +++ b/templates/media.qtpl @@ -18,9 +18,7 @@ func (m *MediaPage) PreloadAttr() string { {% func (p *MediaPage) Title() %}Media{% endfunc %} {% func (p *MediaPage) Content() %} -
{%= Mosaic(p.Medias, p.PreloadAttr()) %} -
next
diff --git a/templates/mosaic.qtpl b/templates/mosaic.qtpl index 21a8bae..9e941b6 100644 --- a/templates/mosaic.qtpl +++ b/templates/mosaic.qtpl @@ -1,26 +1,13 @@ {% import "git.sr.ht/~gabrielgio/img/pkg/database/repository" %} -{% import "git.sr.ht/~gabrielgio/img/pkg/list" %} {% func Mosaic(medias []*repository.Media, preloadAttr string) %} -
-{% for _, c := range list.Distribuite(medias, 6) %} -
- {% for _, media := range c %} - - {% endfor %} -
+
+{% for _, media := range medias %} + +
+ +
+
{% endfor %}
{% endfunc %} -- cgit v1.2.3