Files
vps_web/templates/forum/post_detail.html
ddrwode 4210e0d70a 哈哈
2026-02-10 17:54:22 +08:00

236 lines
16 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="{{ 'zh-CN' if lang == 'zh' else 'en' }}">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ seo.title if seo else (post.title ~ ' - ' ~ l('论坛', 'Forum')) }}</title>
<link rel="icon" type="image/svg+xml" href="{{ url_for('static', filename='img/site-logo-mark.svg') }}">
{% if seo %}
<meta name="description" content="{{ seo.description }}">
<meta name="keywords" content="{{ seo.keywords }}">
<meta name="robots" content="{{ seo.robots }}">
<meta name="theme-color" content="#0F172A">
<link rel="canonical" href="{{ seo.canonical_url }}">
{% for hreflang, href in seo.alternate_links.items() %}
<link rel="alternate" hreflang="{{ hreflang }}" href="{{ href }}">
{% endfor %}
{% if seo.feed_url %}
<link rel="alternate" type="application/rss+xml" title="{{ l('论坛 RSS 订阅', 'Forum RSS Feed') }}" href="{{ seo.feed_url }}">
{% endif %}
<meta property="og:type" content="{{ seo.og_type }}">
<meta property="og:url" content="{{ seo.og_url }}">
<meta property="og:title" content="{{ seo.og_title }}">
<meta property="og:description" content="{{ seo.og_description }}">
<meta property="og:image" content="{{ seo.og_image }}">
<meta property="article:published_time" content="{{ seo.article_published_time }}">
<meta property="article:modified_time" content="{{ seo.article_modified_time }}">
<meta property="article:section" content="{{ seo.article_section }}">
<meta name="twitter:card" content="{{ seo.twitter_card }}">
<meta name="twitter:title" content="{{ seo.twitter_title }}">
<meta name="twitter:description" content="{{ seo.twitter_description }}">
<meta name="twitter:image" content="{{ seo.og_image }}">
{% if seo_schema %}
<script type="application/ld+json">{{ seo_schema | tojson }}</script>
{% endif %}
{% endif %}
<link rel="stylesheet" href="/static/css/style.css">
<link rel="stylesheet" href="/static/css/forum.css">
</head>
<body class="forum-page">
{% set sb = sidebar if sidebar is defined else {'total_users': 0, 'total_posts': 0, 'total_comments': 0, 'category_counts': []} %}
<header class="forum-header">
<div class="forum-header-inner">
<div class="forum-header-left">
<a href="{{ url_for('forum_index') }}" class="forum-logo">
<img src="{{ url_for('static', filename='img/site-logo-mark.svg') }}" alt="{{ l('云价眼 Logo', 'VPS Price Logo') }}">
<span>{{ l('云价眼论坛', 'VPS Price Forum') }}</span>
</a>
<nav class="forum-primary-nav">
<a href="{{ url_for('forum_index') }}" class="active">{{ l('最新', 'Latest') }}</a>
<a href="{{ url_for('index') }}">{{ l('价格表', 'Pricing') }}</a>
{% if current_user and not current_user.is_banned %}
<a href="{{ url_for('forum_post_new') }}">{{ l('发布主题', 'New Topic') }}</a>
{% endif %}
</nav>
</div>
<div class="forum-header-right">
<span class="lang-switch">
<a href="{{ lang_url('zh') }}" class="{{ 'active' if lang == 'zh' else '' }}" title="切换到中文">中文</a>
<span class="lang-sep">|</span>
<a href="{{ lang_url('en') }}" class="{{ 'active' if lang == 'en' else '' }}" title="Switch to English">English</a>
</span>
{% if current_user %}
<span class="forum-user-chip">{{ current_user.username }}{% if current_user.is_banned %}{{ l('(封禁)', ' (Banned)') }}{% endif %}</span>
<a href="{{ url_for('user_profile') }}" class="forum-link">{{ l('个人中心', 'Profile') }}</a>
<a href="{{ url_for('user_notifications') }}" class="forum-link nav-link-with-badge">{{ l('通知', 'Notifications') }}{% if notifications_unread_count %}<span class="nav-badge">{{ notifications_unread_count }}</span>{% endif %}</a>
<a href="{{ url_for('user_logout') }}" class="forum-link">{{ l('退出', 'Logout') }}</a>
{% else %}
<a href="{{ url_for('user_login', next=request.path) }}" class="forum-link">{{ l('登录', 'Login') }}</a>
<a href="{{ url_for('user_register', next=request.path) }}" class="forum-link">{{ l('注册', 'Register') }}</a>
{% endif %}
</div>
</div>
</header>
<main class="forum-shell">
<nav class="forum-breadcrumb" aria-label="{{ l('面包屑导航', 'Breadcrumb') }}">
<a href="{{ url_for('index') }}">{{ l('首页', 'Home') }}</a>
<span>/</span>
<a href="{{ url_for('forum_index') }}">{{ l('论坛', 'Forum') }}</a>
{% if post.category %}
<span>/</span>
<a href="{{ url_for('forum_index', category=post.category) }}">{{ post.category }}</a>
{% endif %}
<span>/</span>
<span>{{ post.title }}</span>
</nav>
<section class="forum-layout">
<div class="topic-stream">
<article class="topic-post-card">
<div class="topic-post-head">
<span class="topic-category">{{ post.category or l('综合讨论', 'General') }}</span>
{% if post.is_pinned %}<span class="topic-flag flag-pinned">{{ l('置顶', 'Pinned') }}</span>{% endif %}
{% if post.is_featured %}<span class="topic-flag flag-featured">{{ l('精华', 'Featured') }}</span>{% endif %}
{% if post.is_locked %}<span class="topic-flag flag-locked">{{ l('锁帖', 'Locked') }}</span>{% endif %}
{% if post.created_at %}
<time datetime="{{ post.created_at.strftime('%Y-%m-%dT%H:%M:%SZ') }}">{{ post.created_at.strftime('%Y-%m-%d %H:%M') }}</time>
{% endif %}
<span>{{ l('浏览', 'Views') }} {{ post.view_count or 0 }}</span>
<span>{{ l('点赞', 'Likes') }} {{ like_count or 0 }}</span>
<span>{{ l('收藏', 'Bookmarks') }} {{ bookmark_count or 0 }}</span>
</div>
<h1>{{ post.title }}</h1>
<div class="topic-post-author">{{ l('作者:', 'Author: ') }}{{ post.author_rel.username if post.author_rel else l('已注销用户', 'Deleted user') }}</div>
<div class="topic-action-bar">
{% if current_user and can_interact %}
<form method="post" action="{{ url_for('forum_post_like_toggle', post_id=post.id) }}">
<button type="submit" class="forum-btn-muted {{ 'active' if liked_by_me else '' }}">{{ l('已点赞', 'Liked') if liked_by_me else l('点赞', 'Like') }}</button>
</form>
<form method="post" action="{{ url_for('forum_post_bookmark_toggle', post_id=post.id) }}">
<button type="submit" class="forum-btn-muted {{ 'active' if bookmarked_by_me else '' }}">{{ l('已收藏', 'Bookmarked') if bookmarked_by_me else l('收藏', 'Bookmark') }}</button>
</form>
{% elif current_user and not can_interact %}
<span class="topic-empty">{{ l('账号被封禁,暂不可互动', 'Your account is banned. Interaction is disabled.') }}</span>
{% else %}
<a href="{{ url_for('user_login', next=request.path) }}" class="forum-btn-muted">{{ l('登录后点赞/收藏', 'Login to like/bookmark') }}</a>
{% endif %}
{% if current_user and current_user.id == post.user_id and can_interact %}
<a href="{{ url_for('forum_post_edit', post_id=post.id) }}" class="forum-btn-muted">{{ l('编辑帖子', 'Edit Topic') }}</a>
<form method="post" action="{{ url_for('forum_post_delete', post_id=post.id) }}" onsubmit="return confirm('{{ l('确定删除该帖子?删除后不可恢复。', 'Delete this topic permanently?') }}');">
<button type="submit" class="forum-btn-danger">{{ l('删除帖子', 'Delete Topic') }}</button>
</form>
{% elif current_user and current_user.id == post.user_id and not can_interact %}
<span class="topic-empty">{{ l('账号封禁中,无法编辑或删除帖子', 'Account banned. Editing/deleting is disabled.') }}</span>
{% elif current_user and can_interact %}
<form method="post" action="{{ url_for('forum_report_create') }}" class="report-form-inline">
<input type="hidden" name="target_type" value="post">
<input type="hidden" name="target_id" value="{{ post.id }}">
<select name="reason" required>
{% for reason in forum_report_reasons %}
<option value="{{ reason }}">{{ reason }}</option>
{% endfor %}
</select>
<button type="submit" class="forum-btn-muted">{{ l('举报帖子', 'Report Topic') }}</button>
</form>
{% endif %}
</div>
<div class="topic-post-content md-content">{{ post.content|markdown_html }}</div>
</article>
<section class="topic-post-card">
<h2>{{ l('评论', 'Comments') }}{{ comments|length }}</h2>
{% if message %}
<p class="form-success">{{ message }}</p>
{% endif %}
{% if error %}
<p class="form-error">{{ error }}</p>
{% endif %}
{% if post.is_locked %}
<p class="topic-empty">{{ l('该帖子已锁定,暂不允许新增评论。', 'This topic is locked. New comments are disabled.') }}</p>
{% elif current_user and can_interact %}
<form method="post" action="{{ url_for('forum_post_comment', post_id=post.id) }}" class="comment-form">
<div class="form-group">
<label for="content">{{ l('写下你的评论', 'Write your comment') }}</label>
<textarea id="content" name="content" required rows="4" minlength="2"></textarea>
<small class="form-help">{{ l('支持 Markdown 代码块。', 'Markdown code blocks are supported.') }}</small>
</div>
<button type="submit" class="forum-btn-primary">{{ l('发布评论', 'Post Comment') }}</button>
</form>
{% elif current_user and not can_interact %}
<p class="topic-empty">{{ l('账号被封禁,暂不可评论。', 'Your account is banned. Commenting is disabled.') }}</p>
{% else %}
<p class="topic-empty">{{ l('请先', 'Please') }} <a href="{{ url_for('user_login', next=request.path) }}">{{ l('登录', 'log in') }}</a> {{ l('后评论。', 'to comment.') }}</p>
{% endif %}
{% if comments %}
<ul class="comment-stream">
{% for c in comments %}
<li id="comment-{{ c.id }}" class="comment-row">
<div class="comment-avatar">{{ (c.author_rel.username[0] if c.author_rel and c.author_rel.username else '?')|upper }}</div>
<div class="comment-body">
<div class="comment-head">
<span class="comment-author">{{ c.author_rel.username if c.author_rel else l('已注销用户', 'Deleted user') }}</span>
{% if c.created_at %}
<time datetime="{{ c.created_at.strftime('%Y-%m-%dT%H:%M:%SZ') }}">{{ c.created_at.strftime('%Y-%m-%d %H:%M') }}</time>
{% endif %}
</div>
<div class="comment-content md-content">{{ c.content|markdown_html }}</div>
<div class="comment-actions">
{% if current_user and current_user.id == c.user_id and can_interact %}
<a href="{{ url_for('forum_comment_edit', comment_id=c.id) }}">{{ l('编辑', 'Edit') }}</a>
<form method="post" action="{{ url_for('forum_comment_delete', comment_id=c.id) }}" onsubmit="return confirm('{{ l('确定删除这条评论?', 'Delete this comment?') }}');">
<button type="submit" class="btn-link-delete">{{ l('删除', 'Delete') }}</button>
</form>
{% elif current_user and current_user.id == c.user_id and not can_interact %}
<span class="muted-text">{{ l('账号封禁中', 'Account banned') }}</span>
{% elif current_user and can_interact %}
<form method="post" action="{{ url_for('forum_report_create') }}" class="report-form-inline">
<input type="hidden" name="target_type" value="comment">
<input type="hidden" name="target_id" value="{{ c.id }}">
<select name="reason" required>
{% for reason in forum_report_reasons %}
<option value="{{ reason }}">{{ reason }}</option>
{% endfor %}
</select>
<button type="submit" class="btn-link-delete">{{ l('举报', 'Report') }}</button>
</form>
{% endif %}
</div>
</div>
</li>
{% endfor %}
</ul>
{% else %}
<p class="topic-empty">{{ l('还没有评论,欢迎抢沙发。', 'No comments yet. Be the first to reply.') }}</p>
{% endif %}
</section>
</div>
<aside class="forum-sidebar">
<div class="side-card">
<h3>{{ l('社区统计', 'Community Stats') }}</h3>
<div class="side-stats">
<div><span>{{ l('用户', 'Users') }}</span><strong>{{ sb.total_users }}</strong></div>
<div><span>{{ l('帖子', 'Posts') }}</span><strong>{{ sb.total_posts }}</strong></div>
<div><span>{{ l('评论', 'Comments') }}</span><strong>{{ sb.total_comments }}</strong></div>
</div>
</div>
<div class="side-card">
<h3>{{ l('分类热度', 'Category Heat') }}</h3>
{% if sb.category_counts %}
<ul class="side-list">
{% for name, count in sb.category_counts %}
<li><span>{{ name }}</span><strong>{{ count }}</strong></li>
{% endfor %}
</ul>
{% else %}
<p class="side-empty">{{ l('暂无分类数据', 'No category data') }}</p>
{% endif %}
</div>
</aside>
</section>
</main>
</body>
</html>