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

Skip to content

Commit 6b47e76

Browse files
author
xuxinhua
committed
有些站点需要额外的css
1 parent 5ea461a commit 6b47e76

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ type Article struct {
3535
Content string `json:"content"`
3636
Txt string `json:"txt"`
3737
Tags string `json:"tags"`
38+
Css string `json:"css"`
3839
Viewnum int `json:"viewnum"`
3940
Cmtnum int `json:"cmtnum"`
4041
Likenum int `json:"likenum"`
@@ -116,8 +117,8 @@ func (this *Article) Order(order string) *Article {
116117
}
117118

118119
func (this *Article) prepareInsertData() {
119-
this.columns = []string{"domain", "name", "title", "author", "author_txt", "lang", "pub_date", "url", "content", "txt", "tags", "ctime"}
120-
this.colValues = []interface{}{this.Domain, this.Name, this.Title, this.Author, this.AuthorTxt, this.Lang, this.PubDate, this.Url, this.Content, this.Txt, this.Tags, this.Ctime}
120+
this.columns = []string{"domain", "name", "title", "author", "author_txt", "lang", "pub_date", "url", "content", "txt", "tags", "css", "ctime"}
121+
this.colValues = []interface{}{this.Domain, this.Name, this.Title, this.Author, this.AuthorTxt, this.Lang, this.PubDate, this.Url, this.Content, this.Txt, this.Tags, this.Css, this.Ctime}
121122
}
122123

123124
func (this *Article) colFieldMap() map[string]interface{} {
@@ -135,6 +136,7 @@ func (this *Article) colFieldMap() map[string]interface{} {
135136
"content": &this.Content,
136137
"txt": &this.Txt,
137138
"tags": &this.Tags,
139+
"css": &this.Css,
138140
"viewnum": &this.Viewnum,
139141
"cmtnum": &this.Cmtnum,
140142
"likenum": &this.Likenum,

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ <h3 class="title"><i class="glyphicon glyphicon-fire"></i>&nbsp;<a href="/projec
171171
<link href="/static/css/highlight/default.css" media="screen" rel="stylesheet" type="text/css">
172172
<link href="/static/css/syntax_highlight/shCore.css" media="screen" rel="stylesheet" type="text/css">
173173
<link href="/static/css/syntax_highlight/shCoreDefault.css" media="screen" rel="stylesheet" type="text/css">
174+
<link href="http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/default.css" media="screen" rel="stylesheet" type="text/css">
175+
{{if .article.Css}}
176+
<link href="{{.article.Css}}" media="screen" rel="stylesheet" type="text/css">
177+
{{end}}
174178
<link href="/static/css/jquery.atwho.min.css" media="screen" rel="stylesheet" type="text/css">
175179
{{end}}
176180
{{define "js"}}

websites/code/studygolang/template/common/layout.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<link href="http://studygolang.qiniudn.com/cosmo_bootstrap.min.css" rel="stylesheet">
1414
<!--<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css" rel="stylesheet">-->
1515
<link href="/static/css/main.css?v=1.1" rel="stylesheet"/>
16-
{{template "css"}}
16+
{{template "css" .}}
1717
</head>
1818
<body>
1919
<header class="navbar navbar-default navbar-fixed-top" role="navigation">

websites/databases/studygolang_db.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ CREATE TABLE `articles` (
342342
`content` longtext NOT NULL COMMENT '正文(带html)',
343343
`txt` text NOT NULL COMMENT '正文(纯文本)',
344344
`tags` varchar(50) NOT NULL DEFAULT '' COMMENT '文章tag,逗号分隔',
345+
`css` varchar(255) NOT NULL DEFAULT '' COMMENT '需要额外引入的css样式',
345346
`viewnum` int unsigned NOT NULL DEFAULT 0 COMMENT '浏览数',
346347
`cmtnum` int unsigned NOT NULL DEFAULT 0 COMMENT '评论数',
347348
`likenum` int unsigned NOT NULL DEFAULT 0 COMMENT '赞数',

0 commit comments

Comments
 (0)