列表页评论
This commit is contained in:
parent
3636c3952a
commit
75f6afcddc
|
@ -50,22 +50,20 @@ func Detail(c *gin.Context) {
|
|||
}
|
||||
}
|
||||
pw := sessions.Default(c).Get("post_password")
|
||||
showComment := true
|
||||
showComment := false
|
||||
if post.CommentCount > 0 || post.CommentStatus == "open" {
|
||||
showComment = true
|
||||
}
|
||||
common.PasswordProjectTitle(&post)
|
||||
if post.PostPassword != "" && pw != post.PostPassword {
|
||||
common.PasswdProjectContent(&post)
|
||||
showComment = false
|
||||
}
|
||||
canComment := false
|
||||
if post.CommentStatus == "open" {
|
||||
canComment = true
|
||||
}
|
||||
prev, next, err := common.GetContextPost(post.Id, post.PostDate)
|
||||
|
||||
h["title"] = fmt.Sprintf("%s-%s", post.PostTitle, models.Options["blogname"])
|
||||
h["post"] = post
|
||||
h["comment"] = showComment
|
||||
h["canComment"] = canComment
|
||||
h["showComment"] = showComment
|
||||
h["prev"] = prev
|
||||
h["next"] = next
|
||||
}
|
||||
|
|
|
@ -40,12 +40,10 @@
|
|||
|
||||
</article><!-- #post-1 -->
|
||||
|
||||
{{ if .showComment}}
|
||||
<div id="comments" class="comments-area">
|
||||
|
||||
<h2 class="comments-title">
|
||||
《{{.post.PostTitle}}》上有1条评论 </h2>
|
||||
|
||||
|
||||
{{ if gt .post.CommentCount 0}}
|
||||
<h2 class="comments-title">《{{.post.PostTitle}}》上有{{.post.CommentCount}}条评论 </h2>
|
||||
<ol class="comment-list">
|
||||
<li id="comment-1" class="comment even thread-even depth-1">
|
||||
<article id="div-comment-1" class="comment-body">
|
||||
|
@ -83,8 +81,8 @@
|
|||
</article><!-- .comment-body -->
|
||||
</li><!-- #comment-## -->
|
||||
</ol><!-- .comment-list -->
|
||||
|
||||
{{if .canComment}}
|
||||
{{end}}
|
||||
{{if eq .post.CommentStatus "open"}}
|
||||
<div id="respond" class="comment-respond">
|
||||
<h3 id="reply-title" class="comment-reply-title">发表回复
|
||||
<small>
|
||||
|
@ -122,8 +120,12 @@
|
|||
</p>
|
||||
</form>
|
||||
</div><!-- #respond -->
|
||||
{{else}}
|
||||
<p class="no-comments">评论已关闭。</p>
|
||||
{{end}}
|
||||
</div><!-- .comments-area -->
|
||||
{{end}}
|
||||
|
||||
|
||||
<nav class="navigation post-navigation" aria-label="文章">
|
||||
<h2 class="screen-reader-text">文章导航</h2>
|
||||
|
|
|
@ -49,12 +49,14 @@
|
|||
{{$v.TagsHtml|unescaped}}
|
||||
</span>
|
||||
{{end}}
|
||||
|
||||
{{if gt $v.CommentCount 0}}
|
||||
<span class="comments-link">
|
||||
<a href="/p/1#comments">
|
||||
<span class="screen-reader-text">{{$v.PostTitle}}</span>有1条评论
|
||||
<a href="/p/{{$v.Id}}#comments">
|
||||
<span class="screen-reader-text">{{$v.PostTitle}}</span>有{{$v.CommentCount}}条评论
|
||||
</a>
|
||||
</span>
|
||||
{{end}}
|
||||
|
||||
</footer><!-- .entry-footer -->
|
||||
|
||||
</article><!-- #post-{{$v.Id}} -->
|
||||
|
|
Loading…
Reference in New Issue
Block a user