1
- {{define "title"}}{{.article.Title }} {{end}}
2
- {{define "seo"}}< meta name ="keywords " content ="{{.article.Title }}, Go语言博客文章, Go语言博文, Go语言, Golang, Go中文社区,Golang中文社区, Go语言社区, Go语言学习园地 ">
3
- < meta name ="description " content ="{{substring .article.Txt 200 ""}}"> {{end}}
1
+ {{define "title"}}{{.book.Name }} {{end}}
2
+ {{define "seo"}}< meta name ="keywords " content ="{{.book.Name }}, Go语言图书, Go语言, Golang, Go中文社区,Golang中文社区, Go语言社区, Go语言学习园地,Go语言中文网 ">
3
+ < meta name ="description " content ="{{substring .book.Desc 200 ""}}"> {{end}}
4
4
{{define "content"}}
5
5
< div class ="row banner ">
6
6
</ div >
7
7
< div class ="row ">
8
8
< div class ="col-lg-9 col-md-8 col-sm-7 ">
9
9
< ol class ="breadcrumb ">
10
10
< li > < a href ="/ "> < i class ="glyphicon glyphicon-home "> </ i > 首页</ a > </ li >
11
- < li > < a href ="/articles " > 网友博文 </ a > </ li >
12
- < li class ="active "> {{.article.Title }}</ li >
11
+ < li > < a href ="/books " > 图书 </ a > </ li >
12
+ < li class ="active "> {{.book.Name }}</ li >
13
13
</ ol >
14
14
< div class ="page box_white ">
15
- < div class ="title text-center ">
16
- < h1 id ="title " data-id ="{{.article.Id}} ">
17
- {{.article.Title}}
18
- {{if .me}}
19
- {{if or (eq .me.Username .article.Author) .me.IsRoot}}
20
- < button id ="edit " type ="button " class ="btn btn-primary btn-xs "> 编辑</ button >
15
+ < div class ="row book ">
16
+ < div class ="col-lg-2 col-md-2 ">
17
+ < div class ="book-cover-col ">
18
+ < div class ="book-cover-box wide ">
19
+ < a href ="{{.book.Cover}} " style ="float: none; ">
20
+ < img src ="{{.book.Cover}} " class ="bookcover ">
21
+ </ a >
22
+ < span class ="ebook "> </ span >
23
+ </ div >
24
+ {{if .book.Price}}
25
+ < div class ="book-sales ">
26
+ < b > ¥ {{.book.Price}}</ b >
27
+ </ div >
21
28
{{end}}
22
- {{end}}
23
- </ h1 >
24
- </ div >
25
- < div class ="meta ">
26
- < div class ="p-author ">
27
- < i class ="glyphicon glyphicon-calendar "> </ i >
28
- < span title ="发布日期 "> {{.article.PubDate}}</ span >
29
- < i class ="glyphicon glyphicon-user "> </ i >
30
- {{if .article.IsSelf}}
31
- < a href ="/user/{{.article.Author}} "> {{.article.Author}}</ a >
32
- {{else}}
33
- {{noescape .article.Author}}
34
- {{end}}
29
+ < div class ="book-like ">
30
+ < div class ="like ">
31
+ < a class ="share-btn like-btn {{if .likeflag}}hadlike{{end}} " href ="javascript:; " title ="{{if .likeflag}}取消推荐{{else}}推荐{{end}} " data-objid ="{{.book.Id}} " data-objtype ="1 " data-flag ="{{.likeflag}} "> {{if .likeflag}}取消推荐{{else}}推荐{{end}}</ a >
32
+ < strong > {{.book.Likenum}}</ strong >
33
+ </ div >
34
+ </ div >
35
+ </ div >
35
36
</ div >
36
- <!-- p-author END -->
37
-
38
- < div class ="p-comment text-right ">
39
- < span class ="view " title ="阅读数 ">
40
- < i class ="glyphicon glyphicon-eye-open "> </ i >
41
- 阅读 < span > {{.article.Viewnum}}</ span > 次
42
- </ span >
43
- < span class ="like " title ="喜欢人数 ">
44
- < i class ="glyphicon glyphicon-heart "> </ i >
45
- < span class ="likenum "> {{.article.Likenum}}</ span > 人喜欢
46
- </ span >
47
- < a href ="/articles/{{.article.Id}}#commentForm " title ="我要评论 "> < i class ="glyphicon glyphicon-comment "> </ i > < span class ="cmtnum "> {{.article.Cmtnum}}</ span > 条评论</ a >
48
- < a class ="favorite collect {{if .hadcollect}}hadlike{{end}} " href ="# " title ="{{if .hadcollect}}取消收藏{{else}}稍后再读{{end}} " data-objid ="{{.article.Id}} " data-objtype ="1 " data-collect ="{{.hadcollect}} ">
49
- < i class ="glyphicon glyphicon-star{{if eq .hadcollect 0}}-empty{{end}} "> </ i > 收藏
50
- </ a >
51
- </ div >
52
- <!-- p-comment END -->
53
- </ div >
54
- < div class ="tags ">
55
- {{if .article.Tags}}
56
- {{$tags := explode .article.Tags ","}}
57
- < ul class ="list-inline ">
58
- {{range $tag := $tags}}
59
- < li > < a href ="/search?q={{$tag}}&f=tag " title ="{{$tag}} "> {{$tag}}</ a > </ li >
37
+ < div class ="col-lg-10 col-md-10 ">
38
+ < div class ="book-header ">
39
+ < h3 > {{.book.Name}}< span class ="lang "> ({{if .book.Lang}}英文版{{else}}中文版{{end}})</ span > </ h3 >
40
+ {{if .book.Ename}}
41
+ < small > 英文书名:< strong > {{.book.Ename}}</ strong > </ small >
42
+ {{end}}
43
+ </ div >
44
+ < div class ="meta " style ="margin: 0; ">
45
+ < div class ="p-author ">
46
+ < i class ="glyphicon glyphicon-calendar "> </ i >
47
+ < span title ="发布日期 "> {{.book.PubDate}}</ span >
48
+ < i class ="glyphicon glyphicon-user "> </ i >
49
+ {{.book.Author}} (作者)
50
+ {{if .book.Translator}}
51
+ {{.book.Translator}} (译者)
52
+ {{end}}
53
+ </ div >
54
+ <!-- p-author END -->
55
+
56
+ < div class ="p-comment text-right ">
57
+ < span class ="view " title ="阅读数 ">
58
+ < i class ="glyphicon glyphicon-eye-open "> </ i >
59
+ 阅读 < span > {{.book.Viewnum}}</ span > 次
60
+ </ span >
61
+ < a href ="/book/{{.book.Id}}#commentForm " title ="我要评论 "> < i class ="glyphicon glyphicon-comment "> </ i > < span class ="cmtnum "> {{.book.Cmtnum}}</ span > 条评论</ a >
62
+ </ div >
63
+ <!-- p-comment END -->
64
+ </ div >
65
+ < div class ="tags " style ="margin: 0; ">
66
+ < ul class ="list-inline ">
67
+ {{if .book.OnlineUrl}}
68
+ < li > < a href ="{{.book.OnlineUrl}} " target ="_blank "> 在线阅读</ a > </ li >
69
+ {{end}}
70
+ {{if .book.DownloadUrl}}
71
+ < li > < a href ="{{.book.DownloadUrl}} " target ="_blank "> 下载</ a > </ li >
72
+ {{end}}
73
+ {{if .book.BuyUrl}}
74
+ < li > < a href ="{{.book.BuyUrl}} " target ="_blank "> 去购买</ a > </ li >
75
+ {{end}}
76
+ </ ul >
77
+ </ div >
78
+ < div class ="desc ">
79
+ {{.book.Desc}}
80
+ </ div >
81
+ {{if .book.Catalogue}}
82
+ < div class ="catalogue ">
83
+ {{.book.Catalogue}}
84
+ </ div >
60
85
{{end}}
61
- </ ul >
62
- {{end}}
63
- </ div >
64
- <!-- tags END -->
65
- < div id ="myeditor " class ="content article-entry ">
66
- {{noescape .article.Content}}
67
- </ div >
68
- <!-- content END -->
69
- {{if not .article.IsSelf}}
70
- < div class ="row orig-info ">
71
- < p > 本文来自:< a href ="/wr?u=http://{{.article.Domain}} " target ="_blank " title ="{{.article.Name}} "> {{.article.Name}}</ a > </ p >
72
- < p > 感谢作者:{{noescape .article.Author}}</ p >
73
- < p > 查看原文:< a href ="/wr?u={{.article.Url}} " target ="_blank " title ="{{.article.Title}} "> {{.article.Title}}</ a > </ p >
74
- </ div >
75
- {{end}}
76
- < div class ="active row ">
77
- < div class ="mark-like-btn col-md-8 ">
78
- < a class ="share-btn like-btn {{if .likeflag}}hadlike{{end}} " href ="javascript:; " title ="{{if .likeflag}}取消喜欢{{else}}我喜欢{{end}} " data-objid ="{{.article.Id}} " data-objtype ="1 " data-flag ="{{.likeflag}} ">
79
- < i class ="glyphicon glyphicon-heart-empty "> </ i > < span class ="likenum "> {{.article.Likenum}}</ span > 人喜欢
80
- </ a >
81
- < a class ="share-btn collect {{if .hadcollect}}hadlike{{end}} " href ="javascript:; " title ="{{if .hadcollect}}取消收藏{{else}}稍后再读{{end}} " data-objid ="{{.article.Id}} " data-objtype ="1 " data-collect ="{{.hadcollect}} ">
82
- < i class ="glyphicon glyphicon-star-empty "> </ i > 收藏
83
- </ a >
84
86
</ div >
85
87
</ div >
86
-
87
- <!--百度推荐-->
88
- < div id ="hm_t_45501 " style ="margin:0 auto;max-width:790px; "> </ div >
89
88
90
- < div class ="row prev-next ">
91
- {{if .prev}}< div > < a href ="/articles/{{.prev.Id}} " title ="{{.prev.Title}} "> « </ a > 上一篇: < a href ="/articles/{{.prev.Id}} " title ="{{.prev.Title}} "> {{.prev.Title}}</ a > </ div > {{end}}
92
- {{if .next}}< div > < a href ="/articles/{{.next.Id}} " title ="{{.next.Title}} "> » </ a > 下一篇: < a href ="/articles/{{.next.Id}} " title ="{{.next.Title}} "> {{.next.Title}}</ a > </ div > {{end}}
93
- </ div >
89
+ < hr class ="dashed ">
90
+
94
91
<!-- 评论 -->
95
- < div class ="page-comment " data-objid ="{{.article .Id}} " data-objtype ="1 " {{if .me}}data-username ="{{.me.Username}} " data-uid ="{{.me.Uid}} " data-avatar ="{{gravatar .me.Avatar .me.Email 48 .is_https}} "{{end}} >
92
+ < div class ="page-comment " data-objid ="{{.book .Id}} " data-objtype ="1 " {{if .me}}data-username ="{{.me.Username}} " data-uid ="{{.me.Uid}} " data-avatar ="{{gravatar .me.Avatar .me.Email 48 .is_https}} "{{end}} >
96
93
< div class ="words hide ">
97
- < h3 > < span class ="cmtnum "> {{.article .Cmtnum}}</ span > 条评论</ h3 >
94
+ < h3 > < span class ="cmtnum "> {{.book .Cmtnum}}</ span > 条评论</ h3 >
98
95
< ul class ="list-unstyled ">
99
96
</ ul >
100
97
</ div >
@@ -112,12 +109,6 @@ <h2>文章点评:</h2>
112
109
</ div >
113
110
</ div >
114
111
< div class ="col-lg-3 col-md-4 col-sm-5 ">
115
- < div class ="row box_white sidebar ">
116
- < div class ="sb-content text-center " style ="margin-top: 15px; ">
117
- < a href ="/articles/new " class ="btn btn-default "> 撰写文章</ a >
118
- </ div >
119
- </ div >
120
-
121
112
< div class ="row box_white sidebar ">
122
113
< div class ="top ">
123
114
< ul class ="list-inline text-center ">
@@ -168,25 +159,15 @@ <h3 class="title"><i class="glyphicon glyphicon-fire"></i> <a href="/projec
168
159
169
160
</ div >
170
161
171
- < template id ="content_tpl ">
172
- {{noescape .article.Content}}
173
- </ template >
174
-
175
162
{{end}}
176
163
{{define "css"}}
164
+ < link rel ="stylesheet " type ="text/css " href ="/static/css/book.css "> </ link >
177
165
< link href ="/static/css/highlight/default.css " media ="screen " rel ="stylesheet " type ="text/css ">
178
166
< link href ="/static/css/syntax_highlight/shCore.css " media ="screen " rel ="stylesheet " type ="text/css ">
179
167
< link href ="/static/css/syntax_highlight/shCoreDefault.css " media ="screen " rel ="stylesheet " type ="text/css ">
180
- {{if .article.Css}}
181
- < link href ="{{.article.Css}} " media ="screen " rel ="stylesheet " type ="text/css ">
182
- {{end}}
183
- {{if .article.IsSelf}}
184
- < link href ="/static/css/prism.css " media ="screen " rel ="stylesheet " type ="text/css ">
185
- {{end}}
186
168
< link href ="/static/css/jquery.atwho.min.css " media ="screen " rel ="stylesheet " type ="text/css ">
187
169
{{end}}
188
170
{{define "js"}}
189
- < script type ="text/javascript " src ="//cdn.ckeditor.com/4.6.2/standard-all/ckeditor.js "> </ script >
190
171
< script type ="text/javascript " src ="/static/js/libs/jquery.autogrowtextarea.min.js "> </ script >
191
172
< script type ="text/javascript " src ="/static/js/libs/marked.min.js "> </ script >
192
173
< script type ="text/javascript " src ="/static/js/libs/highlight.min.js "> </ script >
@@ -199,12 +180,6 @@ <h3 class="title"><i class="glyphicon glyphicon-fire"></i> <a href="/projec
199
180
< script type ="text/javascript " src ="/static/js/libs/plupload.full.min.js "> </ script >
200
181
< script type ="text/javascript " src ="/static/js/comment.js?v=1.1 "> </ script >
201
182
< script type ="text/javascript " src ="/static/js/puploader.js?v=1.0 "> </ script >
202
- {{if .article.IsSelf}}
203
- < script type ="text/javascript ">
204
- $ ( 'code[class*="language-"]' ) . parent ( 'pre' ) . addClass ( 'line-numbers' ) ;
205
- </ script >
206
- < script type ="text/javascript " src ="/static/js/prism.js "> </ script >
207
- {{end}}
208
183
< script type ="text/javascript ">
209
184
// 需要加载的侧边栏
210
185
SG . SIDE_BARS = [
@@ -219,95 +194,9 @@ <h3 class="title"><i class="glyphicon glyphicon-fire"></i> <a href="/projec
219
194
$ ( '.need-autogrow' ) . autoGrow ( ) ;
220
195
221
196
loadComments ( ) ;
222
-
223
- // 文章链接,在本站的 iframe 中打开
224
- $ ( '#wrapper .content' ) . on ( 'mousedown' , 'a' , function ( evt ) {
225
- var url = $ ( this ) . attr ( 'href' ) ;
226
- // $(this).attr('href', '/wr?u='+url);
227
- $ ( this ) . attr ( 'href' , url ) ;
228
- $ ( this ) . attr ( 'target' , '_blank' ) ;
229
- } ) ;
230
197
} ) ;
231
198
</ script >
232
199
< script type ="text/javascript " src ="/static/ckeditor/config.js "> </ script >
233
- < script type ="text/javascript ">
234
- $ ( function ( ) {
235
- CKEDITOR . plugins . addExternal ( 'prism' , '/static/ckeditor/plugins/prism/' , 'plugin.js' ) ;
236
- $ ( '#edit' ) . on ( 'click' , function ( ) {
237
- var txt = $ ( this ) . text ( ) ;
238
- if ( txt == '编辑' ) {
239
- $ ( '#myeditor' ) . attr ( 'contenteditable' , true ) ;
240
- $ ( '#myeditor' ) . html ( $ ( '#content_tpl' ) . html ( ) ) ;
241
- if ( ! CKEDITOR . instances . myeditor ) {
242
- MyEditorConfig . extraPlugins = MyEditorExtraPlugins + ',prism,sourcedialog' ;
243
- MyEditorConfig . toolbarGroups = [
244
- { name : 'undo' } ,
245
- { name : 'basicstyles' , groups : [ 'basicstyles' , 'cleanup' ] } ,
246
- { name : 'paragraph' , groups : [ 'list' , 'indent' , 'blocks' , 'align' ] } ,
247
- { name : 'links' } ,
248
- { name : 'insert' } ,
249
- { name : 'styles' } ,
250
- { name : 'document' , groups : [ 'mode' , 'document' ] }
251
- ] ;
252
- MyEditorConfig . removeButtons = 'Anchor,SpecialChar,HorizontalRule,Table,Styles,Subscript,Superscript' ;
253
- CKEDITOR . inline ( 'myeditor' , MyEditorConfig ) ;
254
- }
255
-
256
- $ ( this ) . text ( '完成' ) ;
257
- } else {
258
- if ( CKEDITOR . instances . myeditor ) {
259
- var content = CKEDITOR . instances . myeditor . getData ( ) ;
260
- modify ( content ) ;
261
-
262
- CKEDITOR . instances . myeditor . destroy ( ) ;
263
-
264
- Prism . highlightAll ( ) ;
265
- }
266
-
267
- $ ( '#myeditor' ) . attr ( 'contenteditable' , false ) ;
268
- $ ( this ) . text ( '编辑' ) ;
269
- }
270
- } ) ;
271
-
272
- CKEDITOR . on ( 'instanceReady' , function ( evt , editor ) {
273
- $ ( '#myeditor' ) . find ( '.cke_widget_element' ) . each ( function ( ) {
274
- $ ( this ) . addClass ( 'line-numbers' ) . css ( 'background-color' , '#000' ) ;
275
- } ) ;
276
- } ) ;
277
-
278
- function modify ( content )
279
- {
280
- var url = '/articles/modify' ,
281
- data = { id : $ ( '#title' ) . data ( 'id' ) , content :content } ;
282
-
283
- $ . ajax ( {
284
- type : "post" ,
285
- url : url ,
286
- data : data ,
287
- dataType : 'json' ,
288
- success : function ( data ) {
289
- if ( data . ok ) {
290
- if ( typeof data . msg != "undefined" ) {
291
- comTip ( data . msg ) ;
292
- } else {
293
- comTip ( "修改成功!" ) ;
294
- }
295
- } else {
296
- comTip ( data . error ) ;
297
- }
298
- } ,
299
- complete :function ( xmlReq , textStatus ) {
300
- } ,
301
- error :function ( xmlReq , textStatus , errorThrown ) {
302
- if ( xmlReq . status == 403 ) {
303
- comTip ( "没有修改权限" ) ;
304
- }
305
- }
306
- } ) ;
307
- }
308
- } ) ;
309
-
310
- </ script >
311
200
< script >
312
201
var baiduImagePlus = {
313
202
noLogo :true ,
0 commit comments