Files
2026-11-14 17:05:01 +00:00

104 lines
6.6 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
{# Routes that don't pass active_page (posts, comments, …) get their label
from the endpoint, so every admin tab is named correctly. #}
{% set page_label = (active_page or (request.endpoint or 'dashboard').rsplit('.', 1)[-1])|replace('_', ' ')|replace('-', ' ')|title %}
<title>{{ page_label }} &middot; {{ site_title }}</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/admin.css') }}">
<!-- TinyMCE oxide skin (UI + content styles), served locally. -->
<link rel="stylesheet" href="{{ url_for('static', filename='js/skins/ui/oxide/skin.min.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='js/skins/ui/oxide/content.min.css') }}">
<!-- TinyMCE WYSIWYG editor (replaces the Quill/TipTap build). Loaded locally in <head>;
it only initializes on pages containing a #body-editor element. Community edition,
no license key → no tin.cloud validation; theme/skin assets are served from /static/js/. -->
<!-- Absolute base is REQUIRED: this app is a subpath (/admin/*) and TinyMCE resolves its
theme/skin assets against the document root, so a relative path would 404. An absolute
base_url makes every asset resolve correctly regardless of subpath. Update host/port
here if you ever redeploy elsewhere. -->
{# Relative asset base (NOT absolute). Resolves against the PAGE origin, so tinymce assets
follow whatever protocol/host loads the page — works behind reverse proxies (https://domain,
http://IP, LAN host) without needing X-Forwarded-Proto or per-host edits. An absolute base
would be forced to http(s) as Flask sees it internally and break Mixed Content on HTTPS. #}
{# js_base has NO trailing slash; callers add the needed '/' themselves so paths stay clean #}
{% set js_base = "/static/js" %}
<script>
window.tinyMCEPreInit = { base: '{{ js_base }}', suffix: '.min' };
</script>
<script src="{{ url_for('static', filename='js/tinymce.min.js') }}"></script>
{% block head_extra %}{% endblock %}
</head>
<body>
<header class="admin-header">
<div class="header-inner">
<div class="site-logo"><a href="{{ url_for('admin.dashboard') }}">{{ site_title }}</a></div>
<nav class="main-nav" aria-label="Admin navigation">
<button type="button" aria-expanded="false" id="menuButton">Menu</button>
<ul class="nav-menu" id="navMenu" role="menu">
<li role="none"><a href="{{ url_for('admin.dashboard') }}" role="menuitem">Dashboard</a></li>
<li role="none"><a href="{{ url_for('admin.posts') }}" role="menuitem">Posts</a></li>
<li role="none"><a href="{{ url_for('admin.categories') }}" role="menuitem">Categories</a></li>
<li role="none"><a href="{{ url_for('admin.albums') }}" role="menuitem">Albums</a></li>
<li role="none"><a href="{{ url_for('admin.media_list') }}" role="menuitem">Media</a></li>
<li role="none"><a href="{{ url_for('admin.comments') }}" role="menuitem">Comments{% if pending_comments %}<span class="nav-badge" title="{{ pending_comments }} awaiting moderation">{{ pending_comments }}</span>{% endif %}</a></li>
<li role="none"><a href="{{ url_for('admin.analytics') }}" role="menuitem">Analytics</a></li>
<li role="none"><a href="{{ url_for('admin.visitors') }}" role="menuitem">Visitors</a></li>
<li role="none"><a href="{{ url_for('admin.import_export') }}" role="menuitem">Import/Export</a></li>
<li role="none"><a href="{{ url_for('admin.admin_password') }}" role="menuitem">Password</a></li>
<li role="none"><a href="{{ url_for('public.index') }}" role="menuitem">View site</a></li>
<li role="none">
<form method="post" action="{{ url_for('admin.admin_logout') }}" class="logout-form">
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
<button type="submit" role="menuitem" class="link-button">Log out</button>
</form>
</li>
</ul>
</nav>
</div>
</header>
<div class="admin-subnav">
<a href="{{ url_for('admin.dashboard') }}" class="{% if active_page == 'dashboard' %}active{% endif %}">Dashboard</a>
<a href="{{ url_for('admin.posts') }}" class="{% if active_page == 'posts' %}active{% endif %}">Posts</a>
<a href="{{ url_for('admin.categories') }}" class="{% if active_page == 'categories' %}active{% endif %}">Categories</a>
<a href="{{ url_for('admin.albums') }}" class="{% if active_page == 'albums' %}active{% endif %}">Albums</a>
<a href="{{ url_for('admin.media_list') }}" class="{% if active_page == 'media' %}active{% endif %}">Media</a>
<a href="{{ url_for('admin.comments') }}" class="{% if active_page == 'comments' %}active{% endif %}">Comments{% if pending_comments %}<span class="nav-badge">{{ pending_comments }}</span>{% endif %}</a>
<a href="{{ url_for('admin.pages') }}" class="{% if active_page == 'pages' %}active{% endif %}">Pages</a>
<a href="{{ url_for('admin.links') }}" class="{% if active_page == 'links' %}active{% endif %}">Links</a>
<a href="{{ url_for('admin.appearance') }}" class="{% if active_page == 'appearance' %}active{% endif %}">Appearance</a>
<a href="{{ url_for('admin.analytics') }}" class="{% if active_page == 'analytics' %}active{% endif %}">Analytics</a>
<a href="{{ url_for('admin.visitors') }}" class="{% if active_page == 'visitors' %}active{% endif %}">Visitors</a>
<a href="{{ url_for('admin.import_export') }}" class="{% if active_page == 'import-export' %}active{% endif %}">Import/Export</a>
<a href="{{ url_for('admin.admin_password') }}" class="{% if active_page == 'password' %}active{% endif %}">Password</a>
</div>
<div class="admin-wrap">
{% with messages = get_flashed_messages(with_categories=true) %}
{% for category, message in messages %}
<div class="notice notice-{{ category }}">{{ message }}</div>
{% endfor %}
{% endwith %}
{% block admin_content %}{% endblock %}
</div>
<script>
(function () {
var btn = document.getElementById("menuButton");
var menu = document.getElementById("navMenu");
if (btn && menu) {
btn.addEventListener("click", function () {
var open = menu.classList.toggle("open");
btn.setAttribute("aria-expanded", String(open));
});
}
})();
</script>
<!-- (Quill + turndown removed; TinyMCE is loaded in <head> and initializes
only on pages containing a #body-editor element.) -->
</body>
</html>