diff --git a/app/controllers/BlogController.go b/app/controllers/BlogController.go index 172b9d8..1ccf16f 100644 --- a/app/controllers/BlogController.go +++ b/app/controllers/BlogController.go @@ -297,6 +297,9 @@ func (c Blog) blogCommon(userId string, userBlog info.UserBlog, userInfo info.Us // 得到主题信息 themeInfo := themeService.GetThemeInfo(userBlog.ThemeId.Hex(), userBlog.Style) c.RenderArgs["themeInfo"] = themeInfo + Log(">>") + Log(userBlog.Style) + Log(userBlog.ThemeId.Hex()) return true, userBlog } diff --git a/app/service/ThemeService.go b/app/service/ThemeService.go index d1385ec..95577a7 100644 --- a/app/service/ThemeService.go +++ b/app/service/ThemeService.go @@ -438,14 +438,15 @@ func (this *ThemeService) ImportTheme(userId, path string) (ok bool, msg string) func (this *ThemeService) UpgradeThemeBeta2() (ok bool) { adminUserId := configService.GetAdminUserId() - this.upgradeThemeBeta2(adminUserId, this.GetDefaultThemePath(defaultStyle), true) - this.upgradeThemeBeta2(adminUserId, this.GetDefaultThemePath(elegantStyle), false) - this.upgradeThemeBeta2(adminUserId, this.GetDefaultThemePath(fixedStyle), false) + this.upgradeThemeBeta2(adminUserId, defaultStyle, true) + this.upgradeThemeBeta2(adminUserId, elegantStyle, false) + this.upgradeThemeBeta2(adminUserId, fixedStyle, false) 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) if theme.Name == "" { ok = false @@ -459,6 +460,7 @@ func (this *ThemeService) upgradeThemeBeta2(userId, targetPath string, isActive theme.UserId = bson.ObjectIdHex(userId) theme.IsActive = isActive theme.IsDefault = true + theme.Style = style ok = db.Insert(db.Themes, theme) return ok } diff --git a/app/service/UpgradeService.go b/app/service/UpgradeService.go index 740a14d..a595dc2 100644 --- a/app/service/UpgradeService.go +++ b/app/service/UpgradeService.go @@ -49,7 +49,6 @@ func (this *UpgradeService) UpgradeBetaToBeta2(userId string) (ok bool, msg stri blogService.AddOrUpdateSingle(userBlog.UserId.Hex(), "", "About Me", userBlog.AboutMe) } - // 2. 默认主题, 给admin用户 themeService.UpgradeThemeBeta2() @@ -97,7 +96,6 @@ func (this *UpgradeService) UpgradeBetaToBeta2(userId string) (ok bool, msg stri // 删除索引 db.ShareNotes.DropIndex("UserId", "ToUserId", "NoteId") - ok = true msg = "success" configService.UpdateGlobalStringConfig(userId, "UpgradeBetaToBeta2", "1") diff --git a/mongodb_backup/leanote_install_data/configs.bson b/mongodb_backup/leanote_install_data/configs.bson index cf86d87..1697dff 100644 Binary files a/mongodb_backup/leanote_install_data/configs.bson and b/mongodb_backup/leanote_install_data/configs.bson differ diff --git a/mongodb_backup/leanote_install_data/sessions.bson b/mongodb_backup/leanote_install_data/sessions.bson index 803d650..cfd9ba0 100644 Binary files a/mongodb_backup/leanote_install_data/sessions.bson and b/mongodb_backup/leanote_install_data/sessions.bson differ diff --git a/mongodb_backup/leanote_install_data/themes.bson b/mongodb_backup/leanote_install_data/themes.bson index d31da2f..02d91c1 100644 Binary files a/mongodb_backup/leanote_install_data/themes.bson and b/mongodb_backup/leanote_install_data/themes.bson differ diff --git a/mongodb_backup/leanote_install_data/users.bson b/mongodb_backup/leanote_install_data/users.bson index 53f0c45..f7dbf80 100644 Binary files a/mongodb_backup/leanote_install_data/users.bson and b/mongodb_backup/leanote_install_data/users.bson differ diff --git a/public/blog/themes/default/404.html b/public/blog/themes/default/404.html index ff4728c..4a698af 100644 --- a/public/blog/themes/default/404.html +++ b/public/blog/themes/default/404.html @@ -1,47 +1,19 @@ -<!DOCTYPE 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> +{{template "header.html" .}} -<link href="/css/bootstrap.css" rel="stylesheet"> -<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 id="postsContainer"> + + <div id="posts"> + <div class="each-post"> + <div class="title"> + 404 NOT FOUND + </div> + <div class="desc"> + Sorry, We can't find this page. + </div> </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"> - <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> - <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> - <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> - <a class="list-group-item" href="mailto:leanote@leanote.com"> - <span class="badge">leanote@leanote.com</span> - <i class="fa fa-fw fa-envelope-o icon-muted"></i> Contact Us </a> - </div> - </div> - </div> -</section> -<div id="boxFooter"> - <p> - <a href="/index">leanote</a> © 2014 - </p> + </div> </div> +{{template "footer.html" $}} + </body> -</html> +</html> \ No newline at end of file diff --git a/public/blog/themes/default/archive.html b/public/blog/themes/default/archive.html index 4a9cb7c..2d19517 100644 --- a/public/blog/themes/default/archive.html +++ b/public/blog/themes/default/archive.html @@ -11,9 +11,17 @@ {{range $.archives}} <li><span class="archive-year">{{.Year}}</span> <ul> - {{range .Posts}} + {{range .MonthAchives}} <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> {{end}} </ul> diff --git a/public/blog/themes/default/header.html b/public/blog/themes/default/header.html index f3144bd..839564a 100644 --- a/public/blog/themes/default/header.html +++ b/public/blog/themes/default/header.html @@ -90,14 +90,14 @@ function log(o) { <!-- 分类页 --> {{range $.cates}} <li class="{{if eq .CateId $.curCateId}}active{{end}}"> - <a href="{{$.cateUrl}}/{{.CateId}}" + <a href="{{$.cateUrl}}/{{.UrlTitle}}" >{{.Title}}</a> </li> {{end}} <!-- 单页 --> {{range $.singles}} <li class="{{if eq $.curSingleId .SingleId}}active{{end}}"> - <a href="{{$.singleUrl}}/{{.SingleId}}">{{.Title}}</a> + <a href="{{$.singleUrl}}/{{.UrlTitle}}">{{.Title}}</a> </li> {{end}} diff --git a/public/blog/themes/default/index.html b/public/blog/themes/default/index.html index 0a9da13..991415e 100644 --- a/public/blog/themes/default/index.html +++ b/public/blog/themes/default/index.html @@ -6,7 +6,7 @@ {{range $.posts}} <div class="each-post"> <div class="title"> - <a href="{{$.postUrl}}/{{.NoteId}}" title="全文"> + <a href="{{$.postUrl}}/{{.UrlTitle}}" title="全文"> {{.Title}} </a> </div> @@ -25,7 +25,7 @@ <div class="desc"> {{.Abstract | raw}} </div> - <a class="more" href="{{$.postUrl}}/{{.NoteId}}" title="全文">查看</a> + <a class="more" href="{{$.postUrl}}/{{.UrlTitle}}" title="全文">查看</a> </div> {{end}} <!-- 分页 --> diff --git a/public/blog/themes/default/post.html b/public/blog/themes/default/post.html index 24dcaf5..f9f0ca9 100644 --- a/public/blog/themes/default/post.html +++ b/public/blog/themes/default/post.html @@ -51,10 +51,10 @@ <div class="pre-next-post"> <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> - 下一篇: {{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> </div> diff --git a/public/blog/themes/default/search.html b/public/blog/themes/default/search.html index 7cfaea7..4e1900c 100644 --- a/public/blog/themes/default/search.html +++ b/public/blog/themes/default/search.html @@ -9,7 +9,7 @@ {{range .posts}} <div class="each-post"> <div class="title"> - <a href="{{$.postUrl}}/{{.NoteId}}" title="全文"> + <a href="{{$.postUrl}}/{{.UrlTitle}}" title="全文"> {{.Title}} </a> </div> @@ -27,7 +27,7 @@ <div class="desc"> {{.Abstract | raw}} </div> - <a class="more" href="{{$.postUrl}}/{{.NoteId}}" title="全文">查看</a> + <a class="more" href="{{$.postUrl}}/{{.UrlTitle}}" title="全文">查看</a> </div> diff --git a/public/blog/themes/default/tag_posts.html b/public/blog/themes/default/tag_posts.html index eff18c7..dd53960 100644 --- a/public/blog/themes/default/tag_posts.html +++ b/public/blog/themes/default/tag_posts.html @@ -9,7 +9,7 @@ {{range .posts}} <div class="each-post"> <div class="title"> - <a href="{{$.postUrl}}/{{.NoteId}}" title="全文"> + <a href="{{$.postUrl}}/{{.UrlTitle}}" title="全文"> {{.Title}} </a> </div> @@ -27,7 +27,7 @@ <div class="desc"> {{.Abstract | raw}} </div> - <a class="more" href="{{$.postUrl}}/{{.NoteId}}" title="全文">查看</a> + <a class="more" href="{{$.postUrl}}/{{.UrlTitle}}" title="全文">查看</a> </div> {{else}} <div class="each-post"> diff --git a/public/blog/themes/default/theme.json b/public/blog/themes/default/theme.json index 27e971c..5fcf492 100644 --- a/public/blog/themes/default/theme.json +++ b/public/blog/themes/default/theme.json @@ -22,6 +22,10 @@ "Author": "leanote.com", "AuthorUrl": "http://leanote.com", "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"} ] } \ No newline at end of file diff --git a/public/blog/themes/elegant/404.html b/public/blog/themes/elegant/404.html index ff4728c..4a698af 100644 --- a/public/blog/themes/elegant/404.html +++ b/public/blog/themes/elegant/404.html @@ -1,47 +1,19 @@ -<!DOCTYPE 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> +{{template "header.html" .}} -<link href="/css/bootstrap.css" rel="stylesheet"> -<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 id="postsContainer"> + + <div id="posts"> + <div class="each-post"> + <div class="title"> + 404 NOT FOUND + </div> + <div class="desc"> + Sorry, We can't find this page. + </div> </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"> - <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> - <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> - <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> - <a class="list-group-item" href="mailto:leanote@leanote.com"> - <span class="badge">leanote@leanote.com</span> - <i class="fa fa-fw fa-envelope-o icon-muted"></i> Contact Us </a> - </div> - </div> - </div> -</section> -<div id="boxFooter"> - <p> - <a href="/index">leanote</a> © 2014 - </p> + </div> </div> +{{template "footer.html" $}} + </body> -</html> +</html> \ No newline at end of file diff --git a/public/blog/themes/nav_fixed/404.html b/public/blog/themes/nav_fixed/404.html index ff4728c..4a698af 100644 --- a/public/blog/themes/nav_fixed/404.html +++ b/public/blog/themes/nav_fixed/404.html @@ -1,47 +1,19 @@ -<!DOCTYPE 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> +{{template "header.html" .}} -<link href="/css/bootstrap.css" rel="stylesheet"> -<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 id="postsContainer"> + + <div id="posts"> + <div class="each-post"> + <div class="title"> + 404 NOT FOUND + </div> + <div class="desc"> + Sorry, We can't find this page. + </div> </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"> - <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> - <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> - <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> - <a class="list-group-item" href="mailto:leanote@leanote.com"> - <span class="badge">leanote@leanote.com</span> - <i class="fa fa-fw fa-envelope-o icon-muted"></i> Contact Us </a> - </div> - </div> - </div> -</section> -<div id="boxFooter"> - <p> - <a href="/index">leanote</a> © 2014 - </p> + </div> </div> +{{template "footer.html" $}} + </body> -</html> +</html> \ No newline at end of file diff --git a/public/blog/themes/nav_fixed/archive.html b/public/blog/themes/nav_fixed/archive.html index 4a9cb7c..2d19517 100644 --- a/public/blog/themes/nav_fixed/archive.html +++ b/public/blog/themes/nav_fixed/archive.html @@ -11,9 +11,17 @@ {{range $.archives}} <li><span class="archive-year">{{.Year}}</span> <ul> - {{range .Posts}} + {{range .MonthAchives}} <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> {{end}} </ul> diff --git a/public/blog/themes/nav_fixed/header.html b/public/blog/themes/nav_fixed/header.html index f3144bd..839564a 100644 --- a/public/blog/themes/nav_fixed/header.html +++ b/public/blog/themes/nav_fixed/header.html @@ -90,14 +90,14 @@ function log(o) { <!-- 分类页 --> {{range $.cates}} <li class="{{if eq .CateId $.curCateId}}active{{end}}"> - <a href="{{$.cateUrl}}/{{.CateId}}" + <a href="{{$.cateUrl}}/{{.UrlTitle}}" >{{.Title}}</a> </li> {{end}} <!-- 单页 --> {{range $.singles}} <li class="{{if eq $.curSingleId .SingleId}}active{{end}}"> - <a href="{{$.singleUrl}}/{{.SingleId}}">{{.Title}}</a> + <a href="{{$.singleUrl}}/{{.UrlTitle}}">{{.Title}}</a> </li> {{end}} diff --git a/public/blog/themes/nav_fixed/index.html b/public/blog/themes/nav_fixed/index.html index 0a9da13..991415e 100644 --- a/public/blog/themes/nav_fixed/index.html +++ b/public/blog/themes/nav_fixed/index.html @@ -6,7 +6,7 @@ {{range $.posts}} <div class="each-post"> <div class="title"> - <a href="{{$.postUrl}}/{{.NoteId}}" title="全文"> + <a href="{{$.postUrl}}/{{.UrlTitle}}" title="全文"> {{.Title}} </a> </div> @@ -25,7 +25,7 @@ <div class="desc"> {{.Abstract | raw}} </div> - <a class="more" href="{{$.postUrl}}/{{.NoteId}}" title="全文">查看</a> + <a class="more" href="{{$.postUrl}}/{{.UrlTitle}}" title="全文">查看</a> </div> {{end}} <!-- 分页 --> diff --git a/public/blog/themes/nav_fixed/post.html b/public/blog/themes/nav_fixed/post.html index 24dcaf5..f9f0ca9 100644 --- a/public/blog/themes/nav_fixed/post.html +++ b/public/blog/themes/nav_fixed/post.html @@ -51,10 +51,10 @@ <div class="pre-next-post"> <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> - 下一篇: {{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> </div> diff --git a/public/blog/themes/nav_fixed/search.html b/public/blog/themes/nav_fixed/search.html index 7cfaea7..4e1900c 100644 --- a/public/blog/themes/nav_fixed/search.html +++ b/public/blog/themes/nav_fixed/search.html @@ -9,7 +9,7 @@ {{range .posts}} <div class="each-post"> <div class="title"> - <a href="{{$.postUrl}}/{{.NoteId}}" title="全文"> + <a href="{{$.postUrl}}/{{.UrlTitle}}" title="全文"> {{.Title}} </a> </div> @@ -27,7 +27,7 @@ <div class="desc"> {{.Abstract | raw}} </div> - <a class="more" href="{{$.postUrl}}/{{.NoteId}}" title="全文">查看</a> + <a class="more" href="{{$.postUrl}}/{{.UrlTitle}}" title="全文">查看</a> </div> diff --git a/public/blog/themes/nav_fixed/tag_posts.html b/public/blog/themes/nav_fixed/tag_posts.html index eff18c7..dd53960 100644 --- a/public/blog/themes/nav_fixed/tag_posts.html +++ b/public/blog/themes/nav_fixed/tag_posts.html @@ -9,7 +9,7 @@ {{range .posts}} <div class="each-post"> <div class="title"> - <a href="{{$.postUrl}}/{{.NoteId}}" title="全文"> + <a href="{{$.postUrl}}/{{.UrlTitle}}" title="全文"> {{.Title}} </a> </div> @@ -27,7 +27,7 @@ <div class="desc"> {{.Abstract | raw}} </div> - <a class="more" href="{{$.postUrl}}/{{.NoteId}}" title="全文">查看</a> + <a class="more" href="{{$.postUrl}}/{{.UrlTitle}}" title="全文">查看</a> </div> {{else}} <div class="each-post"> diff --git a/public/blog/themes/nav_fixed/theme.json b/public/blog/themes/nav_fixed/theme.json index 27e971c..5fcf492 100644 --- a/public/blog/themes/nav_fixed/theme.json +++ b/public/blog/themes/nav_fixed/theme.json @@ -22,6 +22,10 @@ "Author": "leanote.com", "AuthorUrl": "http://leanote.com", "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"} ] } \ No newline at end of file