fix tag filtering
This commit is contained in:
@@ -2,3 +2,4 @@
|
||||
__pycache__
|
||||
*.pyc
|
||||
*.svg
|
||||
todo.txt
|
||||
@@ -20,6 +20,9 @@
|
||||
#if($sorting_key)
|
||||
<input type="hidden" name="sort" value="$sorting_key">
|
||||
#end
|
||||
#if($filter_key)
|
||||
<input type="hidden" name="filter" value="$filter_key">
|
||||
#end
|
||||
</form>
|
||||
<form id="$escape_html($card.filename)_dec" action="" method="post">
|
||||
<input type="hidden" name="filename" value="$escape_html($card.filename)">
|
||||
@@ -27,6 +30,9 @@
|
||||
#if($sorting_key)
|
||||
<input type="hidden" name="sort" value="$sorting_key">
|
||||
#end
|
||||
#if($filter_key)
|
||||
<input type="hidden" name="filter" value="$filter_key">
|
||||
#end
|
||||
</form>
|
||||
#end
|
||||
|
||||
@@ -34,12 +40,12 @@
|
||||
<table>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th><a href="../cards/?sort=title">Title</a></th>
|
||||
<th><a href="../cards/?sort=filename" >Filename</a></th>
|
||||
<th style="text-align: center;"><a href="../cards/?sort=cp">CP</a></th>
|
||||
<th><a href="../cards/?sort=copies">Copies owned</a></th>
|
||||
<th><a href="../cards/?sort=description">Description</a></th>
|
||||
<th><a href="../cards/?sort=tag">Tag</a></th>
|
||||
<th><a href="../cards/?sort=title&filter=$escape_html($filter_key).lower()">Title</a></th>
|
||||
<th><a href="../cards/?sort=filename&filter=$escape_html($filter_key).lower()" >Filename</a></th>
|
||||
<th style="text-align: center;"><a href="../cards/?sort=cp&apm;filter=$escape_html($filter_key).lower()">CP</a></th>
|
||||
<th><a href="../cards/?sort=copies&filter=$escape_html($filter_key).lower()">Copies owned</a></th>
|
||||
<th><a href="../cards/?sort=description&filter=$escape_html($filter_key).lower()">Description</a></th>
|
||||
<th><a href="../cards/?sort=tag&filter=$escape_html($filter_key).lower()">Tag</a></th>
|
||||
</tr>
|
||||
|
||||
#foreach($card in $cards)
|
||||
@@ -72,9 +78,12 @@
|
||||
<td></td>
|
||||
<td>Total:</td>
|
||||
<td>N/A</td>
|
||||
<td>$escape_html($sum_cp)</td>
|
||||
<td>$escape_html($sum_copies)</td>
|
||||
<td style="text-align: right;">$escape_html($sum_cp) CP</td>
|
||||
<td style="text-align: center;">$escape_html($sum_copies)</td>
|
||||
<td>N/A</td>
|
||||
#if($filter_key)
|
||||
<td><a href="../cards/?sort=${sorting_key}&filter=">(remove filter)</a></td>
|
||||
#end
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
@@ -24,7 +24,7 @@ async def show_cardlist(request, template={}):
|
||||
c.copies_owned = int(c.copies_owned) - 1
|
||||
cards = card.from_dir(config.carddir)
|
||||
|
||||
sorting_key = None
|
||||
sorting_key = ""
|
||||
if "sort" in request.args:
|
||||
sorting_key = request.args["sort"][0]
|
||||
if "sort" in request.form:
|
||||
@@ -43,8 +43,8 @@ async def show_cardlist(request, template={}):
|
||||
cards = sorted(cards, key=lambda x: x.title.lower())
|
||||
elif sorting_key == "tag":
|
||||
cards = sorted(cards, key=lambda x: x.tag or "\0")
|
||||
|
||||
filter_key = None
|
||||
|
||||
filter_key = ""
|
||||
if "filter" in request.args:
|
||||
filter_key = request.args["filter"][0]
|
||||
if "filter" in request.form:
|
||||
|
||||
Reference in New Issue
Block a user