Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 265e331

Browse files
committed
bugfix(author is short)
1 parent 7664b38 commit 265e331

File tree

7 files changed

+148
-8
lines changed

7 files changed

+148
-8
lines changed

websites/code/studygolang/src/model/article.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ type Article struct {
2929
Cover string `json:"cover"`
3030
Author string `json:"author"`
3131
AuthorTxt string `json:"author_txt"`
32-
Lang string `json:"lang"`
32+
Lang int `json:"lang"`
3333
PubDate string `json:"pub_date"`
3434
Url string `json:"url"`
3535
Content string `json:"content"`

websites/code/studygolang/static/css/main.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ html, body { background: #F2F2F2; font-family: "Helvetica Neue", Helvetica, Aria
104104
.page .tags .list-inline li a {padding: 4px 12px;color: #fff;font-family: "NSimSun";font-size: 12px;background: #9F9F9F;border-radius: 3px;}
105105
.page .tags .list-inline li a:hover {background: #ED5565;text-decoration: none;}
106106
.page .content {margin: 0 30px;}
107-
.page .content img, .page .content .container {width: 780px !important;}
107+
.page .content img, .page .content .container {max-width: 780px !important;}
108108
.page .orig-info {margin: 20px 30px 0 30px; border: 1px dashed #D5D5D5; padding: 10px; font-size: 13px; font-style: italic;}
109109
.page .active {border-bottom: 1px dotted #d8d8d8;padding-bottom: 20px;padding-top: 20px;margin: 0 30px;}
110110
.page .active .mark-like-btn .share-btn {height: 32px;-webkit-transition: background-color 0s;-moz-transition: background-color 0s;transition: background-color 0s;line-height: 32px;background: none;border: 1px solid;position: relative;color: #333;padding: 0px 16px 0px 36px;border-radius: 16px;font-family: "microsoft yahei";float: left;}

websites/code/studygolang/template/admin/article/modify.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ <h3>基本信息</h3>
6868
<span class="field">
6969
<select name="lang" class="uniformselect">
7070
{{range $i, $v := .langSlice}}
71-
<option value="{{$i}}">{{$v}}</option>
71+
<option value="{{$i}}"{{if eq $i $.article.Lang}} selected{{end}}>{{$v}}</option>
7272
{{end}}
7373
</select>
7474
</span>
@@ -86,7 +86,7 @@ <h3>基本信息</h3>
8686
<span class="field">
8787
<select name="status" class="uniformselect">
8888
{{range $i, $v := .statusSlice}}
89-
<option value="{{$i}}">{{$v}}</option>
89+
<option value="{{$i}}"{{if eq $i $.article.Status}} selected{{end}}>{{$v}}</option>
9090
{{end}}
9191
</select>
9292
</span>

websites/code/studygolang/template/articles/list.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ <h2><a href="/articles/{{.Id}}" target="_blank" title="{{.Title}}">{{.Title}}</a
3333
<i class="glyphicon glyphicon-calendar"></i>
3434
<span class="date" title="发布日期">{{.PubDate}}</span>
3535
<i class="glyphicon glyphicon-user"></i>
36-
<span class="author" title="作者">{{.Author}}</span>
36+
<span class="author" title="作者">{{substring .AuthorTxt 15 " 等"}}</span>
3737
{{if .Tags}}
3838
{{$tags := explode .Tags ","}}
3939
<ul class="list-inline">

websites/code/studygolang/template/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ <h2><a href="/articles/{{.Id}}" target="_blank" title="{{.Title}}">{{.Title}}</a
6565
<i class="glyphicon glyphicon-calendar"></i>
6666
<span class="date" title="发布日期">{{.PubDate}}</span>
6767
<i class="glyphicon glyphicon-user"></i>
68-
<span class="author" title="作者">{{.Author}}</span>
68+
<span class="author" title="作者">{{substring .AuthorTxt 15 " 等"}}</span>
6969
{{if .Tags}}
7070
{{$tags := explode .Tags ","}}
7171
<ul class="list-inline">
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
{{define "title"}}搜索{{end}}
2+
{{define "seo"}}<meta name="keywords" content="Go语言博客文章, Go语言博文, Go语言, Golang, Go中文社区,Golang中文社区, Go语言社区, Go语言学习园地">
3+
<meta name="description" content="文章来自国内知名网站知名,Go爱好者学习笔记,经验分享;也有爱好者自己的博客文章,已经一些国外精彩文章。">{{end}}
4+
{{define "content"}}
5+
<div class="row header_title">
6+
<div class="col-lg-12 col-md-12 col-sm-12 search-box">
7+
<div class="box_white">
8+
<form action="" class="search-form">
9+
<div>
10+
<div class="col-xs-2">
11+
</div>
12+
<div class="col-xs-6">
13+
<input type="text" class="form-control" name="q" placeholder="输入搜索词" />
14+
</div>
15+
<div class="col-xs-1">
16+
<button type="button" class="btn btn-default">搜索</button>
17+
</div>
18+
</div>
19+
<div class="clearfix">
20+
<div class="col-xs-2">
21+
</div>
22+
<div class="col-xs-6">
23+
<div class="radio">
24+
<label>
25+
<input type="radio" name="f" checked="checked" /> 全文
26+
</label>&nbsp;&nbsp;
27+
<label>
28+
<input type="radio" name="f" /> 标题
29+
</label>&nbsp;&nbsp;
30+
<label>
31+
<input type="radio" name="f" /> 作者
32+
</label>
33+
</div>
34+
</div>
35+
</div>
36+
</form>
37+
</div>
38+
</div>
39+
</div>
40+
<div class="row">
41+
<div class="col-lg-9 col-md-8 col-sm-7">
42+
{{range .docs}}
43+
<article class="article box_white">
44+
<div class="row">
45+
<div>
46+
<h2><a href="/articles/{{.Objid}}" target="_blank" title="{{.Title}}">{{.Title}}</a></h2>
47+
<p class="text">{{substring .Content 250 "..."}}<a href="/articles/{{.Objid}}" target="_blank" title="阅读全文">阅读全文</a></p>
48+
</div>
49+
</div>
50+
<div class="row">
51+
<div class="col-md-8 metatag">
52+
<i class="glyphicon glyphicon-calendar"></i>
53+
<span class="date" title="发布日期">{{.PubTime}}</span>
54+
<i class="glyphicon glyphicon-user"></i>
55+
<span class="author" title="作者">{{.Author}}</span>
56+
{{if .Tags}}
57+
{{$tags := explode .Tags ","}}
58+
<ul class="list-inline">
59+
<i class="glyphicon glyphicon-tags"></i>
60+
{{range $tag := $tags}}
61+
<li>
62+
<a href="/" title="{{$tag}}" target="_blank">
63+
{{$tag}}
64+
</a>
65+
</li>
66+
{{end}}
67+
</ul>
68+
{{end}}
69+
</div>
70+
<div class="col-md-4 metatag text-right">
71+
<span class="view" title="阅读数">
72+
<i class="glyphicon glyphicon-eye-open"></i>
73+
阅读:<span>{{.Viewnum}}</span>
74+
</span>
75+
<a href="/articles/{{.Id}}#commentForm" class="cmt" target="_blank" title="评论数">
76+
<i class="glyphicon glyphicon-comment"></i>
77+
评论:<span>{{.Cmtnum}}</span>
78+
</a>
79+
{{if $.likeflags}}
80+
{{$likeFlag := index $.likeflags .Id}}
81+
<a href="#" class="like{{if $likeFlag}} hadlike{{end}}" title="{{if $likeFlag}}取消喜欢{{else}}我喜欢{{end}}" data-objid="{{.Id}}" data-objtype="1" data-flag="{{if $likeFlag}}{{$likeFlag}}{{else}}0{{end}}">
82+
<i class="glyphicon glyphicon-heart{{if not $likeFlag}}-empty{{end}}"></i>
83+
{{else}}
84+
<a href="#" class="like" title="我喜欢" data-objid="{{.Id}}" data-objtype="1" data-flag="0">
85+
<i class="glyphicon glyphicon-heart-empty"></i>
86+
{{end}}
87+
<span class="likenum">{{.Likenum}}</span>人喜欢
88+
</a>
89+
</div>
90+
</div>
91+
</article>
92+
{{end}}
93+
<ul class="pager">
94+
{{if .page.has_prev}}
95+
<li class="previous"><a href="/articles?lastid={{.page.prev_id}}">&larr; 上一页</a></li>
96+
{{end}}
97+
{{if .page.has_next}}
98+
<li class="next"><a href="/articles?lastid={{.page.next_id}}">下一页 &rarr;</a></li>
99+
{{end}}
100+
</ul>
101+
</div>
102+
<div class="col-lg-3 col-md-4 col-sm-5">
103+
<div class="row box_white sidebar">
104+
<div class="top">
105+
<ul class="list-inline text-center">
106+
<li class="first"><a href="/topics" target="_blank" class="cur" title="点击更多">最新帖子</a>|</li>
107+
<li class="second"><a href="/resources" target="_blank" title="点击更多">最新资源</a>|</li>
108+
<li class="last"><a href="javascript:;">最新评论</a></li>
109+
</ul>
110+
<p class="bar"></p>
111+
</div>
112+
<div class="sb-content">
113+
<div class="topic-list first">
114+
<ul class="list-unstyled">
115+
<img src="/static/img/loaders/loader7.gif" alt="加载中" />
116+
</ul>
117+
</div>
118+
<div class="resource-list second hidden">
119+
<ul class="list-unstyled">
120+
</ul>
121+
</div>
122+
<div class="cmt-list last hidden">
123+
<ul class="list-unstyled">
124+
</ul>
125+
</div>
126+
</div>
127+
</div>
128+
</div>
129+
</div>
130+
{{end}}
131+
{{define "js"}}
132+
<script type="text/javascript">
133+
// 需要加载的侧边栏
134+
SG.SIDE_BARS = [
135+
"/topics/recent.json",
136+
"/resources/recent.json",
137+
"/comments/recent.json",
138+
];
139+
</script>
140+
{{end}}

websites/databases/studygolang_db.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,8 @@ CREATE TABLE `articles` (
331331
`name` varchar(30) NOT NULL DEFAULT '' COMMENT '来源名称',
332332
`title` varchar(127) NOT NULL DEFAULT '' COMMENT '文章标题',
333333
`cover` varchar(127) NOT NULL DEFAULT '' COMMENT '图片封面',
334-
`author` varchar(255) NOT NULL DEFAULT '' COMMENT '文章作者(可能带html)',
335-
`author_txt` varchar(30) NOT NULL DEFAULT '' COMMENT '文章作者(纯文本)',
334+
`author` varchar(1024) NOT NULL DEFAULT '' COMMENT '文章作者(可能带html)',
335+
`author_txt` varchar(127) NOT NULL DEFAULT '' COMMENT '文章作者(纯文本)',
336336
`lang` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '语言:0-中文;1-英文',
337337
`pub_date` varchar(20) NOT NULL DEFAULT '' COMMENT '发布时间',
338338
`url` varchar(127) NOT NULL DEFAULT '' COMMENT '文章原始链接',

0 commit comments

Comments
 (0)