Skip to content

Commit a02da58

Browse files
committed
💄 relevant
1 parent 1fb176a commit a02da58

4 files changed

Lines changed: 26 additions & 27 deletions

File tree

controller/articlectl.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -201,18 +201,13 @@ func showArticleAction(c *gin.Context) {
201201
}
202202

203203
article := &ThemeArticle{
204-
ID: articleModel.ID,
205204
Author: author,
206205
CreatedAt: articleModel.CreatedAt.Format("2006-01-02"),
207206
Title: articleModel.Title,
208-
Tags: themeTags,
209207
URL: getBlogURL(c) + articleModel.Path,
210-
Topped: articleModel.Topped,
211-
ViewCount: articleModel.ViewCount,
212208
CommentCount: articleModel.CommentCount,
213-
ThumbnailURL: "",
214-
Content: "",
215-
Editable: false,
209+
ThumbnailURL: "https://img.hacpai.com/bing/20171109.jpg?imageView2/1/w/960/h/520/interlace/1/q/100",
210+
Abstract: "丁亮快来修改我呀",
216211
}
217212

218213
articles = append(articles, article)

theme/x/Gina/article.html

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -106,34 +106,33 @@ <h2 class="header__title">
106106
<div class="relevant__panel">
107107
{{range $index, $item := .RelevantArticles}}
108108
<div class="relevant__item">
109+
{{if $item.ThumbnailURL}}
110+
<a class="relevant__thumbnail"
111+
href="{{$item.URL}}"
112+
data-src="https://img.hacpai.com/bing/20171109.jpg?imageView2/1/w/960/h/520/interlace/1/q/100"></a>
109113
<a class="module__list-title fn-ellipsis" href="{{$item.URL}}">{{$item.Title}}</a>
110-
<div class="ft-fade relevant__abstract">
114+
{{else}}
115+
<a class="module__list-title fn-ellipsis" href="{{$item.URL}}">{{$item.Title}}</a>
116+
<a href="{{$item.URL}}" class="ft-fade relevant__abstract">
111117
我是摘要我是摘要我是摘要我是摘要我是摘要我是摘要我是摘要我是摘要我是摘要我是摘要
112-
</div>
118+
</a>
119+
{{end}}
113120
<div class="fn-relative">
114121
<a class="avatar fn-absolute" data-src="{{$item.Author.AvatarURL}}"
115122
href="{{$item.Author.URL}}"></a>
116123
<div class="relevant__content">
117124
<a href="{{$item.Author.URL}}" class="ft-gray">{{$item.Author.Name}}</a> <br>
118125
<span class="ft-12 ft-fade fn-clear">
119126
{{$item.CreatedAt}}
120-
<span class="fn-right">{{$item.CommentCount}} {{$.I18n.Comment}}</span>
121-
</span>
122-
</div>
123-
</div>
124-
</div>
125-
<div class="relevant__item">
126-
<div class="relevant__thumbnail"
127-
data-src="https://img.hacpai.com/bing/20171109.jpg?imageView2/1/w/960/h/520/interlace/1/q/100"></div>
128-
<a class="module__list-title fn-ellipsis" href="{{$item.URL}}">{{$item.Title}}</a>
129-
<div class="fn-relative">
130-
<a class="avatar fn-absolute" data-src="{{$item.Author.AvatarURL}}"
131-
href="{{$item.Author.URL}}"></a>
132-
<div class="relevant__content">
133-
<a href="{{$item.Author.URL}}" class="ft-gray">{{$item.Author.Name}}</a> <br>
134-
<span class="ft-12 ft-fade fn-clear">
135-
{{$item.CreatedAt}}
136-
<span class="fn-right">{{$item.CommentCount}} {{$.I18n.Comment}}</span>
127+
<a href="{{$item.URL}}#pipeComments" class="fn-right ft-fade">
128+
{{if ne 0 $item.CommentCount}}
129+
{{$item.CommentCount}}
130+
{{$.I18n.Comment}}
131+
{{else}}
132+
{{$.I18n.Comment}}
133+
<svg><use xlink:href="#comment"></use></svg>
134+
{{end}}
135+
</a>
137136
</span>
138137
</div>
139138
</div>

0 commit comments

Comments
 (0)