1
Fork 0

Simplify spotify rendering and add preview link

This commit is contained in:
Jake Howard 2018-12-01 21:44:23 +00:00
parent 9a5b16934d
commit 5b46a7e442
Signed by: jake
GPG key ID: 57AFB45680EDD477

View file

@ -18,6 +18,7 @@
<table class="table table-hover table-striped">
<thead>
<tr>
<th scope="row"></th>
<th scope="row"></th>
<th scope="row">Track</th>
<th scope="row">Artist</th>
@ -27,11 +28,19 @@
<tbody>
{{ range sort $playlist.tracks.items "track.name" }}
{{ with .track }}
{{ $spotify_url := .external_urls.spotify }}
<tr>
{{ with index (last 1 .album.images) 0 }}
<td><div class="image" data-image="{{ .url }}"></div></td>
{{ with index .album.images 0 }}
<td>
<a href="{{ $spotify_url }}"><div class="image" data-image="{{ .url }}"></div></a>
</td>
{{ end }}
<td><a href="{{ .external_urls.spotify }}">{{ .name }}</a></td>
<td class="text-center">
{{ if .preview_url }}
<a href="{{ .preview_url }}"><i class="fas fa-play"></i></a>
{{ end }}
</td>
<td><a href="{{ $spotify_url }}">{{ .name }}</a></td>
<td>
{{ range $i, $e := .artists }}{{ if $i }}, {{ end }}{{ .name }}{{ end }}
</td>