UI: move logout to top-right, hide header Admin link; add global 'Made by Ruslan' watermark with handwriting font; inject <title> from page name; move page overlay Admin button to top-right

This commit is contained in:
2025-09-03 15:25:52 +03:00
parent aa5cb82295
commit c87f4fb0d6
2 changed files with 32 additions and 3 deletions

18
app.py
View File

@@ -168,10 +168,26 @@ def create_app():
abort(404) abort(404)
# Show a floating admin button for authenticated users, otherwise serve raw HTML # Show a floating admin button for authenticated users, otherwise serve raw HTML
html: str = row["html"] html: str = row["html"]
# Inject <title> tag for better page naming
try:
page_title = row["title"]
except Exception:
page_title = ""
if page_title:
lower = html.lower()
if "</head>" in lower:
i = lower.rfind("</head>")
html = html[:i] + f"<title>{page_title}</title>" + html[i:]
elif "<html" in lower:
if "<body" in lower:
j = lower.find("<body")
html = html[:j] + f"<head><meta charset=\"utf-8\"><title>{page_title}</title></head>" + html[j:]
else:
html = f"<head><meta charset=\"utf-8\"><title>{page_title}</title></head>" + html
if is_logged_in(): if is_logged_in():
admin_url = url_for("admin") admin_url = url_for("admin")
toolbar = ( toolbar = (
'<div style="position:fixed;top:16px;left:16px;z-index:2147483647;">' '<div style="position:fixed;top:16px;right:16px;z-index:2147483647;">'
f'<a href="{admin_url}" ' f'<a href="{admin_url}" '
'style="background:linear-gradient(135deg,#111,#333);color:#fff;padding:10px 14px;' 'style="background:linear-gradient(135deg,#111,#333);color:#fff;padding:10px 14px;'
'border-radius:10px;box-shadow:0 8px 20px rgba(0,0,0,0.25);' 'border-radius:10px;box-shadow:0 8px 20px rgba(0,0,0,0.25);'

View File

@@ -3,6 +3,9 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Pacifico&display=swap" rel="stylesheet">
<title>{{ title or 'Админка' }}</title> <title>{{ title or 'Админка' }}</title>
<style> <style>
:root { :root {
@@ -34,7 +37,7 @@
header { header {
position: sticky; top: 0; z-index: 1000; position: sticky; top: 0; z-index: 1000;
display: flex; align-items: center; justify-content: space-between; display: flex; align-items: center; justify-content: space-between;
padding: 14px 18px 14px 140px; margin: 0 0 18px 0; padding: 14px 18px; margin: 0 0 18px 0;
background: linear-gradient(180deg, rgba(18,24,37,.85), rgba(18,24,37,.65)); background: linear-gradient(180deg, rgba(18,24,37,.85), rgba(18,24,37,.65));
backdrop-filter: saturate(1.2) blur(8px); backdrop-filter: saturate(1.2) blur(8px);
border: 1px solid rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.06);
@@ -42,7 +45,7 @@
box-shadow: 0 10px 30px rgba(0,0,0,.35); box-shadow: 0 10px 30px rgba(0,0,0,.35);
} }
header nav { position: absolute; top: 14px; left: 18px; } header nav { position: absolute; top: 14px; right: 18px; }
.card { .card {
background: var(--card); background: var(--card);
@@ -83,6 +86,15 @@
tbody tr:hover { background: rgba(255,255,255,.02); } tbody tr:hover { background: rgba(255,255,255,.02); }
nav a { margin-left: 10px; } nav a { margin-left: 10px; }
/* Hide global Admin button in header; use page overlay instead */
header nav a[href*="/admin"] { display: none !important; }
/* Replace garbled logout text with a visible label */
header nav form button.btn { position: relative; }
header nav form button.btn::after { content: 'Выйти'; }
.watermark { position: fixed; bottom: 14px; right: 16px; z-index: 1000;
font-family: 'Pacifico', cursive; font-size: 20px; color: rgba(255,255,255,.85);
text-shadow: 0 2px 8px rgba(0,0,0,.35); user-select: none; pointer-events: none; }
</style> </style>
</head> </head>
<body> <body>
@@ -111,5 +123,6 @@
{% block content %}{% endblock %} {% block content %}{% endblock %}
</div> </div>
</div> </div>
<div class="watermark">Made by Ruslan</div>
</body> </body>
</html> </html>