Cleanup svg list template, hide uneccesary pagination
This commit is contained in:
@@ -3,3 +3,4 @@ resourcedir = "resources/"
|
||||
carddir = "cards/"
|
||||
svgdir = "svgs/"
|
||||
prettifyHTML = False#requires html5print module, only applies to html processed by airspeed
|
||||
svg_page_size = 150
|
||||
|
||||
+44
-29
@@ -2,7 +2,7 @@
|
||||
<title>SVG list</title>
|
||||
<link rel="stylesheet" href="svg.css">
|
||||
|
||||
#macro(form)
|
||||
#macro(upload_svgs_form)
|
||||
<form action="svg" method="post" enctype="multipart/form-data">
|
||||
<h3>Upload SVG:</h3>
|
||||
<p>
|
||||
@@ -16,41 +16,49 @@
|
||||
</p>
|
||||
</form>
|
||||
#end
|
||||
#macro(filter_and_collection_forms)
|
||||
<form method="get" action="svg">
|
||||
<h3>Filter svgs:</h3>
|
||||
<input type="text" name="filter" value="$escape_html($filter)">
|
||||
#if($current_collection)
|
||||
<input type="hidden" name="collection" value="$escape_html($current_collection)">
|
||||
#end
|
||||
<input type="submit">
|
||||
</form>
|
||||
<center>
|
||||
<h4>Collections:</h4>
|
||||
<a href="svg">No collection</a>
|
||||
#foreach($collection in $collections)
|
||||
- <a href="svg?collection=$escape_html($collection)">$escape_html($collection)</a>
|
||||
#end
|
||||
</center>
|
||||
#end
|
||||
#macro(pagination)
|
||||
<center>
|
||||
#set($self = "svg?")
|
||||
#if($current_collection)
|
||||
#set($self = "${self}collection=$escape_html($current_collection)&")
|
||||
#end
|
||||
#if($filter)
|
||||
#set($self = "${self}filter=$escape_html($filter)&")
|
||||
#end
|
||||
#if($page>1)<a href="${self}page=$page.__sub__(1)">Previous page</a> - #end
|
||||
<a href="${self}page=$page.__add__(1)">Next page</a>
|
||||
</center>
|
||||
#if($has_next || $page>1)
|
||||
<center>
|
||||
#set($self = "svg?")
|
||||
#if($current_collection)
|
||||
#set($self = "${self}collection=$escape_html($current_collection)&")
|
||||
#end
|
||||
#if($filter)
|
||||
#set($self = "${self}filter=$escape_html($filter)&")
|
||||
#end
|
||||
#if($page>1)<a href="${self}page=$page.__sub__(1)">Previous page</a> - #end
|
||||
<b>Page $page</b>
|
||||
#if($has_next)
|
||||
- <a href="${self}page=$page.__add__(1)">Next page</a>
|
||||
#end
|
||||
</center>
|
||||
#end
|
||||
#end
|
||||
|
||||
<a href="../" style="opacity:0.6;">Return to cardlist</a>
|
||||
<div class="splitcontainer">
|
||||
<div class="splitl">
|
||||
#form()
|
||||
#upload_svgs_form()
|
||||
</div>
|
||||
<div class="splitr">
|
||||
<form method="get" action="svg">
|
||||
<h3>filter</h3>
|
||||
<input type="text" name="filter" value="$escape_html($filter)">
|
||||
#if($current_collection)
|
||||
<input type="hidden" name="collection" value="$escape_html($current_collection)">
|
||||
#end
|
||||
<input type="submit">
|
||||
</form>
|
||||
<center>
|
||||
<h4>Collections:</h4>
|
||||
<a href="svg">No collection</a>
|
||||
#foreach($collection in $collections)
|
||||
- <a href="svg?collection=$escape_html($collection)">$escape_html($collection)</a>
|
||||
#end
|
||||
</center>
|
||||
#filter_and_collection_forms()
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -69,6 +77,13 @@
|
||||
|
||||
#pagination()
|
||||
|
||||
#form()
|
||||
<div class="splitcontainer">
|
||||
<div class="splitl">
|
||||
#upload_svgs_form()
|
||||
</div>
|
||||
<div class="splitr">
|
||||
#filter_and_collection_forms()
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a href="../" style="opacity:0.6;">Return to cardlist</a>
|
||||
|
||||
@@ -134,8 +134,11 @@ async def svg_list(request, template={}):
|
||||
if filter:
|
||||
svgs = [i for i in svgs if filter in i]
|
||||
|
||||
if len(svgs) > page*config.svg_page_size:
|
||||
has_next = True
|
||||
|
||||
svgs.sort()
|
||||
svgs = svgs[(page-1)*100:page*100]
|
||||
svgs = svgs[(page-1)*config.svg_page_size:page*config.svg_page_size]
|
||||
|
||||
return response.html(template["svg.vm"].merge(locals()))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user