beta2 theme

This commit is contained in:
life
2014-11-12 18:54:42 +08:00
parent 4d7a9c8089
commit 163215d547
24 changed files with 104 additions and 161 deletions

View File

@ -297,6 +297,9 @@ func (c Blog) blogCommon(userId string, userBlog info.UserBlog, userInfo info.Us
// 得到主题信息 // 得到主题信息
themeInfo := themeService.GetThemeInfo(userBlog.ThemeId.Hex(), userBlog.Style) themeInfo := themeService.GetThemeInfo(userBlog.ThemeId.Hex(), userBlog.Style)
c.RenderArgs["themeInfo"] = themeInfo c.RenderArgs["themeInfo"] = themeInfo
Log(">>")
Log(userBlog.Style)
Log(userBlog.ThemeId.Hex())
return true, userBlog return true, userBlog
} }

View File

@ -438,14 +438,15 @@ func (this *ThemeService) ImportTheme(userId, path string) (ok bool, msg string)
func (this *ThemeService) UpgradeThemeBeta2() (ok bool) { func (this *ThemeService) UpgradeThemeBeta2() (ok bool) {
adminUserId := configService.GetAdminUserId() adminUserId := configService.GetAdminUserId()
this.upgradeThemeBeta2(adminUserId, this.GetDefaultThemePath(defaultStyle), true) this.upgradeThemeBeta2(adminUserId, defaultStyle, true)
this.upgradeThemeBeta2(adminUserId, this.GetDefaultThemePath(elegantStyle), false) this.upgradeThemeBeta2(adminUserId, elegantStyle, false)
this.upgradeThemeBeta2(adminUserId, this.GetDefaultThemePath(fixedStyle), false) this.upgradeThemeBeta2(adminUserId, fixedStyle, false)
return true return true
} }
func (this *ThemeService) upgradeThemeBeta2(userId, targetPath string, isActive bool) (ok bool) { func (this *ThemeService) upgradeThemeBeta2(userId, style string, isActive bool) (ok bool) {
// 解压成功, 那么新建之 // 解压成功, 那么新建之
// 保存到数据库中 // 保存到数据库中
targetPath := this.GetDefaultThemePath(style)
theme, _ := this.getThemeConfig(revel.BasePath + "/" + targetPath) theme, _ := this.getThemeConfig(revel.BasePath + "/" + targetPath)
if theme.Name == "" { if theme.Name == "" {
ok = false ok = false
@ -459,6 +460,7 @@ func (this *ThemeService) upgradeThemeBeta2(userId, targetPath string, isActive
theme.UserId = bson.ObjectIdHex(userId) theme.UserId = bson.ObjectIdHex(userId)
theme.IsActive = isActive theme.IsActive = isActive
theme.IsDefault = true theme.IsDefault = true
theme.Style = style
ok = db.Insert(db.Themes, theme) ok = db.Insert(db.Themes, theme)
return ok return ok
} }

View File

@ -49,7 +49,6 @@ func (this *UpgradeService) UpgradeBetaToBeta2(userId string) (ok bool, msg stri
blogService.AddOrUpdateSingle(userBlog.UserId.Hex(), "", "About Me", userBlog.AboutMe) blogService.AddOrUpdateSingle(userBlog.UserId.Hex(), "", "About Me", userBlog.AboutMe)
} }
// 2. 默认主题, 给admin用户 // 2. 默认主题, 给admin用户
themeService.UpgradeThemeBeta2() themeService.UpgradeThemeBeta2()
@ -97,7 +96,6 @@ func (this *UpgradeService) UpgradeBetaToBeta2(userId string) (ok bool, msg stri
// 删除索引 // 删除索引
db.ShareNotes.DropIndex("UserId", "ToUserId", "NoteId") db.ShareNotes.DropIndex("UserId", "ToUserId", "NoteId")
ok = true ok = true
msg = "success" msg = "success"
configService.UpdateGlobalStringConfig(userId, "UpgradeBetaToBeta2", "1") configService.UpdateGlobalStringConfig(userId, "UpgradeBetaToBeta2", "1")

View File

@ -1,47 +1,19 @@
<!DOCTYPE html> {{template "header.html" .}}
<html lang="zh">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="keywords" content="leanote,leanote.com">
<title>404</title>
<link href="/css/bootstrap.css" rel="stylesheet"> <div id="postsContainer">
<link href="/css/font-awesome-4.2.0/css/font-awesome.css" rel="stylesheet">
<link href="/css/index.css" rel="stylesheet">
<style>
html, body {
height: 100%;
}
</style>
</head>
<body id="boxBody">
<section id="box">
<div>
<div>
<h1 class="h text-white animated fadeInDownBig">life-404</h1>
</div>
<div id="errorBox">
<p class="error-info">
This page cann't found.
</p>
<div class="list-group m-b-sm bg-white m-b-lg"> <div id="posts">
<a href="javascript:history.go(-1);" class="list-group-item"><!-- <i class="fa fa-chevron-right icon-muted"> --></i> <i class="fa fa-fw fa-arrow-left icon-muted"></i> Back </a> <div class="each-post">
<a href="/index" class="list-group-item"><!-- <i class="fa fa-chevron-right icon-muted"> --></i> <i class="fa fa-fw fa-home icon-muted"></i> Goto homepage </a> <div class="title">
<a href="/note" class="list-group-item"><!-- <i class="fa fa-chevron-right icon-muted"> --></i> <i class="fa fa-fw fa-file-o icon-muted"></i> My note</a> 404 NOT FOUND
<a class="list-group-item" href="mailto:leanote@leanote.com"> </div>
<span class="badge">leanote@leanote.com</span> <div class="desc">
<i class="fa fa-fw fa-envelope-o icon-muted"></i> Contact Us </a> Sorry, We can't find this page.
</div> </div>
</div> </div>
</div> </div>
</section>
<div id="boxFooter">
<p>
<a href="/index">leanote</a> © 2014
</p>
</div> </div>
{{template "footer.html" $}}
</body> </body>
</html> </html>

View File

@ -11,9 +11,17 @@
{{range $.archives}} {{range $.archives}}
<li><span class="archive-year">{{.Year}}</span> <li><span class="archive-year">{{.Year}}</span>
<ul> <ul>
{{range .Posts}} {{range .MonthAchives}}
<li> <li>
{{dateFormat .PublicTime "2006-01-02"}} <a href="{{$.postUrl}}/{{.NoteId}}">{{.Title}}</a> <span class="archive-month">{{.Month}}</span>
<ul>
{{range .Posts}}
<li>
{{dateFormat .PublicTime "2006-01-02"}} <a href="{{$.postUrl}}/{{.UrlTitle}}">{{.Title}}</a>
</li>
{{end}}
</ul>
</li> </li>
{{end}} {{end}}
</ul> </ul>

View File

@ -90,14 +90,14 @@ function log(o) {
<!-- 分类页 --> <!-- 分类页 -->
{{range $.cates}} {{range $.cates}}
<li class="{{if eq .CateId $.curCateId}}active{{end}}"> <li class="{{if eq .CateId $.curCateId}}active{{end}}">
<a href="{{$.cateUrl}}/{{.CateId}}" <a href="{{$.cateUrl}}/{{.UrlTitle}}"
>{{.Title}}</a> >{{.Title}}</a>
</li> </li>
{{end}} {{end}}
<!-- 单页 --> <!-- 单页 -->
{{range $.singles}} {{range $.singles}}
<li class="{{if eq $.curSingleId .SingleId}}active{{end}}"> <li class="{{if eq $.curSingleId .SingleId}}active{{end}}">
<a href="{{$.singleUrl}}/{{.SingleId}}">{{.Title}}</a> <a href="{{$.singleUrl}}/{{.UrlTitle}}">{{.Title}}</a>
</li> </li>
{{end}} {{end}}

View File

@ -6,7 +6,7 @@
{{range $.posts}} {{range $.posts}}
<div class="each-post"> <div class="each-post">
<div class="title"> <div class="title">
<a href="{{$.postUrl}}/{{.NoteId}}" title="全文"> <a href="{{$.postUrl}}/{{.UrlTitle}}" title="全文">
{{.Title}} {{.Title}}
</a> </a>
</div> </div>
@ -25,7 +25,7 @@
<div class="desc"> <div class="desc">
{{.Abstract | raw}} {{.Abstract | raw}}
</div> </div>
<a class="more" href="{{$.postUrl}}/{{.NoteId}}" title="全文">查看</a> <a class="more" href="{{$.postUrl}}/{{.UrlTitle}}" title="全文">查看</a>
</div> </div>
{{end}} {{end}}
<!-- 分页 --> <!-- 分页 -->

View File

@ -51,10 +51,10 @@
<div class="pre-next-post"> <div class="pre-next-post">
<p> <p>
上一篇: {{if $.prePost}}<a href="{{$.postUrl}}/{{$.prePost.NoteId}}">{{$.prePost.Title}}</a>{{else}}无{{end}} 上一篇: {{if $.prePost}}<a href="{{$.postUrl}}/{{$.prePost.UrlTitle}}">{{$.prePost.Title}}</a>{{else}}无{{end}}
</p> </p>
<p> <p>
下一篇: {{if $.nextPost}}<a href="{{$.postUrl}}/{{$.nextPost.NoteId}}">{{$.nextPost.Title}}</a>{{else}}无{{end}} 下一篇: {{if $.nextPost}}<a href="{{$.postUrl}}/{{$.nextPost.UrlTitle}}">{{$.nextPost.Title}}</a>{{else}}无{{end}}
</p> </p>
</div> </div>

View File

@ -9,7 +9,7 @@
{{range .posts}} {{range .posts}}
<div class="each-post"> <div class="each-post">
<div class="title"> <div class="title">
<a href="{{$.postUrl}}/{{.NoteId}}" title="全文"> <a href="{{$.postUrl}}/{{.UrlTitle}}" title="全文">
{{.Title}} {{.Title}}
</a> </a>
</div> </div>
@ -27,7 +27,7 @@
<div class="desc"> <div class="desc">
{{.Abstract | raw}} {{.Abstract | raw}}
</div> </div>
<a class="more" href="{{$.postUrl}}/{{.NoteId}}" title="全文">查看</a> <a class="more" href="{{$.postUrl}}/{{.UrlTitle}}" title="全文">查看</a>
</div> </div>

View File

@ -9,7 +9,7 @@
{{range .posts}} {{range .posts}}
<div class="each-post"> <div class="each-post">
<div class="title"> <div class="title">
<a href="{{$.postUrl}}/{{.NoteId}}" title="全文"> <a href="{{$.postUrl}}/{{.UrlTitle}}" title="全文">
{{.Title}} {{.Title}}
</a> </a>
</div> </div>
@ -27,7 +27,7 @@
<div class="desc"> <div class="desc">
{{.Abstract | raw}} {{.Abstract | raw}}
</div> </div>
<a class="more" href="{{$.postUrl}}/{{.NoteId}}" title="全文">查看</a> <a class="more" href="{{$.postUrl}}/{{.UrlTitle}}" title="全文">查看</a>
</div> </div>
{{else}} {{else}}
<div class="each-post"> <div class="each-post">

View File

@ -22,6 +22,10 @@
"Author": "leanote.com", "Author": "leanote.com",
"AuthorUrl": "http://leanote.com", "AuthorUrl": "http://leanote.com",
"FriendLinks": [ "FriendLinks": [
{"Title": "leanote", "Url": "http://leanote.com"} {"Title": "我的笔记", "Url": "http://leanote.com/note"},
{"Title": "leanote home", "Url": "http://leanote.com"},
{"Title": "leanote 社区", "Url": "http://bbs.leanote.com"},
{"Title": "lea++", "Url": "http://lea.leanote.com"},
{"Title": "leanote github", "Url": "https://github.com/leanote/leanote"}
] ]
} }

View File

@ -1,47 +1,19 @@
<!DOCTYPE html> {{template "header.html" .}}
<html lang="zh">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="keywords" content="leanote,leanote.com">
<title>404</title>
<link href="/css/bootstrap.css" rel="stylesheet"> <div id="postsContainer">
<link href="/css/font-awesome-4.2.0/css/font-awesome.css" rel="stylesheet">
<link href="/css/index.css" rel="stylesheet">
<style>
html, body {
height: 100%;
}
</style>
</head>
<body id="boxBody">
<section id="box">
<div>
<div>
<h1 class="h text-white animated fadeInDownBig">life-404</h1>
</div>
<div id="errorBox">
<p class="error-info">
This page cann't found.
</p>
<div class="list-group m-b-sm bg-white m-b-lg"> <div id="posts">
<a href="javascript:history.go(-1);" class="list-group-item"><!-- <i class="fa fa-chevron-right icon-muted"> --></i> <i class="fa fa-fw fa-arrow-left icon-muted"></i> Back </a> <div class="each-post">
<a href="/index" class="list-group-item"><!-- <i class="fa fa-chevron-right icon-muted"> --></i> <i class="fa fa-fw fa-home icon-muted"></i> Goto homepage </a> <div class="title">
<a href="/note" class="list-group-item"><!-- <i class="fa fa-chevron-right icon-muted"> --></i> <i class="fa fa-fw fa-file-o icon-muted"></i> My note</a> 404 NOT FOUND
<a class="list-group-item" href="mailto:leanote@leanote.com"> </div>
<span class="badge">leanote@leanote.com</span> <div class="desc">
<i class="fa fa-fw fa-envelope-o icon-muted"></i> Contact Us </a> Sorry, We can't find this page.
</div> </div>
</div> </div>
</div> </div>
</section>
<div id="boxFooter">
<p>
<a href="/index">leanote</a> © 2014
</p>
</div> </div>
{{template "footer.html" $}}
</body> </body>
</html> </html>

View File

@ -1,47 +1,19 @@
<!DOCTYPE html> {{template "header.html" .}}
<html lang="zh">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="keywords" content="leanote,leanote.com">
<title>404</title>
<link href="/css/bootstrap.css" rel="stylesheet"> <div id="postsContainer">
<link href="/css/font-awesome-4.2.0/css/font-awesome.css" rel="stylesheet">
<link href="/css/index.css" rel="stylesheet">
<style>
html, body {
height: 100%;
}
</style>
</head>
<body id="boxBody">
<section id="box">
<div>
<div>
<h1 class="h text-white animated fadeInDownBig">life-404</h1>
</div>
<div id="errorBox">
<p class="error-info">
This page cann't found.
</p>
<div class="list-group m-b-sm bg-white m-b-lg"> <div id="posts">
<a href="javascript:history.go(-1);" class="list-group-item"><!-- <i class="fa fa-chevron-right icon-muted"> --></i> <i class="fa fa-fw fa-arrow-left icon-muted"></i> Back </a> <div class="each-post">
<a href="/index" class="list-group-item"><!-- <i class="fa fa-chevron-right icon-muted"> --></i> <i class="fa fa-fw fa-home icon-muted"></i> Goto homepage </a> <div class="title">
<a href="/note" class="list-group-item"><!-- <i class="fa fa-chevron-right icon-muted"> --></i> <i class="fa fa-fw fa-file-o icon-muted"></i> My note</a> 404 NOT FOUND
<a class="list-group-item" href="mailto:leanote@leanote.com"> </div>
<span class="badge">leanote@leanote.com</span> <div class="desc">
<i class="fa fa-fw fa-envelope-o icon-muted"></i> Contact Us </a> Sorry, We can't find this page.
</div> </div>
</div> </div>
</div> </div>
</section>
<div id="boxFooter">
<p>
<a href="/index">leanote</a> © 2014
</p>
</div> </div>
{{template "footer.html" $}}
</body> </body>
</html> </html>

View File

@ -11,9 +11,17 @@
{{range $.archives}} {{range $.archives}}
<li><span class="archive-year">{{.Year}}</span> <li><span class="archive-year">{{.Year}}</span>
<ul> <ul>
{{range .Posts}} {{range .MonthAchives}}
<li> <li>
{{dateFormat .PublicTime "2006-01-02"}} <a href="{{$.postUrl}}/{{.NoteId}}">{{.Title}}</a> <span class="archive-month">{{.Month}}</span>
<ul>
{{range .Posts}}
<li>
{{dateFormat .PublicTime "2006-01-02"}} <a href="{{$.postUrl}}/{{.UrlTitle}}">{{.Title}}</a>
</li>
{{end}}
</ul>
</li> </li>
{{end}} {{end}}
</ul> </ul>

View File

@ -90,14 +90,14 @@ function log(o) {
<!-- 分类页 --> <!-- 分类页 -->
{{range $.cates}} {{range $.cates}}
<li class="{{if eq .CateId $.curCateId}}active{{end}}"> <li class="{{if eq .CateId $.curCateId}}active{{end}}">
<a href="{{$.cateUrl}}/{{.CateId}}" <a href="{{$.cateUrl}}/{{.UrlTitle}}"
>{{.Title}}</a> >{{.Title}}</a>
</li> </li>
{{end}} {{end}}
<!-- 单页 --> <!-- 单页 -->
{{range $.singles}} {{range $.singles}}
<li class="{{if eq $.curSingleId .SingleId}}active{{end}}"> <li class="{{if eq $.curSingleId .SingleId}}active{{end}}">
<a href="{{$.singleUrl}}/{{.SingleId}}">{{.Title}}</a> <a href="{{$.singleUrl}}/{{.UrlTitle}}">{{.Title}}</a>
</li> </li>
{{end}} {{end}}

View File

@ -6,7 +6,7 @@
{{range $.posts}} {{range $.posts}}
<div class="each-post"> <div class="each-post">
<div class="title"> <div class="title">
<a href="{{$.postUrl}}/{{.NoteId}}" title="全文"> <a href="{{$.postUrl}}/{{.UrlTitle}}" title="全文">
{{.Title}} {{.Title}}
</a> </a>
</div> </div>
@ -25,7 +25,7 @@
<div class="desc"> <div class="desc">
{{.Abstract | raw}} {{.Abstract | raw}}
</div> </div>
<a class="more" href="{{$.postUrl}}/{{.NoteId}}" title="全文">查看</a> <a class="more" href="{{$.postUrl}}/{{.UrlTitle}}" title="全文">查看</a>
</div> </div>
{{end}} {{end}}
<!-- 分页 --> <!-- 分页 -->

View File

@ -51,10 +51,10 @@
<div class="pre-next-post"> <div class="pre-next-post">
<p> <p>
上一篇: {{if $.prePost}}<a href="{{$.postUrl}}/{{$.prePost.NoteId}}">{{$.prePost.Title}}</a>{{else}}无{{end}} 上一篇: {{if $.prePost}}<a href="{{$.postUrl}}/{{$.prePost.UrlTitle}}">{{$.prePost.Title}}</a>{{else}}无{{end}}
</p> </p>
<p> <p>
下一篇: {{if $.nextPost}}<a href="{{$.postUrl}}/{{$.nextPost.NoteId}}">{{$.nextPost.Title}}</a>{{else}}无{{end}} 下一篇: {{if $.nextPost}}<a href="{{$.postUrl}}/{{$.nextPost.UrlTitle}}">{{$.nextPost.Title}}</a>{{else}}无{{end}}
</p> </p>
</div> </div>

View File

@ -9,7 +9,7 @@
{{range .posts}} {{range .posts}}
<div class="each-post"> <div class="each-post">
<div class="title"> <div class="title">
<a href="{{$.postUrl}}/{{.NoteId}}" title="全文"> <a href="{{$.postUrl}}/{{.UrlTitle}}" title="全文">
{{.Title}} {{.Title}}
</a> </a>
</div> </div>
@ -27,7 +27,7 @@
<div class="desc"> <div class="desc">
{{.Abstract | raw}} {{.Abstract | raw}}
</div> </div>
<a class="more" href="{{$.postUrl}}/{{.NoteId}}" title="全文">查看</a> <a class="more" href="{{$.postUrl}}/{{.UrlTitle}}" title="全文">查看</a>
</div> </div>

View File

@ -9,7 +9,7 @@
{{range .posts}} {{range .posts}}
<div class="each-post"> <div class="each-post">
<div class="title"> <div class="title">
<a href="{{$.postUrl}}/{{.NoteId}}" title="全文"> <a href="{{$.postUrl}}/{{.UrlTitle}}" title="全文">
{{.Title}} {{.Title}}
</a> </a>
</div> </div>
@ -27,7 +27,7 @@
<div class="desc"> <div class="desc">
{{.Abstract | raw}} {{.Abstract | raw}}
</div> </div>
<a class="more" href="{{$.postUrl}}/{{.NoteId}}" title="全文">查看</a> <a class="more" href="{{$.postUrl}}/{{.UrlTitle}}" title="全文">查看</a>
</div> </div>
{{else}} {{else}}
<div class="each-post"> <div class="each-post">

View File

@ -22,6 +22,10 @@
"Author": "leanote.com", "Author": "leanote.com",
"AuthorUrl": "http://leanote.com", "AuthorUrl": "http://leanote.com",
"FriendLinks": [ "FriendLinks": [
{"Title": "leanote", "Url": "http://leanote.com"} {"Title": "我的笔记", "Url": "http://leanote.com/note"},
{"Title": "leanote home", "Url": "http://leanote.com"},
{"Title": "leanote 社区", "Url": "http://bbs.leanote.com"},
{"Title": "lea++", "Url": "http://lea.leanote.com"},
{"Title": "leanote github", "Url": "https://github.com/leanote/leanote"}
] ]
} }