81 lines
3.4 KiB
HTML
81 lines
3.4 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block title %}{{ post.author.username }} 的作品 - 泸州高中摄影社论坛{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="container post-detail-container">
|
|
<div class="post-detail-card">
|
|
<!-- Post Header -->
|
|
<div class="post-detail-header">
|
|
<a href="{{ url_for('users.profile', username=post.author.username) }}" class="user-info-large">
|
|
<div class="user-avatar-large">
|
|
{{ post.author.username[0].upper() }}
|
|
</div>
|
|
<div>
|
|
<div class="username-large">{{ post.author.username }}</div>
|
|
<div class="post-time">{{ post.created_at.strftime('%Y年%m月%d日 %H:%M') }}</div>
|
|
</div>
|
|
</a>
|
|
|
|
{% if not post.is_approved %}
|
|
<div class="badge badge-warning">等待审核</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<!-- Post Image -->
|
|
<div class="post-detail-image">
|
|
<img src="{{ url_for('uploaded_file', filename=post.image_path) }}" alt="Post image" class="detail-image">
|
|
</div>
|
|
|
|
<!-- Post Description -->
|
|
{% if post.description %}
|
|
<div class="post-detail-description">
|
|
{{ post.description }}
|
|
</div>
|
|
{% endif %}
|
|
|
|
<!-- Comments Section -->
|
|
<div class="comments-section">
|
|
<h2 class="comments-title">💬 评论 ({{ comments|length }})</h2>
|
|
|
|
{% if current_user.is_authenticated and current_user.is_approved and post.is_approved %}
|
|
<form method="POST" action="{{ url_for('posts.add_comment', post_id=post.id) }}" class="comment-form">
|
|
<textarea name="content" placeholder="发表你的想法..." required class="comment-input"></textarea>
|
|
<button type="submit" class="btn btn-primary">发表评论</button>
|
|
</form>
|
|
{% elif not current_user.is_authenticated %}
|
|
<div class="info-box">
|
|
<p><a href="{{ url_for('auth.login') }}">登录</a> 后可以发表评论</p>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<!-- Comments List -->
|
|
<div class="comments-list">
|
|
{% for comment in comments %}
|
|
<div class="comment-item">
|
|
<a href="{{ url_for('users.profile', username=comment.author.username) }}" class="comment-avatar">
|
|
{{ comment.author.username[0].upper() }}
|
|
</a>
|
|
<div class="comment-content">
|
|
<div class="comment-header">
|
|
<a href="{{ url_for('users.profile', username=comment.author.username) }}"
|
|
class="comment-username">
|
|
{{ comment.author.username }}
|
|
</a>
|
|
<span class="comment-time">{{ comment.created_at.strftime('%Y-%m-%d %H:%M') }}</span>
|
|
</div>
|
|
<div class="comment-text">{{ comment.content }}</div>
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
|
|
{% if not comments %}
|
|
<div class="empty-comments">
|
|
<p>还没有评论,快来抢沙发吧!</p>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endblock %} |