Group library statistic cards by library type

This commit is contained in:
JonnyWong16 2017-12-11 21:28:26 -08:00
commit 359273e26e
4 changed files with 83 additions and 81 deletions

View file

@ -24,75 +24,55 @@ DOCUMENTATION :: END
</%doc>
% if data:
% for library in data:
<%
section_id = library['section_id']
types = ('movie', 'show', 'artist', 'photo')
headers = {'movie': ('Movie Libraries', ('Movies', '', '')),
'show': ('TV Show Libraries', ('Shows', 'Seasons', 'Episodes')),
'artist': ('Music Libraries', ('Artists', 'Albums', 'Tracks')),
'photo': ('Photo Libraries', ('Albums', '', 'Photos'))}
%>
<div class="dashboard-stats-instance" id="library-stats-instance-${section_id}" data-section_id="${section_id}">
% for section_type in types:
% if section_type in data:
<div class="dashboard-stats-instance" id="library-stats-instance-${section_type}" data-section_type="${section_type}">
<div class="dashboard-stats-container">
<div class="dashboard-stats-background-overlay">
<div id="library-stats-background-${section_id}" class="dashboard-stats-background" style="background-image: url(pms_image_proxy?img=${library['art']}&width=500&height=280&fallback=art);"></div>
<a href="library?section_id=${library['section_id']}" title="${library['section_name']}">
% if library['thumb'].startswith("http"):
<div id="library-stats-thumb-${section_id}" class="dashboard-stats-library hidden-xs" style="background-image: url(${library['thumb']});"></div>
% else:
<div id="library-stats-thumb-${section_id}" class="dashboard-stats-library hidden-xs" style="background-image: url(pms_image_proxy?img=${library['thumb']}&width=300&height=300&fallback=cover);"></div>
% endif
</a>
<div id="library-stats-background-${section_type}" class="dashboard-stats-background" style="background-image: url(pms_image_proxy?img=/:/resources/${section_type}-fanart.jpg&width=500&height=280&fallback=art);"></div>
<div id="library-stats-thumb-${section_type}" class="dashboard-stats-library hidden-xs" style="background-image: url(pms_image_proxy?img=/:/resources/${section_type}.png&width=300&height=300&fallback=cover);"></div>
<div class="dashboard-stats-info-container">
<div id="library-stats-title-${section_id}" class="dashboard-stats-info-title">
<h4>
<a href="library?section_id=${library['section_id']}" title="${library['section_name']}">${library['section_name']}</a>
</h4>
<span class="dashboard-stats-stats-units">items</span>
<div id="library-stats-title-${section_type}" class="dashboard-stats-info-title library">
<h4>${headers[section_type][0]}</h4>
<span class="dashboard-stats-stats-units library">${' / '.join(u for u in headers[section_type][1] if u)}</span>
</div>
<div class="dashboard-stats-info-scroller scrollbar-macosx">
<div class="dashboard-stats-info scoller-content">
<ul class="list-unstyled dashboard-stats-info-list">
<%
h1 = h2 = h3 = ''
if library['section_type'] == 'movie':
h1 = 'Movies'
if library['section_type'] == 'show':
h1, h2, h3 = 'Shows', 'Seasons', 'Episodes'
elif library['section_type'] == 'artist':
h1, h2, h3 = 'Artists', 'Albums', 'Tracks'
elif library['section_type'] == 'photo':
h1, h3 = 'Albums', 'Photos'
%>
% if h1:
<li class="dashboard-stats-info-item expanded">
<div class="sub-heading">&bull;</div>
% for section in data[section_type]:
<li class="dashboard-stats-info-item ${'expanded' if loop.index == 0 else ''}">
<div class="sub-list">${loop.index + 1}</div>
<div class="sub-value">
${h1}
<a href="library?section_id=${section['section_id']}" title="${section['section_name']}">
${section['section_name']}
</a>
</div>
% if headers[section_type][1][0]:
<div class="sub-count">
${library['count']}
</div>
</li>
% endif
% if h2:
<li class="dashboard-stats-info-item expanded">
<div class="sub-heading">&bull;</div>
<div class="sub-value">
${h2}
${section['count']}
</div>
% endif
% if headers[section_type][1][1]:
<div class="sub-divider"> / </div>
<div class="sub-count">
${library['parent_count']}
</div>
</li>
% endif
% if h3:
<li class="dashboard-stats-info-item expanded">
<div class="sub-heading">&bull;</div>
<div class="sub-value">
${h3}
${section['child_count']}
</div>
% endif
% if headers[section_type][1][2]:
<div class="sub-divider"> / </div>
<div class="sub-count">
${library['child_count']}
${section['grandchild_count']}
</div>
% endif
</li>
% endif
% endfor
</ul>
</div>
</div>
@ -100,6 +80,7 @@ DOCUMENTATION :: END
</div>
</div>
</div>
% endif
% endfor
% else:
<div class="text-muted">No stats to show.</div><br>