aboutsummaryrefslogtreecommitdiff
path: root/templates/admin.html
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2022-02-12 12:07:05 -0500
committerB. Stack <bgstack15@gmail.com>2022-02-12 12:09:13 -0500
commitbd134ed333278f33c9b5596ef5df2501ee648bb1 (patch)
tree6c4dbcec2cd71f15c43c20b3ca505941041af928 /templates/admin.html
parentuse app.config for salt (diff)
downloadstackbin-bd134ed333278f33c9b5596ef5df2501ee648bb1.tar.gz
stackbin-bd134ed333278f33c9b5596ef5df2501ee648bb1.tar.bz2
stackbin-bd134ed333278f33c9b5596ef5df2501ee648bb1.zip
add admin page, delete function, and APPNAME var
The admin can view the links to private pastes, and can delete pastes from the web console. For now, the admin page is not protected, so this is not production-ready.
Diffstat (limited to 'templates/admin.html')
-rw-r--r--templates/admin.html21
1 files changed, 21 insertions, 0 deletions
diff --git a/templates/admin.html b/templates/admin.html
new file mode 100644
index 0000000..a815fb5
--- /dev/null
+++ b/templates/admin.html
@@ -0,0 +1,21 @@
+{% extends "layout.html" %}
+{% block title %}Administration{% endblock %}
+{% block body %}
+<h1>Administration for {{ appname }}</h1>
+{% if pastes %}
+<table>
+<tr><th>id</th><th>private</th><th>title</th><th>user</th><th>parent</th><th>children</th><th>Actions</th></tr>
+{% for p in pastes %}
+<tr>
+<td>{{ p.id }}</td>
+<td>{% if p.private %}&#10003;{% endif %}</td>{# magic string is from utf8icons.com #}
+<td><a href="{% if not p.private %}{{ url_for('show_paste', paste_id=p.id) }}{% else %}{{ url_for('show_paste', paste_id=p.id, s=p.private) }}{% endif %}">{{ p.title }}</a></td>
+<td>{% if p.user %}{{ p.user }}{% endif%}</td>
+<td>{% if p.parent[0] %}<a href="{{ url_for('show_paste', paste_id=p.parent[0]) }}">{{ p.parent[1] }}</a>{% endif %}</td>
+<td>{% if p.children %}{% for c in p.children %}{% if not loop.first %},{% endif %}
+<a href="{{ url_for('show_paste', paste_id=c[0]) }}">{{ c[1] }}</a>{% endfor %}{% endif %}
+</td>
+<td><form method="post" action="{{ url_for('delete_paste', paste_id=p.id) }}"><input type="submit" value="delete"/> <input type="hidden" id="s" name="s" value="{{ p.delete }}"/></form></a></td>
+{% endfor %}
+{% endif %}
+{% endblock %}
bgstack15