Skip to content

Commit

Permalink
显示文章状态
Browse files Browse the repository at this point in the history
  • Loading branch information
movsb committed Apr 16, 2024
1 parent 6d96229 commit 878cd19
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion theme/blog/statics/scripts/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ document.write(function(){/*
<div class="fields">
<input type="text" name="author" placeholder="昵称" />
<input type="text" name="email" placeholder="邮箱(不公开)"/>
<input type="text" name="url" placeholder="个人站点(可不填)" />
<input type="text" name="url" placeholder="网站(可不填)" />
<input type="submit" id="comment-submit" value="发表评论" />
<div class="field">
<input type="checkbox" id="comment-wrap-lines" checked />
Expand Down
2 changes: 1 addition & 1 deletion theme/blog/templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<h2>近期文章</h2>
<ul id="latest-post-list">
{{- range .Home.Posts}}
<li><a href="{{.Link}}">{{.NonPublic}}{{.Title}}</a></li>
<li><a href="{{.Link}}">{{.StatusString}}{{.Title}}</a></li>
{{- end}}
</ul>

Expand Down
2 changes: 1 addition & 1 deletion theme/blog/templates/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<article class="post">
{{ with .Post.Post }}
<div style="overflow: hidden;">
<h1 class="title clearfix"><a href="{{ .Link }}">{{ .Title }}</a></h1>
<h1 class="title clearfix"><a href="{{ .Link }}">{{.StatusString}}{{ .Title }}</a></h1>
</div>
<div class="entry clearfix">
<div class="meta1 clearfix">
Expand Down
2 changes: 1 addition & 1 deletion theme/blog/templates/posts.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ <h1 style="text-align:center">全部文章列表</h1>
{{range .Posts.Posts}}
<tr>
<td>{{.ID}}</td>
<td><a href="/{{.ID}}/" target="_blank" title="{{.Title}}">{{.NonPublic}}{{.Title}}</a></td>
<td><a href="/{{.ID}}/" target="_blank" title="{{.Title}}">{{.StatusString}}{{.Title}}</a></td>
<td>{{.DateString}}</td>
<td>{{.PageView}}</td>
<td>{{.Comments}}</td>
Expand Down
6 changes: 3 additions & 3 deletions theme/data/post.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ func newPosts(posts []*protocols.Post) []*Post {
return ps
}

// NonPublic ...
func (p *Post) NonPublic() string {
switch p.Status {
// 返回文章的公开状态字符串。
func (p *Post) StatusString() string {
switch p.Post.Status {
case ``:
panic(`post.Status empty`)
case `public`:
Expand Down

0 comments on commit 878cd19

Please sign in to comment.