Added Logout

This commit is contained in:
Michael Rodin 2023-10-20 15:27:25 +02:00
parent 3c79c3c688
commit 76d43d57d9
8 changed files with 106 additions and 38 deletions

View file

@ -13,17 +13,16 @@
<a href="/"><img src="/static/favicon.ico" alt="favicon"></a>
<span id="title">{{title}}</span>
<div id="container">
<!-- BUTTONS IF USER LOGGED IN -->
{% if login %}
<a href="/add"><button class="big-button"><b>&#x2B</b></button></a>
{% endif %}
<!------------------------------->
<form action="/search" method="get">
<input type="text" name="q" placeholder="search">
<input type="submit" value="&#x1F50E;" class="big-button" id="search-button">
</form>
{% if login %}
<a href="/user/{{userdata[0]}}"><button class="big-button">{{userdata[2]}}</button></a>
<a href="/logout"><button class="big-button">Logout</button></a>
{% else %}
<a href="/login"><button class="big-button">Login</button></a>
{% endif %}

View file

@ -2,27 +2,41 @@
{% block meta %}
<link rel="stylesheet" href="/static/search.css" />
<link rel="stylesheet" href="/static/labels.css" />
<link rel="stylesheet" href="/static/home.css" />
{% endblock %}
{% block content %}
<form action="/search" method="get">
<div class="grid-selection">
<b>Sort by:</b>
<select name="sort">
<option value="time" {% if "time" == request.args.get('sort') %}selected="selected"{% endif %}>Import Time</option>
<option value="az" {% if "az" == request.args.get('sort') %}selected="selected"{% endif %}>A-Z</option>
<option value="za" {% if "za" == request.args.get('sort') %}selected="selected"{% endif %}>Z-A</option>
<option value="size" {% if "size" == request.args.get('sort') %}selected="selected"{% endif %}>Archive Size</option>
</select>
</div>
<div class="grid-selection">
<b>Category:</b>
<select name="category">
{% for i in categories %}
<option value="{{i[0]}}" {% if i[0] == request.args.get('category')|int %}selected="selected"{% endif %}>{{i[1]}}</option>
<div class="select-container">
<b>Sort by:</b>
<select name="sort">
<option value="time" {% if "time" == request.args.get('sort') %}selected="selected"{% endif %}>Import Time</option>
<option value="az" {% if "az" == request.args.get('sort') %}selected="selected"{% endif %}>A-Z</option>
<option value="za" {% if "za" == request.args.get('sort') %}selected="selected"{% endif %}>Z-A</option>
<option value="size" {% if "size" == request.args.get('sort') %}selected="selected"{% endif %}>Archive Size</option>
</select>
<b>Category:</b>
<select name="category">
<option value="0">None</option>
{% for i in categories %}
<option value="{{i[0]}}" {% if i[0] == request.args.get('category')|int %}selected="selected"{% endif %}>{{i[1]}}</option>
{% endfor %}
</select>
<b>Count: </b><input type="number" name="count" step="1" placeholder="Number of items" {% if request.args.get('count') %}value="{{request.args.get('count')}}"{% else %} value="20"{% endif %}>
</div>
{# <!-- Can't get that to work
<div class="labels-container">
{% for ltype in res_labels %}
<div class="flex-item"><b>{{ltype}}</b>
{% for for_temp in res_labels[ltype] %}
<input type="checkbox" id="{{for_temp[0]}}" name="{{for_temp[0]}}" {% if for_temp[0]|string in labels %}checked{% endif %}><label for="{{for_temp[0]}}">{{for_temp[1]}}</label>
{% endfor %}
</div>
{% endfor %}
</select>
</div>-->
#}
</div>
{% if request.args.get('q') %}
<input type="text" name="q" value="{{request.args.get('q')}}" placeholder="Keywords">
@ -30,7 +44,6 @@
<input type="text" name="q" placeholder="Keywords">
{% endif %}
<input type="submit" value="Search!">
<div class="grid-selection"></div>
</form>
{% if archives|length > 0 %}
<div class="grid-container">

View file

@ -16,7 +16,7 @@
<b>Labels: {% if login and userdata[0] == archive[8] %}<a href="/labels/{{archive[0]}}">Edit</a>{% endif %}</b>
<div>
{% for lab in labels %}
<div class="label">{{lab[0]}}</div>
<div class="label">{{lab[1]}}</div>
{% endfor %}
</div>
</div>