2021-08-29 13:03:28 +00:00
{% extends "base.html" %}
{% from 'utils.html' import custom_render_form_row,make_tabs %}
{% from 'bootstrap/utils.html' import render_icon %}
{% from 'bootstrap/form.html' import render_form, render_field, render_form_row %}
2021-12-13 18:11:43 +00:00
{% macro make_row(title,items) %}
< div class = "d-flex flex-wrap" >
{% for item in items %}
{{item|safe}}
{% endfor %}
< / div >
{% endmacro %}
2021-08-29 13:03:28 +00:00
2021-12-13 18:11:43 +00:00
{% macro make_tabs(tabs) %}
< div class = "row" >
< div class = "col" >
< ul class = "nav nav-pills mb-3" id = "pills-tab" role = "tablist" >
{% for (label,_) in tabs %}
{% set slug = (label|slugify) %}
{% if not (loop.first and loop.last) %}
< li class = "nav-item" >
< a class = "nav-link {{'active' if loop.first}}" id = "nav-{{slug}}-tab" data-toggle = "pill" href = "#pills-{{slug}}" role = "tab" aria-controls = "pills-{{slug}}" aria-selected = "{{loop.first}}" >
{{label}}
2021-08-29 13:03:28 +00:00
< / a >
2021-12-13 18:11:43 +00:00
< / li >
{% endif %}
{% endfor %}
< / ul >
< / div >
< / div >
< div class = "tab-content" id = "searchResults" >
{% for (label,items) in tabs %}
{% set slug = (label|slugify) %}
< div class = "tab-pane fade {{'show active' if loop.first}}" id = "pills-{{slug}}" role = "tabpanel" aria-labelledby = "nav-{{slug}}-tab" >
{{make_row(label,items)}}
< / div >
{% endfor %}
2021-08-29 13:03:28 +00:00
< / div >
2021-12-13 18:11:43 +00:00
{% endmacro %}
2021-08-29 13:03:28 +00:00
2021-12-13 18:11:43 +00:00
{% macro make_table(items) %}
< table class = "table table-sm table-bordered" >
{% for item in items|sort(attribute="Name")%}
2021-08-29 13:03:28 +00:00
< tr >
2021-12-13 18:11:43 +00:00
< td > < a href = "{{url_for('jellyfin.details',item_id=item.Id)}}" > {{item.Name}}< / a > ({{item.ProductionYear}})< / td >
2021-08-29 13:03:28 +00:00
< / tr >
2021-12-13 18:11:43 +00:00
{% endfor %}
< / table >
{% endmacro %}
{% block app_content %}
< h1 > < a href = {{info.LocalAddress}} > Jellyfin< / a > v{{info.Version}}< / h1 >
{% if status.HasUpdateAvailable %}
< h3 > Update available< / h3 >
{% endif %}
{% if status.HasPendingRestart %}
< h3 > Restart pending< / h3 >
{% endif %}
< h3 > Library statistics< / h3 >
< table class = "table table-sm table-bordered" >
{% for name, value in counts.items() %}
{% if value != 0 %}
< tr >
< td > {{name}}< / td >
< td > {{value}}< / td >
< / tr >
{% endif %}
2021-08-29 13:03:28 +00:00
{% endfor %}
2021-12-13 18:11:43 +00:00
< / table >
{% if library %}
< h3 > {{library|count}} Items< / h3 >
{% endif %}
2021-08-29 13:03:28 +00:00
2021-12-13 18:11:43 +00:00
{% set tabs = [] %}
{% for title,group in library.values()|groupby("Type") %}
{% do tabs.append((title,[make_table(group)])) %}
{% endfor %}
{{make_tabs(tabs)}}
{% endblock %}