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