Add category-first template library and improve admin dashboard

This commit is contained in:
2026-11-21 23:44:26 +08:00
parent 2ef38bd716
commit 2cf63b61ba
18 changed files with 471 additions and 200 deletions
+25 -11
View File
@@ -2,6 +2,13 @@
use App\Content\View;
$e = View::escape(...);
$active = match (true) {
str_starts_with($adminPath, '/admin/article') => 'articles',
str_starts_with($adminPath, '/admin/media') => 'media',
str_starts_with($adminPath, '/admin/settings') => 'settings',
$adminPath === '/admin/password' => '',
default => 'pages',
};
?>
<!doctype html>
<html lang="zh-CN">
@@ -29,18 +36,25 @@ $e = View::escape(...);
<div class="admin-wrap admin-bar-inner">
<a class="wordmark" href="/admin" aria-label="来笙内容管理首页"><img src="/assets/wordmark.webp" alt="来笙 Laysense" width="130" height="33"></a>
<?php if ($user): ?>
<nav aria-label="后台导航">
<a href="/admin">页面</a>
<a href="/admin/articles">文章</a>
<a href="/admin/media">媒体库</a>
<a href="/admin/settings/header">网站设置</a>
<a href="/admin/password">修改密码</a>
<a href="/">访问网站</a>
<form method="post" action="/admin/logout">
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
<button class="button button-outline" type="submit">退出</button>
</form>
<nav class="admin-primary" aria-label="后台导航">
<a href="/admin"<?= $active === 'pages' ? ' aria-current="page"' : '' ?>>页面</a>
<a href="/admin/articles"<?= $active === 'articles' ? ' aria-current="page"' : '' ?>>文章</a>
<a href="/admin/media"<?= $active === 'media' ? ' aria-current="page"' : '' ?>>媒体库</a>
<a href="/admin/settings/header"<?= $active === 'settings' ? ' aria-current="page"' : '' ?>>网站设置</a>
</nav>
<div class="admin-utility">
<a href="/">访问网站</a>
<details class="admin-account">
<summary>账户</summary>
<div class="admin-account-menu">
<a href="/admin/password">修改密码</a>
<form method="post" action="/admin/logout">
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
<button type="submit">退出登录</button>
</form>
</div>
</details>
</div>
<?php else: ?>
<a class="back-link" href="/">返回网站</a>
<?php endif ?>