diff options
author | Gabriel Arakaki Giovanini <mail@gabrielgio.me> | 2023-08-13 21:36:42 +0200 |
---|---|---|
committer | Gabriel Arakaki Giovanini <mail@gabrielgio.me> | 2023-08-13 21:36:42 +0200 |
commit | c51fb8cc8b850b4915e083d0dd2c30d79f8b632e (patch) | |
tree | 527ba9e4f897bc2faf997ff648aeb85cc9c247eb /templates | |
parent | f99f2bc94808d784c92ec4e58c660a8be3ed7fce (diff) | |
download | lens-c51fb8cc8b850b4915e083d0dd2c30d79f8b632e.tar.gz lens-c51fb8cc8b850b4915e083d0dd2c30d79f8b632e.tar.bz2 lens-c51fb8cc8b850b4915e083d0dd2c30d79f8b632e.zip |
feat: Add (yet again) crude album implementation
This is a initial UI album implementation. This should cover the most
basic album navigation.
This is still plenty to do :)
Diffstat (limited to 'templates')
-rw-r--r-- | templates/album.qtpl | 50 | ||||
-rw-r--r-- | templates/base.qtpl | 6 |
2 files changed, 54 insertions, 2 deletions
diff --git a/templates/album.qtpl b/templates/album.qtpl new file mode 100644 index 0000000..ce8111e --- /dev/null +++ b/templates/album.qtpl @@ -0,0 +1,50 @@ +{% import "git.sr.ht/~gabrielgio/img/pkg/database/repository" %} + +{% code +type AlbumPage struct { + Medias []*repository.Media + Next *repository.Pagination + Settings *repository.Settings + Albums []*repository.Album + Name string +} + +func (m *AlbumPage) PreloadAttr() string { + if m.Settings.PreloadVideoMetadata { + return "metadata" + } + return "none" +} +%} + +{% func (p *AlbumPage) Title() %}Media{% endfunc %} + +{% func (p *AlbumPage) Content() %} +<h1 class="title">{%s p.Name %}</h1> +<div class="tags are-large"> +{% for _, a := range p.Albums %} + <a href="/album/?albumId={%s FromUInttoString(&a.ID) %}" class="tag">{%s a.Name %}</a> +{% endfor %} +</div> +<div class="columns is-multiline"> +{% for _, media := range p.Medias %} + <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() %}"> + <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> + {% endif %} + </div> +{% endfor %} +</div> +<div class="row"> + <a href="/media/?page={%d p.Next.Page %}" class="button is-pulled-right">next</a> +</div> +{% endfunc %} + +{% func (p *AlbumPage) Script() %} +{% endfunc %} diff --git a/templates/base.qtpl b/templates/base.qtpl index 5a7c3b7..772167d 100644 --- a/templates/base.qtpl +++ b/templates/base.qtpl @@ -11,8 +11,7 @@ Page { %} -{% code - func FromUInttoString(u *uint) string { +{% code func FromUInttoString(u *uint) string { if u != nil { return strconv.FormatUint(uint64(*u), 10) } @@ -40,6 +39,9 @@ Page prints a page implementing Page interface. <a href="/media/" class="navbar-item"> media </a> + <a href="/album/" class="navbar-item"> + album + </a> <a href="/settings/" class="navbar-item"> settings </a> |