Files
LazyLibrarian/data/interfaces/default/index.html
2017-05-01 15:10:19 +02:00

113 lines
4.2 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&nbsp${title}</h1>
<table class="display" id="author_table">
<thead>
<tr>
<th id="status">Image</th>
<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="status"><a href="${author['AuthorImg']}" target="_blank" rel="noreferrer"><img src="${author['AuthorImg']}" width="60" alt="Cover" class="bookcover-sm"></a></td>
<td id=authorname><a href="authorPage?AuthorID=${author['AuthorID']|u}">${author['AuthorName']}</a></td>
<td id="bookname"><span title="${author['LastBook']}"></span><a href="${author['LastLink']}" target="_blank" rel="noreferrer">${author['LastBook']}</a></td>
<td id="date">${author['LastDate']}</td>
<td id="have"><span title="${percent}"></span><span class="hidden">${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>
<p>&nbsp;</p>
<p>&nbsp;</p>
</%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 src="js/libs/natural.js"></script>
<script>
$(document).ready(function()
{
$('#author_table').dataTable(
{
"bAutoWidth": false,
"aoColumns": [
{"bSortable": false},
null,
null,
null,
{ "sType": "natural" },
null
],
"order": [[ 1, 'asc']],
"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.CONFIG['DISPLAYLENGTH']},
"sPaginationType": "full_numbers",
"aaSorting": [[1, 'asc']],
});
$('.dataTables_filter input').attr("placeholder", "Search table here");
});
</script>
</%def>