forked from jimmykuu/gopher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
165 lines (162 loc) · 4.78 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
{{define "Title"}}首页{{end}}
{{define "Breadcrumb"}}{{end}}
{{define "ContentWidth"}}8{{end}}
{{define "Content"}}
<div class="content">
<div>
<h3 class="pull-left">欢迎来到Golang中国社区</h3>
<ul class="nav nav-tabs pull-right">
{{if eq .subActive "latestReply"}}
<li class="active"><a href="javascript:;">最近回复</a></li>
{{else}}
<li><a href="/">最近回复</a></li>
{{end}}
{{if eq .subActive "latestCreate"}}
<li class="active"><a href="javascript:;">最近发布</a></li>
{{else}}
<li><a href="/topics/latest">最近发布</a></li>
{{end}}
{{if eq .subActive "noReply"}}
<li class="active"><a href="javascript:;">尚未回复</a></li>
{{else}}
<li><a href="/topics/no_reply">尚未回复</a></li>
{{end}}
</ul>
</div>
<div class="clearfix"></div>
<dl class="topics">
{{range .topics}}
{{$creater := .Creater $.db}}
{{$node := .Node $.db}}
<dd>
<a href="/member/{{$creater.Username}}" class="pull-left" style="margin-right: 10px;">
<img class="img-rounded" src="{{$creater.AvatarImgSrc 48}}" alt="{{$creater.Username}}">
</a>
{{if .CommentCount}}
<a class="badge pull-right" href="/t/{{.Id_.Hex}}#.LatestReplyId.Hex">{{.CommentCount}}</a>
{{end}}
<a href="/t/{{.Id_.Hex}}" class="title">{{truncate .Title 80 "..."}}{{if .IsTop}} <span class="glyphicon glyphicon-pushpin"></span>{{end}}</a>
<div class="space"></div>
<div class="info" style="margin-left:60px">
<a class="label label-info" href="/go/{{$node.Id}}">{{$node.Name}}</a> •
<a href="/member/{{$creater.Username}}"><strong>{{$creater.Username}}</strong></a> •
{{if .CommentCount}}
{{$latestReplier := .LatestReplier $.db}}
<time datetime="{{formatdatetime .LatestRepliedAt}}" title="{{formatdatetime .LatestRepliedAt}}">{{formattime .LatestRepliedAt}}</time> • 最后回复来自 <a href="/member/{{$latestReplier.Username}}">{{$latestReplier.Username}}</a>
{{else}}
<time datetime="{{formatdatetime .CreatedAt}}" title="{{formatdatetime .CreatedAt}}">{{formattime .CreatedAt}}</time>
{{end}}
</div>
<div class="clear"></div>
</dd>
{{end}}
</dl>
<hr>
{{.pagination.Html .page}}
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">节点导航</h3>
</div>
<div class="panel-body">
{{range .nodes}}
<a href="/go/{{.Id}}" class="btn">{{.Name}}</a>
{{end}}
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">热门城市</h3>
</div>
<div class="panel-body">
{{range .cities}}
<a href="/members/city/{{.Name}}" class="btn">{{.Name}}</a>
{{end}}
</div>
</div>
{{end}}
{{define "LeftSide"}}{{end}}
{{define "RightSide"}}
<div class="col-md-4 sidebar">
<div class="panel panel-default">
<div class="panel-body">
{{if .username}}
{{.utils.UserInfo .username .db}}
<!--
{{.utils.News .username .db}}
<hr>
<a href="/member/{{.username}}/collect?p=1">收藏</a>-->
{{else}}
<h4><small>致力于打造一个国内Gophers交流和分享的地方</small></h4>
<hr>
<div align="center">
<a href="/signup" class="btn btn-info">注册</a><!-- 或
<a href="/auth/login" class="btn btn-info">Github登录</a>-->
</div>
<div class="cleanfix"></div>
<div align="center">已注册用户:<a href="/signin">登录</a></div>
{{end}}
</div>
</div>
<a href="/topic/new" class="btn btn-success btn-lg btn-block" style="margin-bottom: 20px;"><i class="glyphicon glyphicon-edit"></i> 发表话题</a>
{{$ads := ads "frontpage" .db}}
{{if $ads}}
<div class="panel panel-default" id="ads">
<div class="panel-body">
{{range $ads}}
{{html .Code}}
{{end}}
</div>
</div>
{{end}}
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">友情社区</h3>
</div>
<ul class="list-group">
{{range .linkExchanges}}
<li class="list-group-item">
<a href="{{.URL}}" target="_blank" title="{{.Description}}">
{{if .Logo}}
<img src="{{.Logo}}" style="max-width: 224px;">
{{else}}
{{.Name}}
{{end}}
</a>
</li>
{{end}}
</ul>
<div class="panel-footer">
<a href="/link" class="pull-right">更多</a>
<div class="clearfix"></div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">社区状态</h3>
</div>
<table width="100%" class="status">
<thead>
<tr>
<th> </th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td class="status-label">注册会员</td>
<td class="value">{{.status.UserCount}}</td>
</tr>
<tr>
<td class="status-label">主题</td>
<td class="value">{{.status.TopicCount}}</td>
</tr>
<tr>
<td class="status-label">回复</td>
<td class="value">{{.status.ReplyCount}}</td>
</tr>
</tbody>
</table>
</div>
</div>
{{end}}