Add admin panel to delete URLs from the browser. Add copyright notice.
This commit is contained in:
parent
332d82e97a
commit
8288b3624e
11 changed files with 445 additions and 75 deletions
100
templates/admin.html
Normal file
100
templates/admin.html
Normal file
|
@ -0,0 +1,100 @@
|
|||
<!--
|
||||
Copyright (c) 2019 Steven Spangler <132@ikl.sh>, Kevin Alberts <kevin@kevinalberts.nl>
|
||||
This file is part of liteshort by 132ikl
|
||||
This software is license under the MIT license. It should be included in your copy of this software.
|
||||
A copy of the MIT license can be obtained at https://mit-license.org/
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>URL Admin - {{ config.site_name }}</title>
|
||||
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='ia.css') }}">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='admin.css') }}">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
</head>
|
||||
<body>
|
||||
<div id="top">
|
||||
<div id="header">
|
||||
<div id="logo" class="drop-shadow">
|
||||
<a href="{{ url_for('main') }}">
|
||||
<img src="{{ url_for('static', filename='ictsv-logo-white.svg') }}" alt="logo">
|
||||
</a>
|
||||
</div>
|
||||
<div id="title" class="drop-shadow">
|
||||
<a href="{{ url_for('main') }}">
|
||||
I.C.T.S.V. URL Shortener
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="middle">
|
||||
<div id="content_admin">
|
||||
<div class="clearfix"></div>
|
||||
<div id="box" class="align-self-center col-xl-4 col-lg-4 col-md-6 col-sm-10 col-xs-12">
|
||||
<h3 id="box-title">URL Admin <span class="small">(<a href="{{ url_for('logout') }}">Logout</a>)</span></h3>
|
||||
|
||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||
{% if messages %}
|
||||
{% for category, message in messages %}
|
||||
{% if category == 'success' %}
|
||||
<div class="success">
|
||||
✓ {{ message }}
|
||||
</div>
|
||||
{% elif category == 'error' %}
|
||||
<div class="error">
|
||||
✖ {{ message }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
<p>There are {{ num_items }} links in the database.</p>
|
||||
|
||||
<div class="paginator">
|
||||
{% for i in range(1, page_count + 1) %}
|
||||
{% if i == page %}
|
||||
<span class="paginator-current">{{ i }}</span>
|
||||
{% else %}
|
||||
<a class="paginator-link" href="?page={{ i }}">{{ i }}</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<table id="link-table">
|
||||
<tr class="link-table-header">
|
||||
<th>Short link</th>
|
||||
<th>Long link</th>
|
||||
<th>Delete?</th>
|
||||
</tr>
|
||||
{% for long, short in urls.items() %}
|
||||
<tr>
|
||||
<td>{{ short }}</td>
|
||||
<td>{{ long }}</td>
|
||||
<td class="link-table-center">
|
||||
<a href="{{ url_for('delete', short=short) }}?page={{ page }}">X</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="2">No links yet.</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
<div class="paginator">
|
||||
{% for i in range(1, page_count + 1) %}
|
||||
{% if i == page %}
|
||||
<span class="paginator-current">{{ i }}</span>
|
||||
{% else %}
|
||||
<a class="paginator-link" href="?page={{ i }}">{{ i }}</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Reference in a new issue