diff options
author | Gabriel Arakaki Giovanini <mail@gabrielgio.me> | 2023-10-06 18:30:34 +0200 |
---|---|---|
committer | Gabriel Arakaki Giovanini <mail@gabrielgio.me> | 2023-10-06 18:41:13 +0200 |
commit | 99a7e9ab02ae1980874be35f6a2651ca4bfdb951 (patch) | |
tree | 71d4a3f2a7e7df2b527344158dc8b7c684fef518 /templates | |
parent | 91f7c40479aa9ef18c7927913be49a014a8a3115 (diff) | |
download | lens-99a7e9ab02ae1980874be35f6a2651ca4bfdb951.tar.gz lens-99a7e9ab02ae1980874be35f6a2651ca4bfdb951.tar.bz2 lens-99a7e9ab02ae1980874be35f6a2651ca4bfdb951.zip |
feat: Simplify mosaic
The old implementation was not good and would render the list on mobile
in the wrong order
Diffstat (limited to 'templates')
-rw-r--r-- | templates/album.qtpl | 16 | ||||
-rw-r--r-- | templates/media.qtpl | 2 | ||||
-rw-r--r-- | templates/mosaic.qtpl | 27 |
3 files changed, 15 insertions, 30 deletions
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() %} -<h1 class="title text-size-1">{%s p.Name %}</h1> -<div class="tags are-large"> -{% for _, a := range p.Albums %} - <a href="/album?albumId={%s FromUInttoString(&a.ID) %}" class="tag text-size-2">{%s a.Name %}</a> -{% endfor %} -</div> -<div class="columns"> +<section class="section"> + <h1 class="title text-size-1">{%s p.Name %}</h1> + <div class="tags are-large"> + {% for _, a := range p.Albums %} + <a href="/album?albumId={%s FromUInttoString(&a.ID) %}" class="tag text-size-2">{%s a.Name %}</a> + {% endfor %} + </div> +</section> {%= Mosaic(p.Medias, p.PreloadAttr()) %} -</div> <div> <a href="/album?albumId={%s FromUInttoString(p.Next.AlbumID) %}&page={%d p.Next.Page %}" class="button is-pulled-right">next</a> </div> 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() %} -<div class="columns"> {%= Mosaic(p.Medias, p.PreloadAttr()) %} -</div> <div> <a href="/media?page={%d p.Next.Page %}" class="button is-pulled-right">next</a> </div> 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) %} -<div class="columns"> -{% for _, c := range list.Distribuite(medias, 6) %} - <div class="column is-2"> - {% for _, media := range c %} - <div class="card-image"> - <a href="/detail?path_hash={%s media.PathHash %}"> - {% if media.IsVideo() %} - <video class="image is-fit" controls muted="true" poster="/media/thumbnail?path_hash={%s media.PathHash %}" preload="{%s preloadAttr %}"> - <source src="/media/image?path_hash={%s media.PathHash %}" type="{%s media.MIMEType %}"> - </video> - {% else %} - <figure class="image is-fit"> - <img src="/media/thumbnail?path_hash={%s media.PathHash %}"> - </figure> - </a> - {% endif %} - </div> - {% endfor %} - </div> +<div class="gallary_container"> +{% for _, media := range medias %} + <a href="/detail?path_hash={%s media.PathHash %}"> + <figure class="image_container"> + <img src="/media/thumbnail?path_hash={%s media.PathHash %}" > + </figure> + </a> {% endfor %} </div> {% endfunc %} |