diff options
Diffstat (limited to 'templates')
-rw-r--r-- | templates/album.qtpl | 9 | ||||
-rw-r--r-- | templates/media.qtpl | 9 |
2 files changed, 14 insertions, 4 deletions
diff --git a/templates/album.qtpl b/templates/album.qtpl index 9f4c0bd..328c6d4 100644 --- a/templates/album.qtpl +++ b/templates/album.qtpl @@ -1,4 +1,5 @@ {% import "git.sr.ht/~gabrielgio/img/pkg/database/repository" %} +{% import "git.sr.ht/~gabrielgio/img/pkg/list" %} {% code type AlbumPage struct { @@ -26,8 +27,10 @@ func (m *AlbumPage) PreloadAttr() string { <a href="/album/?albumId={%s FromUInttoString(&a.ID) %}" class="tag text-size-2">{%s a.Name %}</a> {% endfor %} </div> -<div class="columns is-multiline"> -{% for _, media := range p.Medias %} +<div class="columns"> +{% for _, c := range list.Chunck(p.Medias, 4) %} + <div class="column is-3"> + {% for _, media := range c %} <div class="card-image"> {% if media.IsVideo() %} <video class="image is-fit" controls muted="true" poster="/media/thumbnail/?path_hash={%s media.PathHash %}" preload="{%s p.PreloadAttr() %}"> @@ -39,6 +42,8 @@ func (m *AlbumPage) PreloadAttr() string { </figure> {% endif %} </div> + {% endfor %} + </div> {% endfor %} </div> <div> diff --git a/templates/media.qtpl b/templates/media.qtpl index 11fc9bc..7dcdf54 100644 --- a/templates/media.qtpl +++ b/templates/media.qtpl @@ -1,4 +1,5 @@ {% import "git.sr.ht/~gabrielgio/img/pkg/database/repository" %} +{% import "git.sr.ht/~gabrielgio/img/pkg/list" %} {% code type MediaPage struct { @@ -18,8 +19,10 @@ func (m *MediaPage) PreloadAttr() string { {% func (p *MediaPage) Title() %}Media{% endfunc %} {% func (p *MediaPage) Content() %} -<div class="columns is-multiline"> -{% for _, media := range p.Medias %} +<div class="columns"> +{% for _, c := range list.Chunck(p.Medias, 4) %} + <div class="column is-3"> + {% for _, media := range c %} <div class="card-image"> {% if media.IsVideo() %} <video class="image is-fit" controls muted="true" poster="/media/thumbnail/?path_hash={%s media.PathHash %}" preload="{%s p.PreloadAttr() %}"> @@ -31,6 +34,8 @@ func (m *MediaPage) PreloadAttr() string { </figure> {% endif %} </div> + {% endfor %} + </div> {% endfor %} </div> <div> |