mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-09-18 17:48:00 +08:00
1、实现文章阅读、附件功能
2、实现与关联项目同步功能 3、实现附件删除功能
This commit is contained in:
@@ -1 +1,144 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta name="author" content="Minho" />
|
||||
<meta name="site" content="https://www.iminho.me" />
|
||||
<meta name="keywords" content="{{.Model.BlogTitle}}">
|
||||
<meta name="description" content="{{.Model.BlogExcerpt}}">
|
||||
<title>{{.Model.BlogTitle}} - Powered by MinDoc</title>
|
||||
|
||||
<!-- Bootstrap -->
|
||||
<link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet">
|
||||
|
||||
<link href="{{cdncss "/static/jstree/3.3.4/themes/default/style.min.css"}}" rel="stylesheet">
|
||||
<link href="{{cdncss "/static/font-awesome/css/font-awesome.min.css"}}" rel="stylesheet">
|
||||
<link href="{{cdncss "/static/nprogress/nprogress.css"}}" rel="stylesheet">
|
||||
<link href="{{cdncss "/static/css/kancloud.css"}}?_=1531286622" rel="stylesheet">
|
||||
<link href="{{cdncss "/static/css/jstree.css"}}" rel="stylesheet">
|
||||
<link href="{{cdncss "/static/editor.md/css/editormd.preview.css"}}" rel="stylesheet">
|
||||
<link href="{{cdncss "/static/prettify/themes/prettify.css"}}" rel="stylesheet">
|
||||
<link href="{{cdncss "/static/css/markdown.preview.css?_=1531286622"}}" rel="stylesheet">
|
||||
<link href="{{cdncss "/static/highlight/styles/vs.css"}}" rel="stylesheet">
|
||||
<link href="{{cdncss "/static/katex/katex.min.css"}}" rel="stylesheet">
|
||||
<link href="{{cdncss "/static/css/print.css"}}" media="print" rel="stylesheet">
|
||||
|
||||
<link href="{{cdncss "/static/css/main.css"}}" rel="stylesheet">
|
||||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="/static/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||||
<script src="/static/respond.js/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<style type="text/css">
|
||||
.header{
|
||||
min-height: 1rem;
|
||||
font-size: 26px;
|
||||
font-weight: 400;
|
||||
display: block;
|
||||
margin: 20px auto;
|
||||
}
|
||||
.blog-meta{
|
||||
display: inline-block;
|
||||
}
|
||||
.blog-meta>.item{
|
||||
display: inline-block;
|
||||
color: #666666;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.blog-footer{
|
||||
margin: 25px auto;
|
||||
/*border-top: 1px solid #E5E5E5;*/
|
||||
padding: 20px 1px;
|
||||
line-height: 35px;
|
||||
}
|
||||
.blog-footer span{
|
||||
margin-right: 8px;
|
||||
padding: 6px 8px;
|
||||
font-size: 12px;
|
||||
border: 1px solid #e3e3e3;
|
||||
color: #4d4d4d
|
||||
}
|
||||
.blog-footer a:hover{
|
||||
color: #ca0c16;
|
||||
}
|
||||
.footer{
|
||||
margin-top: 0;
|
||||
}
|
||||
.user_img img {
|
||||
display: block;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
border-radius: 50%;
|
||||
-o-object-fit: cover;
|
||||
object-fit: cover;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="manual-reader manual-container manual-search-reader">
|
||||
{{template "widgets/header.tpl" .}}
|
||||
<div class="container manual-body">
|
||||
<div class="search-head" style="border-bottom-width: 1px;">
|
||||
<h1 class="header">
|
||||
{{.Model.BlogTitle}}
|
||||
</h1>
|
||||
<div class="blog-meta">
|
||||
<div class="item user_img"><img src="{{.Model.MemberAvatar}}" align="{{.Model.CreateName}}"> </div>
|
||||
<div class="item"> {{.Model.CreateName}}</div>
|
||||
<div class="item">发布于</div>
|
||||
<div class="item">{{date .Model.Created "Y-m-d H:i:s"}}</div>
|
||||
<div class="item">{{.Model.ModifyRealName}}</div>
|
||||
<div class="item">修改于</div>
|
||||
<div class="item">{{date .Model.Modified "Y-m-d H:i:s"}}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="article-body markdown-body editormd-preview-container content">
|
||||
{{.Content}}
|
||||
{{if .Model.AttachList}}
|
||||
<div class="attach-list"><strong>附件</strong><ul>
|
||||
{{range $index,$item := .Model.AttachList}}
|
||||
<li><a href="{{$item.HttpPath}}" title="{{$item.FileName}}">{{$item.FileName}}</a> </li>
|
||||
{{end}}
|
||||
</ul>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row blog-footer">
|
||||
<p>
|
||||
<span>上一篇</span>
|
||||
{{if .Previous}}
|
||||
<a href="{{urlfor "BlogController.Index" ":id" .Previous.BlogId}}" title="{{.Previous.BlogTitle}}">{{.Previous.BlogTitle}}
|
||||
</a>
|
||||
{{else}}
|
||||
无
|
||||
{{end}}
|
||||
</p>
|
||||
<p>
|
||||
<span>下一篇</span>
|
||||
{{if .Next}}
|
||||
<a href="{{urlfor "BlogController.Index" ":id" .Next.BlogId}}" title="{{.Next.BlogTitle}}">{{.Next.BlogTitle}}</a>
|
||||
{{else}}
|
||||
无
|
||||
{{end}}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{{template "widgets/footer.tpl" .}}
|
||||
</div>
|
||||
<script src="{{cdnjs "/static/jquery/1.12.4/jquery.min.js"}}"></script>
|
||||
<script src="{{cdnjs "/static/bootstrap/js/bootstrap.min.js"}}"></script>
|
||||
<script src="{{cdnjs "/static/js/jquery.form.js"}}" type="text/javascript"></script>
|
||||
<script src="{{cdnjs "/static/layer/layer.js"}}" type="text/javascript"></script>
|
||||
<script src="{{cdnjs "/static/highlight/highlight.js"}}" type="text/javascript"></script>
|
||||
<script src="{{cdnjs "/static/highlight/highlightjs-line-numbers.min.js"}}" type="text/javascript"></script>
|
||||
<script src="{{cdnjs "/static/js/jquery.highlight.js"}}" type="text/javascript"></script>
|
||||
<script src="{{cdnjs "/static/js/kancloud.js"}}" type="text/javascript"></script>
|
||||
<script src="{{cdnjs "/static/js/splitbar.js"}}" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
138
views/blog/index_password.tpl
Normal file
138
views/blog/index_password.tpl
Normal file
@@ -0,0 +1,138 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-cn">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="shortcut icon" href="{{cdnimg "favicon.ico"}}">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
<meta name="renderer" content="webkit" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>请输入文章密码 - Powered by MinDoc</title>
|
||||
<script src="{{cdnjs "static/jquery/1.12.4/jquery.min.js"}}"></script>
|
||||
<script src="{{cdnjs "static/js/jquery.form.js"}}"></script>
|
||||
<style type="text/css">
|
||||
body{ background: #f2f2f2;}
|
||||
.d_button{ cursor: pointer;}
|
||||
@media(min-width : 450px){
|
||||
.auth_form{
|
||||
width: 400px;
|
||||
border: 1px solid #ccc;
|
||||
background-color: #fff;
|
||||
position: absolute;
|
||||
top: 20%;
|
||||
left: 50%;
|
||||
margin-left: -220px;
|
||||
padding: 20px;
|
||||
}
|
||||
.tit{
|
||||
font-size: 18px;
|
||||
}
|
||||
.inp{
|
||||
height: 30px;
|
||||
width: 387px;
|
||||
font-size: 14px;
|
||||
padding: 5px;
|
||||
}
|
||||
.btn{
|
||||
margin-top: 10px;
|
||||
float: right;
|
||||
}
|
||||
}
|
||||
@media(max-width : 449px){
|
||||
body{
|
||||
margin: 0 auto;
|
||||
}
|
||||
.auth_form{
|
||||
background-color: #fff;
|
||||
border-top: 1px solid #ccc;
|
||||
border-bottom: 1px solid #ccc;
|
||||
width: 100%;
|
||||
margin-top: 40px;
|
||||
}
|
||||
.shell{
|
||||
width: 90%;
|
||||
margin: 10px auto;
|
||||
}
|
||||
.tit{
|
||||
font-size: 18px;
|
||||
}
|
||||
.inp{
|
||||
height: 30px;
|
||||
width: 96.5%;
|
||||
font-size: 14px;
|
||||
padding: 5px;
|
||||
}
|
||||
.btn{
|
||||
margin-top: 10px;
|
||||
float: right;
|
||||
}
|
||||
}
|
||||
.clear{
|
||||
clear: both;
|
||||
}
|
||||
.button {
|
||||
color: #fff;
|
||||
background-color: #428bca;
|
||||
border-radius: 4px;
|
||||
display: inline-block;
|
||||
padding: 6px 12px;
|
||||
margin-bottom: 0;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
line-height: 1.42857143;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
vertical-align: middle;
|
||||
-ms-touch-action: manipulation;
|
||||
touch-action: manipulation;
|
||||
cursor: pointer;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
border: 1px solid #357ebd;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="auth_form">
|
||||
<div class="shell">
|
||||
<form action="{{urlfor "BlogController.Index" ":id" .Model.BlogId}}" method="post" id="auth_form">
|
||||
<input type="hidden" value="{{.Model.BlogId}}" name="blogId" />
|
||||
<div class="tit">
|
||||
请输入浏览密码
|
||||
</div>
|
||||
<div style="margin-top: 10px;">
|
||||
<input type="password" name="password" placeholder="浏览密码" class="inp"/>
|
||||
</div>
|
||||
<div class="btn">
|
||||
<span id="error" style="color: #919191; font-size: 13px;"></span>
|
||||
<input type="submit" value="提交" class="button"/>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$("#auth_form").ajaxForm({
|
||||
beforeSerialize: function () {
|
||||
var pwd = $("#auth_form input[name='password']").val();
|
||||
if (pwd === "") {
|
||||
$("#error").html("请输入密码");
|
||||
return false;
|
||||
}
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if (res.errcode === 0) {
|
||||
window.location.reload();
|
||||
} else {
|
||||
$("#auth_form input[name='password']").val("").focus();
|
||||
$("#error").html(res.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script src="{{cdnjs "static/bootstrap/js/bootstrap.min.js"}}"></script>
|
||||
</body>
|
||||
</html>
|
@@ -0,0 +1,67 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<title>文章列表 - Powered by MinDoc</title>
|
||||
|
||||
<!-- Bootstrap -->
|
||||
<link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet">
|
||||
<link href="{{cdncss "/static/font-awesome/css/font-awesome.min.css"}}" rel="stylesheet">
|
||||
|
||||
<link href="{{cdncss "/static/css/main.css"}}" rel="stylesheet">
|
||||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="/static/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||||
<script src="/static/respond.js/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<style type="text/css">
|
||||
.footer{margin-top: 0;}
|
||||
.label {
|
||||
background-color: #00b5ad!important;
|
||||
border-color: #00b5ad!important;
|
||||
color: #fff!important;
|
||||
font-weight: 400;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="manual-reader manual-container manual-search-reader">
|
||||
{{template "widgets/header.tpl" .}}
|
||||
<div class="container manual-body">
|
||||
<div class="row">
|
||||
<div class="manual-list">
|
||||
{{range $index,$item := .Lists}}
|
||||
<div class="search-item">
|
||||
<div class="title">{{if eq $item.BlogStatus "password"}}<span class="label">密</span>{{end}} <a href="{{urlfor "BlogController.Index" ":id" $item.BlogId}}" title="{{$item.BlogTitle}}" target="_blank">{{$item.BlogTitle}}</a> </div>
|
||||
<div class="description">
|
||||
{{$item.BlogExcerpt}}
|
||||
</div>
|
||||
{{/*<div class="site">{{urlfor "BlogController.Index" ":id" $item.BlogId}}</div>*/}}
|
||||
<div class="source">
|
||||
<span class="item">作者:{{$item.CreateName}}</span>
|
||||
<span class="item">更新时间:{{date_format $item.Modified "2006-01-02 15:04:05"}}</span>
|
||||
</div>
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="search-empty">
|
||||
<img src="{{cdnimg "/static/images/search_empty.png"}}" class="empty-image">
|
||||
<span class="empty-text">暂无文章</span>
|
||||
</div>
|
||||
{{end}}
|
||||
<nav class="pagination-container">
|
||||
{{.PageHtml}}
|
||||
</nav>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{template "widgets/footer.tpl" .}}
|
||||
</div>
|
||||
<script src="{{cdnjs "/static/jquery/1.12.4/jquery.min.js"}}"></script>
|
||||
<script src="{{cdnjs "/static/bootstrap/js/bootstrap.min.js"}}"></script>
|
||||
</body>
|
||||
</html>
|
@@ -14,7 +14,7 @@
|
||||
window.fileUploadURL = "";
|
||||
window.blogId = {{.Model.BlogId}};
|
||||
window.blogVersion = {{.Model.Version}};
|
||||
window.removeAttachURL = "{{urlfor "DocumentController.RemoveAttachment"}}";
|
||||
window.removeAttachURL = "{{urlfor "BlogController.RemoveAttachment" ":id" .Model.BlogId}}";
|
||||
</script>
|
||||
<!-- Bootstrap -->
|
||||
<link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet">
|
||||
@@ -223,7 +223,7 @@
|
||||
<script src="{{cdnjs "/static/js/blog.js"}}" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
|
||||
window.vueApp.lists = {{.AttachList}};
|
||||
$("#attachInfo").on("click",function () {
|
||||
$("#uploadAttachModal").modal("show");
|
||||
});
|
||||
|
@@ -57,7 +57,7 @@
|
||||
<div>
|
||||
<div class="ui horizontal small list">
|
||||
<div class="item"><i class="fa fa-clock-o"></i> {{date $item.Modified "Y-m-d H:i:s"}}</div>
|
||||
<div class="item"><a href="{{urlfor "BlogController.ManageEdit" ":id" $item.BlogId}}" title="文章编辑"><i class="fa fa-edit"></i> 编辑</a></div>
|
||||
<div class="item"><a href="{{urlfor "BlogController.ManageEdit" ":id" $item.BlogId}}" title="文章编辑" target="_blank"><i class="fa fa-edit"></i> 编辑</a></div>
|
||||
<div class="item"><a class="delete-btn" title="删除文章" data-id="{{$item.BlogId}}"><i class="fa fa-trash"></i> 删除</a></div>
|
||||
<div class="item"><a href="{{urlfor "BlogController.ManageSetting" ":id" $item.BlogId}}" title="文章设置" class="setting-btn"><i class="fa fa-gear"></i> 设置</a></div>
|
||||
</div>
|
||||
|
@@ -39,6 +39,8 @@
|
||||
<form method="post" id="gloablEditForm" action="{{urlfor "BlogController.ManageSetting"}}">
|
||||
<input type="hidden" name="id" id="blogId" value="{{.Model.BlogId}}">
|
||||
<input type="hidden" name="identify" value="{{.Model.BlogIdentify}}">
|
||||
<input type="hidden" name="document_id" value="{{.Model.DocumentId}}">
|
||||
<input type="hidden" name="order_index" value="{{.Model.OrderIndex}}">
|
||||
<div class="form-group">
|
||||
<label>文章标题</label>
|
||||
<input type="text" class="form-control" name="title" id="title" placeholder="文章标题" value="{{.Model.BlogTitle}}">
|
||||
@@ -60,12 +62,13 @@
|
||||
<label>关联文档</label>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<input type="text" class="form-control" placeholder="请选择项目">
|
||||
<input type="text" class="form-control" placeholder="请输入项目标识" name="bookIdentify" value="{{.Model.BookIdentify}}">
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" class="form-control" placeholder="请选择文档">
|
||||
<input type="text" class="form-control" placeholder="请输入文档标识" name="documentIdentify" value="{{.Model.DocumentIdentify}}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>文章状态</label>
|
||||
|
@@ -28,16 +28,17 @@
|
||||
<strong class="search-title">显示标签列表</strong>
|
||||
</div>
|
||||
<div class="row">
|
||||
{{if gt (.Labels|len) 0}}
|
||||
|
||||
<div class="hide tag-container-outer" style="border: 0;margin-top: 0;padding: 5px 15px;min-height: 200px;">
|
||||
<span class="tags">
|
||||
{{range $index,$item := .Labels}}
|
||||
<a href="{{urlfor "LabelController.Index" ":key" $item.LabelName}}">{{$item.LabelName}}<span class="detail">{{$item.BookNumber}}</span></a>
|
||||
{{else}}
|
||||
<div class="text-center">暂无标签</div>
|
||||
{{end}}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{{end}}
|
||||
<nav class="pagination-container">
|
||||
{{if gt .TotalPages 1}}
|
||||
{{.PageHtml}}
|
||||
|
@@ -34,7 +34,6 @@
|
||||
<div class="description">
|
||||
{{str2html $item.Description}}
|
||||
</div>
|
||||
<div class="site">{{$.BaseUrl}}{{urlfor "DocumentController.Read" ":key" $item.BookIdentify ":id" $item.Identify}}</div>
|
||||
<div class="source">
|
||||
<span class="item">来自:<a href="{{urlfor "DocumentController.Index" ":key" $item.BookIdentify}}" target="_blank">{{$item.BookName}}</a></span>
|
||||
<span class="item">作者:{{$item.Author}}</span>
|
||||
|
@@ -13,7 +13,7 @@
|
||||
<li {{if eq .ControllerName "HomeController"}}class="active"{{end}}>
|
||||
<a href="{{urlfor "HomeController.Index" }}" title="首页">首页</a>
|
||||
</li>
|
||||
<li {{if eq .ControllerName "BlogController"}}{{if eq .ActionName "List"}}class="active"{{end}}{{end}}>
|
||||
<li {{if eq .ControllerName "BlogController"}}{{if eq .ActionName "List" "Index"}}class="active"{{end}}{{end}}>
|
||||
<a href="{{urlfor "BlogController.List" }}" title="文章">文章</a>
|
||||
</li>
|
||||
<li {{if eq .ControllerName "LabelController"}}class="active"{{end}}>
|
||||
|
Reference in New Issue
Block a user