feat(*): add image grids for album and associated media displays

This commit is contained in:
Cory Dransfeldt 2025-05-24 17:19:30 -07:00
parent 9b4baad5fb
commit 35260962a5
No known key found for this signature in database
44 changed files with 933 additions and 644 deletions

View file

@ -2,12 +2,12 @@
{% if media.size > 0 %}
<div class="associated-media">
{% assign sections =
"artists:headphones:music:Related artist(s)," | append:
"books:books:books:Related book(s)," | append:
"genres:headphones:music:Related genre(s)," | append:
"movies:movie:movies:Related movie(s)," | append:
"posts:article:article:Related post(s)," | append:
"shows:device-tv-old:tv:Related show(s)"
"artists:headphones:music:Related artist(s):true," | append:
"books:books:books:Related book(s):true," | append:
"genres:headphones:music:Related genre(s):false," | append:
"movies:movie:movies:Related movie(s):true," | append:
"posts:article:article:Related post(s):false," | append:
"shows:device-tv-old:tv:Related show(s):true"
| split:"," %}
{% for section in sections %}
{% assign parts = section | split:":" %}
@ -15,6 +15,8 @@
{% assign icon = parts[1] %}
{% assign css_class = parts[2] %}
{% assign label = parts[3] %}
{% assign hasGrid = parts[4] == "true" %}
{% assign items = nil %}
{% case key %}
{% when "artists" %} {% assign items = artists %}
{% when "books" %} {% assign items = books %}
@ -24,26 +26,37 @@
{% when "shows" %} {% assign items = shows %}
{% endcase %}
{% if items and items.size > 0 %}
<p id="{{ key }}" class="{{ css_class }}">
<h3 id="{{ key }}" class="{{ css_class }}">
{% tablericon icon %}
{{ label }}
</p>
<ul>
{% for item in items %}
<li class="{{ css_class }}">
<a href="{{ item.url }}">{{ item.title | default:item.name }}</a>
{% if key == "artists" and item.total_plays > 0 %}
({{ item.total_plays }} {{ item.total_plays | pluralize:"play" }})
{% elsif key == "books" %}
by {{ item.author }}
{% elsif key == "movies" or key == "shows" %}
({{ item.year }})
{% elsif key == "posts" %}
({{ item.date | date:"%B %e, %Y" }})
{% endif %}
</li>
{% endfor %}
</ul>
</h3>
{% if hasGrid %}
{% assign shape = "square" %}
{% if key == "books" or key == "movies" or key == "shows" %}
{% assign shape = "vertical" %}
{% endif %}
{% render "media/grid.liquid",
data:items,
shape:shape
%}
{% else %}
<ul>
{% for item in items %}
<li class="{{ css_class }}">
<a href="{{ item.url }}">{{ item.title | default:item.name }}</a>
{% if key == "artists" and item.total_plays > 0 %}
({{ item.total_plays }} {{ item.total_plays | pluralize:"play" }})
{% elsif key == "books" %}
by {{ item.author }}
{% elsif key == "movies" or key == "shows" %}
({{ item.year }})
{% elsif key == "posts" %}
({{ item.date | date:"%B %e, %Y" }})
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
{% endif %}
{% endfor %}
</div>