default themes and fix notebook to blog bug
This commit is contained in:
@ -481,7 +481,7 @@ func (c Blog) Cate(userIdOrEmail string, notebookId string) (re revel.Result) {
|
|||||||
return c.e404(userBlog.ThemePath) // 404 TODO 使用用户的404
|
return c.e404(userBlog.ThemePath) // 404 TODO 使用用户的404
|
||||||
}
|
}
|
||||||
if !notebook.IsBlog {
|
if !notebook.IsBlog {
|
||||||
return c.e404("")
|
panic("")
|
||||||
}
|
}
|
||||||
|
|
||||||
// 分页的话, 需要分页信息, totalPage, curPage
|
// 分页的话, 需要分页信息, totalPage, curPage
|
||||||
|
@ -185,6 +185,10 @@ func (this *NotebookService) UpdateNotebook(userId, notebookId string, needUpdat
|
|||||||
|
|
||||||
// ToBlog or Not
|
// ToBlog or Not
|
||||||
func (this *NotebookService) ToBlog(userId, notebookId string, isBlog bool) (bool) {
|
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),
|
q := bson.M{"UserId": bson.ObjectIdHex(userId),
|
||||||
"NotebookId": bson.ObjectIdHex(notebookId)}
|
"NotebookId": bson.ObjectIdHex(notebookId)}
|
||||||
data := bson.M{"IsBlog": isBlog}
|
data := bson.M{"IsBlog": isBlog}
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-3">
|
<div class="col-sm-4">
|
||||||
<section class="panel panel-default">
|
<section class="panel panel-default">
|
||||||
<header class="panel-heading">
|
<header class="panel-heading">
|
||||||
模板, 样式, 脚本:
|
模板, 样式, 脚本:
|
||||||
@ -62,7 +62,7 @@
|
|||||||
</footer>
|
</footer>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-8">
|
||||||
<section class="panel panel-default">
|
<section class="panel panel-default">
|
||||||
<header class="panel-heading">
|
<header class="panel-heading">
|
||||||
当前文件: <span id="curTpl">header.html</span>
|
当前文件: <span id="curTpl">header.html</span>
|
||||||
@ -118,7 +118,7 @@ var theme = {
|
|||||||
saveBtnO: $("#saveBtn"),
|
saveBtnO: $("#saveBtn"),
|
||||||
newFileO: $("#newFile"),
|
newFileO: $("#newFile"),
|
||||||
curTpl: "",
|
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() {
|
init: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
self.showTplInfo();
|
self.showTplInfo();
|
||||||
@ -150,15 +150,15 @@ var theme = {
|
|||||||
var file = $a.data('file');
|
var file = $a.data('file');
|
||||||
art.confirm("Are you sure to delete " + file + " ?", function() {
|
art.confirm("Are you sure to delete " + file + " ?", function() {
|
||||||
ajaxPost("/member/blog/deleteTpl", {themeId: themeId, filename: file}, function(re) {
|
ajaxPost("/member/blog/deleteTpl", {themeId: themeId, filename: file}, function(re) {
|
||||||
if(reIsOk(re)) {
|
// if(reIsOk(re)) {
|
||||||
art.tips("Success");
|
art.tips("Success");
|
||||||
$a.remove();
|
$a.remove();
|
||||||
if(self.curTpl == file) {
|
if(self.curTpl == file) {
|
||||||
$(".file-list a").eq(0).trigger("click");
|
$(".file-list a").eq(0).trigger("click");
|
||||||
}
|
}
|
||||||
} else {
|
//} else {
|
||||||
art.alert(re.Msg);
|
// art.alert(re.Msg);
|
||||||
}
|
//}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
mongodb_backup/leanote_install_data/tag_count.bson
Normal file
BIN
mongodb_backup/leanote_install_data/tag_count.bson
Normal file
Binary file not shown.
@ -0,0 +1 @@
|
|||||||
|
{ "indexes" : [ { "v" : 1, "key" : { "_id" : 1 }, "ns" : "leanote_beta2.tag_count", "name" : "_id_" } ] }
|
Binary file not shown.
Binary file not shown.
@ -7,9 +7,23 @@
|
|||||||
<li><a href="{{$.indexUrl}}">主页</a></li>
|
<li><a href="{{$.indexUrl}}">主页</a></li>
|
||||||
{{range $.cates}}
|
{{range $.cates}}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{$.cateUrl}}/{{.CateId}}">{{.Title}}</a>
|
<a href="{{$.cateUrl}}/{{.UrlTitle}}">{{.Title}}</a>
|
||||||
</li>
|
</li>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
<!-- 单页 -->
|
||||||
|
{{range $.singles}}
|
||||||
|
<li class="{{if eq $.curSingleId .SingleId}}active{{end}}">
|
||||||
|
<a href="{{$.singleUrl}}/{{.UrlTitle}}">{{.Title}}</a>
|
||||||
|
</li>
|
||||||
|
{{end}}
|
||||||
|
|
||||||
|
<!-- 归档 -->
|
||||||
|
<li class="{{if $.curIsArchive}}active{{end}}">
|
||||||
|
<a href="{{$.archiveUrl}}">归档</a>
|
||||||
|
</li>
|
||||||
|
<li class="{{if $.curIsTags}}active{{end}}">
|
||||||
|
<a href="{{$.tagsUrl}}">标签</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
|
@ -7,9 +7,23 @@
|
|||||||
<li><a href="{{$.indexUrl}}">主页</a></li>
|
<li><a href="{{$.indexUrl}}">主页</a></li>
|
||||||
{{range $.cates}}
|
{{range $.cates}}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{$.cateUrl}}/{{.CateId}}">{{.Title}}</a>
|
<a href="{{$.cateUrl}}/{{.UrlTitle}}">{{.Title}}</a>
|
||||||
</li>
|
</li>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
<!-- 单页 -->
|
||||||
|
{{range $.singles}}
|
||||||
|
<li class="{{if eq $.curSingleId .SingleId}}active{{end}}">
|
||||||
|
<a href="{{$.singleUrl}}/{{.UrlTitle}}">{{.Title}}</a>
|
||||||
|
</li>
|
||||||
|
{{end}}
|
||||||
|
|
||||||
|
<!-- 归档 -->
|
||||||
|
<li class="{{if $.curIsArchive}}active{{end}}">
|
||||||
|
<a href="{{$.archiveUrl}}">归档</a>
|
||||||
|
</li>
|
||||||
|
<li class="{{if $.curIsTags}}active{{end}}">
|
||||||
|
<a href="{{$.tagsUrl}}">标签</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
"Name": "leanote-elegant",
|
"Name": "leanote elegant",
|
||||||
"Version": "1.0",
|
"Version": "1.0",
|
||||||
"Author": "leanote.com",
|
"Author": "leanote.com",
|
||||||
"AuthorUrl": "http://leanote.com",
|
"AuthorUrl": "http://leanote.com",
|
||||||
|
@ -7,9 +7,23 @@
|
|||||||
<li><a href="{{$.indexUrl}}">主页</a></li>
|
<li><a href="{{$.indexUrl}}">主页</a></li>
|
||||||
{{range $.cates}}
|
{{range $.cates}}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{$.cateUrl}}/{{.CateId}}">{{.Title}}</a>
|
<a href="{{$.cateUrl}}/{{.UrlTitle}}">{{.Title}}</a>
|
||||||
</li>
|
</li>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
<!-- 单页 -->
|
||||||
|
{{range $.singles}}
|
||||||
|
<li class="{{if eq $.curSingleId .SingleId}}active{{end}}">
|
||||||
|
<a href="{{$.singleUrl}}/{{.UrlTitle}}">{{.Title}}</a>
|
||||||
|
</li>
|
||||||
|
{{end}}
|
||||||
|
|
||||||
|
<!-- 归档 -->
|
||||||
|
<li class="{{if $.curIsArchive}}active{{end}}">
|
||||||
|
<a href="{{$.archiveUrl}}">归档</a>
|
||||||
|
</li>
|
||||||
|
<li class="{{if $.curIsTags}}active{{end}}">
|
||||||
|
<a href="{{$.tagsUrl}}">标签</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
"Name": "leanote default theme",
|
"Name": "leanote nav fixed",
|
||||||
"Version": "1.0",
|
"Version": "1.0",
|
||||||
"Author": "leanote.com",
|
"Author": "leanote.com",
|
||||||
"AuthorUrl": "http://leanote.com",
|
"AuthorUrl": "http://leanote.com",
|
||||||
|
@ -1,142 +0,0 @@
|
|||||||
{{template "header.html" .}}
|
|
||||||
|
|
||||||
<div id="postsContainer">
|
|
||||||
<div id="posts">
|
|
||||||
<div class="each-post">
|
|
||||||
<div class="title">
|
|
||||||
{{.post.Title}}
|
|
||||||
</div>
|
|
||||||
<div class="created-time">
|
|
||||||
<i class="fa fa-bookmark-o"></i>
|
|
||||||
{{if .post.Tags}}
|
|
||||||
{{blogTags $ .post.Tags}}
|
|
||||||
{{else}}
|
|
||||||
{{msg . "noTag"}}
|
|
||||||
{{end}}
|
|
||||||
|
|
|
||||||
<i class="fa fa-calendar"></i> {{msg . "updatedTime"}} {{$.post.UpdatedTime | datetime}}
|
|
||||||
|
|
|
||||||
<i class="fa fa-calendar"></i> {{msg . "createdTime"}} {{$.post.CreatedTime | datetime}}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 仅为移动端 -->
|
|
||||||
<div class="mobile-created-time">
|
|
||||||
{{ if $.blogInfo.UserLogo}}
|
|
||||||
<img src="{{$.blogInfo.UserLogo}}" id="userLogo">
|
|
||||||
{{else}}
|
|
||||||
<img src="{{$.siteUrl}}/images/blog/default_avatar.png" id="userLogo">
|
|
||||||
{{end}}
|
|
||||||
{{$.blogInfo.Username}}
|
|
||||||
|
|
||||||
{{if .post.Tags}}
|
|
||||||
|
|
||||||
<i class="fa fa-bookmark-o" style="color: #666"></i>
|
|
||||||
{{blogTags $ $.post.Tags}}
|
|
||||||
{{end}}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="desc" id="content">
|
|
||||||
{{if $.post.IsMarkdown }}
|
|
||||||
<div id="markdownContent" style="display: none">
|
|
||||||
<!-- 用textarea装html, 防止得到的值失真 -->
|
|
||||||
<textarea>{{$.post.Content | raw}}</textarea>
|
|
||||||
</div>
|
|
||||||
<div style="padding: 20px; text-align: center">
|
|
||||||
<img src="{{$.themeBaseUrl}}/images/loading-32.gif" />
|
|
||||||
</div>
|
|
||||||
{{else}}
|
|
||||||
{{$.post.Content | raw}}
|
|
||||||
{{end}}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="pre-next-post">
|
|
||||||
<p>
|
|
||||||
上一篇: {{if $.prePost}}<a href="{{$.viewUrl}}/{{$.prePost.NoteId}}">{{$.prePost.Title}}</a>{{else}}无{{end}}
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
下一篇: {{if $.nextPost}}<a href="{{$.viewUrl}}/{{$.nextPost.NoteId}}">{{$.nextPost.Title}}</a>{{else}}无{{end}}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- share & comment -->
|
|
||||||
{{template "comment.html" $}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{template "footer.html" .}}
|
|
||||||
{{template "highlight.html"}}
|
|
||||||
|
|
||||||
<div id="blogNav">
|
|
||||||
<div id="blogNavNav">
|
|
||||||
<i class="fa fa-align-justify" title="文档导航"></i>
|
|
||||||
<span>文档导航</span>
|
|
||||||
</div>
|
|
||||||
<div id="blogNavContent">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 一些在share_comment.js 需要使用的变量 -->
|
|
||||||
<script>
|
|
||||||
var siteUrl = "{{$.siteUrl}}"; // common.js需要
|
|
||||||
// 以下 share_comment.js需要
|
|
||||||
var blogInfo={UserId: "{{$.blogInfo.UserId}}", OpenComment: {{$.blogInfo.OpenComment}}, CommentType: "{{$.blogInfo.CommentType}}"};
|
|
||||||
var noteId = "{{$.post.NoteId}}"; //
|
|
||||||
var preLikeNum = +"{{$.post.LikeNum}}";
|
|
||||||
var commentNum = +"{{$.post.CommentNum}}";
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<!-- 一些公用的js -->
|
|
||||||
<script src="{{$.leanoteUrl}}/public/blog/js/common.js"></script>
|
|
||||||
<script src="{{$.leanoteUrl}}/public/blog/js/jsrender.js"></script>
|
|
||||||
<script src="{{$.leanoteUrl}}/public/blog/js/jquery-cookie-min.js"></script>
|
|
||||||
<script src="{{$.leanoteUrl}}/public/blog/js/bootstrap-dialog.min.js"></script>
|
|
||||||
<script src="{{$.leanoteUrl}}/public/blog/js/jquery.qrcode.min.js"></script>
|
|
||||||
|
|
||||||
<!-- share && comment -->
|
|
||||||
<script src="{{$.themeBaseUrl}}/share_comment.js"></script>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
markdown
|
|
||||||
调用markdown来解析得到html
|
|
||||||
-->
|
|
||||||
|
|
||||||
{{if $.post.IsMarkdown }}
|
|
||||||
<script src="/public/mdeditor/editor/pagedown/Markdown.Converter.js"></script>
|
|
||||||
<script src="/public/mdeditor/editor/pagedown/Markdown.Sanitizer.js"></script>
|
|
||||||
<script src="/public/mdeditor/editor/pagedown/Markdown.Editor.js"></script>
|
|
||||||
<script src="/public/mdeditor/editor/pagedown/local/Markdown.local.zh.js"></script>
|
|
||||||
<script src="/public/mdeditor/editor/Markdown.Extra.js"></script>
|
|
||||||
|
|
||||||
<!--mathjax-->
|
|
||||||
<script type="text/x-mathjax-config">
|
|
||||||
MathJax.Hub.Config({ tex2jax: { inlineMath: [['$','$'], ["\\(","\\)"]], processEscapes: true }, messageStyle: "none"});
|
|
||||||
</script>
|
|
||||||
<script src="/public/mdeditor/editor/mathJax.js"></script>
|
|
||||||
<script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
|
|
||||||
<script>
|
|
||||||
var content = $.trim($("#markdownContent textarea").val());
|
|
||||||
var converter = Markdown.getSanitizingConverter();
|
|
||||||
Markdown.Extra.init(converter, {extensions: ["tables", "fenced_code_gfm", "def_list"]});
|
|
||||||
var html = converter.makeHtml(content);
|
|
||||||
$("#content").html(html);
|
|
||||||
$("pre").addClass("prettyprint linenums");
|
|
||||||
prettyPrint();
|
|
||||||
MathJax.Hub.Queue(["Typeset",MathJax.Hub,"wmd-preview"]);
|
|
||||||
|
|
||||||
initNav();
|
|
||||||
weixin();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<!-- 不是markdown -->
|
|
||||||
{{else}}
|
|
||||||
<script>
|
|
||||||
$(function() {
|
|
||||||
initNav();
|
|
||||||
weixin();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
{{end}}
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Reference in New Issue
Block a user