Fix chart templates

This commit is contained in:
2023-02-27 11:13:13 -05:00
parent 56e5728245
commit 6316d4bead
3 changed files with 37 additions and 7 deletions

View File

@ -1,9 +1,9 @@
{% extends "base_detail.html" %}
{% extends "base_list.html" %}
{% load mathfilters %}
{% block title %}{{object.name}}{% endblock %}
{% block details %}
{% block lists %}
<div class="row">
{% for album in artist.album_set.all %}

View File

@ -4,6 +4,34 @@
{% block lists %}
<div class="row">
{% if charts %}
<div class="tab-content" id="artistTabContent">
<div class="table-responsive">
<table class="table table-striped table-sm">
<thead>
<tr>
<th scope="col">Rank</th>
<th scope="col">Artist</th>
<th scope="col">Track</th>
<th scope="col">Scrobbles</th>
</tr>
</thead>
<tbody>
{% for chart in charts %}
<tr>
<td>{{chart.rank}}</td>
<td><a href="{{chart.media_obj.artist.get_absolute_url}}">{{chart.media_obj.artist}}</a></td>
<td><a href="{{chart.media_obj.get_absolute_url}}">{{chart.media_obj.title}}</a></td>
<td>{{chart.count}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endif %}
{% if artist_charts %}
<h2>Top Artists</h2>
<ul class="nav nav-tabs" id="artistTab" role="tablist">
@ -25,7 +53,6 @@
<table class="table table-striped table-sm">
<thead>
<tr>
<th scope="col">Rank</th>
<th scope="col">Artist</th>
<th scope="col">Scrobbles</th>
</tr>
@ -33,7 +60,6 @@
<tbody>
{% for artist in artists %}
<tr>
<td>{{artist.rank}}</td>
<td><a href="{{artist.get_absolute_url}}">{{artist}}</a></td>
<td>{{artist.num_scrobbles}}</td>
</tr>
@ -44,9 +70,11 @@
</div>
{% endfor %}
</div>
{% endif %}
</div>
<div class="row">
{% if track_charts %}
<h2>Top Tracks</h2>
<ul class="nav nav-tabs" id="artistTab" role="tablist">
@ -89,6 +117,7 @@
</div>
{% endfor %}
</div>
{% endif %}
</div>
{% endblock %}