Files
LazyLibrarian/data/interfaces/default/index.html
2016-10-25 18:05:54 +02:00

103 lines
3.5 KiB
HTML

<%inherit file="base.html"/>
<%!
import lazylibrarian
%>
<%def name="headerIncludes()">
<div id="subhead_container">
<ul id="subhead_menu">
<li><a href="forceUpdate" id="button"> Refresh Active Authors </a></li>
<li><a href="libraryScan" id="button"> Library Scan </a></li>
</ul>
</div>
</%def>
<%def name="body()">
<BR><BR>
<h1>&nbsp&nbspAuthors</h1>
<table class="display" id="author_table">
<thead>
<tr>
<th id="authorname">Author</th>
<th id="bookname">Latest Book</th>
<th id="date">Released</th>
<th id="have">Downloaded</th>
<th id="status">Status</th>
</tr>
</thead>
<tbody>
%for author in authors:
<%
totalbooks = author['UnignoredBooks']
havebooks = author['HaveBooks']
if not havebooks:
havebooks = 0
try:
percent = (havebooks*100.0)/totalbooks
if percent > 100:
percent = 100
if percent <= 100:
css = "<div class=\"progress-container success\">"
if percent <= 75:
css = "<div class=\"progress-container info\">"
if percent <= 50:
css = "<div class=\"progress-container warning\">"
if percent <= 25:
css = "<div class=\"progress-container danger\">"
except (ZeroDivisionError, TypeError):
percent = 0
totalbooks = '0'
css = "<div class=\"progress-container danger\">"
if author['Status'] == 'Paused':
grade = 'X'
%>
<tr class="gradeZ">
<td id="name"><span title="${author['AuthorName']}"></span><a href="authorPage?AuthorID=${author['AuthorID']}">${author['AuthorName']}</a></td>
<td id="bookname"><span title="${author['LastBook']}"></span><a href="${author['LastLink']}">${author['LastBook']}</a></td>
<td id="date">${author['LastDate']}</td>
<td id="have"><span title="${percent}"></span>${css}
<div style="width:${percent}%"><span class="progressbar-front-text">${havebooks}/${totalbooks}</span></div></td>
<td id="status">${author['Status']}</td>
</tr>
%endfor
</tbody>
</table>
</%def>
<%def name="headIncludes()">
<link rel="stylesheet" href="css/data_table.css">
</%def>
<%def name="javascriptIncludes()">
<script src="js/libs/jquery.dataTables.min.js"></script>
<script>
$(document).ready(function()
{
$('#author_table').dataTable(
{
"aoColumns": [
null,
null,
null,
null,
null
],
"oLanguage": {
"sLengthMenu":"Show _MENU_ authors per page",
"sEmptyTable": "No authors found",
"sInfo":"Showing _START_ to _END_ of _TOTAL_ authors",
"sInfoEmpty":"Showing 0 to 0 of 0 authors",
"sInfoFiltered":"(filtered from _MAX_ total authors)"},
"aLengthMenu": [[5, 10, 15, 25, 50, 100, -1], [5, 10, 15, 25, 50, 100, "All"]],
"iDisplayLength": ${lazylibrarian.DISPLAYLENGTH},
"sPaginationType": "full_numbers",
"aaSorting": [[0, 'asc']],
});
$('.dataTables_filter input').attr("placeholder", "Search table here");
});
</script>
</%def>