default themes and fix notebook to blog bug

This commit is contained in:
life
2014-11-12 19:36:31 +08:00
parent cd3c2f7b12
commit 51fedfa6dc
18 changed files with 61 additions and 156 deletions

View File

@ -481,7 +481,7 @@ func (c Blog) Cate(userIdOrEmail string, notebookId string) (re revel.Result) {
return c.e404(userBlog.ThemePath) // 404 TODO 使用用户的404
}
if !notebook.IsBlog {
return c.e404("")
panic("")
}
// 分页的话, 需要分页信息, totalPage, curPage

View File

@ -185,6 +185,10 @@ func (this *NotebookService) UpdateNotebook(userId, notebookId string, needUpdat
// ToBlog or Not
func (this *NotebookService) ToBlog(userId, notebookId string, isBlog bool) (bool) {
// 笔记本
db.UpdateByIdAndUserIdMap(db.Notebooks, notebookId, userId, bson.M{"IsBlog": isBlog})
// 更新笔记
q := bson.M{"UserId": bson.ObjectIdHex(userId),
"NotebookId": bson.ObjectIdHex(notebookId)}
data := bson.M{"IsBlog": isBlog}
@ -194,7 +198,7 @@ func (this *NotebookService) ToBlog(userId, notebookId string, isBlog bool) (boo
data["HasSelfDefined"] = false
}
db.UpdateByQMap(db.Notes, q, data)
// noteContents也更新, 这个就麻烦了, noteContents表没有NotebookId
// 先查该notebook下所有notes, 得到id
notes := []info.Note{}

View File

@ -39,7 +39,7 @@
}
</style>
<div class="row">
<div class="col-sm-3">
<div class="col-sm-4">
<section class="panel panel-default">
<header class="panel-heading">
模板, 样式, 脚本:
@ -62,7 +62,7 @@
</footer>
</section>
</div>
<div class="col-sm-9">
<div class="col-sm-8">
<section class="panel panel-default">
<header class="panel-heading">
当前文件: <span id="curTpl">header.html</span>
@ -118,7 +118,7 @@ var theme = {
saveBtnO: $("#saveBtn"),
newFileO: $("#newFile"),
curTpl: "",
tplInfos: {"header.html": "头部", "footer.html": "底部", "index.html": "首页", "cate.html": "分类页", "search.html": "搜索页", "single.html": "单页", "archive.html": "归档页", "view.html": "详情页", "tags.html": "标签页", "tag_posts.html": "标签博客", "comment.html": "分享评论", "404.html":"404", "theme.json": "主题配置"},
tplInfos: {"header.html": "头部", "footer.html": "底部", "index.html": "首页", "cate.html": "分类页", "search.html": "搜索页", "single.html": "单页", "archive.html": "归档页", "post.html": "文章页", "tags.html": "标签页", "tag_posts.html": "标签文章页", "share_comment.html": "分享评论", "404.html":"404", "theme.json": "主题配置", "paging.html": "分页", "highlight.html": "高亮"},
init: function() {
var self = this;
self.showTplInfo();
@ -150,15 +150,15 @@ var theme = {
var file = $a.data('file');
art.confirm("Are you sure to delete " + file + " ?", function() {
ajaxPost("/member/blog/deleteTpl", {themeId: themeId, filename: file}, function(re) {
if(reIsOk(re)) {
// if(reIsOk(re)) {
art.tips("Success");
$a.remove();
if(self.curTpl == file) {
$(".file-list a").eq(0).trigger("click");
}
} else {
art.alert(re.Msg);
}
//} else {
// art.alert(re.Msg);
//}
})
});
});