From c51fb8cc8b850b4915e083d0dd2c30d79f8b632e Mon Sep 17 00:00:00 2001 From: Gabriel Arakaki Giovanini Date: Sun, 13 Aug 2023 21:36:42 +0200 Subject: 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 :) --- templates/album.qtpl | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ templates/base.qtpl | 6 ++++-- 2 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 templates/album.qtpl (limited to 'templates') 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() %} +

{%s p.Name %}

+
+{% for _, a := range p.Albums %} + {%s a.Name %} +{% endfor %} +
+
+{% for _, media := range p.Medias %} +
+ {% if media.IsVideo() %} + + {% else %} +
+ +
+ {% endif %} +
+{% endfor %} +
+
+ next +
+{% 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. media + + album + settings -- cgit v1.2.3