diff options
author | B. Stack <bgstack15@gmail.com> | 2022-02-12 12:07:05 -0500 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2022-02-12 12:09:13 -0500 |
commit | bd134ed333278f33c9b5596ef5df2501ee648bb1 (patch) | |
tree | 6c4dbcec2cd71f15c43c20b3ca505941041af928 /templates | |
parent | use app.config for salt (diff) | |
download | stackbin-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')
-rw-r--r-- | templates/admin.html | 21 | ||||
-rw-r--r-- | templates/layout.html | 2 |
2 files changed, 22 insertions, 1 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 %}✓{% 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 %} diff --git a/templates/layout.html b/templates/layout.html index bfe8b05..fc2d8e5 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -1,5 +1,5 @@ <!doctype html> -<title>{% block title %}{% endblock %} | Flask Pastebin</title> +<title>{% block title %}{% endblock %}{% if appname %} | {{ appname }}{% endif %}</title> <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" /> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="black"> |