优化了一些细节
This commit is contained in:
parent
79f64bb91c
commit
460327492c
10
CHANGES.md
10
CHANGES.md
@ -1,5 +1,15 @@
|
|||||||
## 版本更新记录
|
## 版本更新记录
|
||||||
|
|
||||||
|
### v0.2.9 2020-02-17
|
||||||
|
|
||||||
|
- 优化文本编辑器排版
|
||||||
|
- 优化文档发布成功时候的跳转路径
|
||||||
|
- 优化编辑器预览的样式
|
||||||
|
- 添加页脚信息
|
||||||
|
- 优化文档修改页面排版
|
||||||
|
- 添加文档编辑页面中文集的权限显示
|
||||||
|
|
||||||
|
|
||||||
### v0.2.8 2020-01-15
|
### v0.2.8 2020-01-15
|
||||||
|
|
||||||
- 文档页添加上一篇文档和下一篇文档链接;
|
- 文档页添加上一篇文档和下一篇文档链接;
|
||||||
|
|||||||
@ -25,7 +25,7 @@ SECRET_KEY = '5&71mt9@^58zdg*_!t(x6g14q*@84d%ptr%%s6e0l50zs0we3d'
|
|||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
|
|
||||||
VERSIONS = '0.2.8'
|
VERSIONS = '0.2.9'
|
||||||
|
|
||||||
ALLOWED_HOSTS = ['*']
|
ALLOWED_HOSTS = ['*']
|
||||||
|
|
||||||
|
|||||||
@ -309,7 +309,7 @@ def create_doc(request):
|
|||||||
create_user=request.user,
|
create_user=request.user,
|
||||||
status = status
|
status = status
|
||||||
)
|
)
|
||||||
return JsonResponse({'status':True,'data':doc.id})
|
return JsonResponse({'status':True,'data':{'pro':project,'doc':doc.id}})
|
||||||
else:
|
else:
|
||||||
return JsonResponse({'status':False,'data':'参数错误'})
|
return JsonResponse({'status':False,'data':'参数错误'})
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
4
static/jquery/3.1.1/jquery.min.js
vendored
Normal file
4
static/jquery/3.1.1/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -13,12 +13,24 @@
|
|||||||
<link rel="stylesheet" href="{% static 'editor.md/css/editormd.css' %}" />
|
<link rel="stylesheet" href="{% static 'editor.md/css/editormd.css' %}" />
|
||||||
<link href="{% static 'mrdoc.css' %}?version={{mrdoc_version}}" rel="stylesheet">
|
<link href="{% static 'mrdoc.css' %}?version={{mrdoc_version}}" rel="stylesheet">
|
||||||
<link rel="icon" href="{% static 'favicon_16.png' %}"/>
|
<link rel="icon" href="{% static 'favicon_16.png' %}"/>
|
||||||
|
<style>
|
||||||
|
.markdown-body ul li{
|
||||||
|
list-style:disc;
|
||||||
|
}
|
||||||
|
.markdown-body ul > li > ul > li{
|
||||||
|
list-style-type: circle;
|
||||||
|
}
|
||||||
|
.markdown-body ol li{
|
||||||
|
list-style-type: decimal;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<!--[if lt IE 9]>
|
<!--[if lt IE 9]>
|
||||||
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
|
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
|
||||||
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
|
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
{% block custom_style %}{% endblock %}
|
{% block custom_style %}{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body class="layui-container">
|
<body class="layui-container">
|
||||||
<!-- 页头 -->
|
<!-- 页头 -->
|
||||||
@ -54,7 +66,7 @@
|
|||||||
"h1", "h2", "h3", "h4", "h5", "h6", "|",
|
"h1", "h2", "h3", "h4", "h5", "h6", "|",
|
||||||
"list-ul", "list-ol", "hr", "|",
|
"list-ul", "list-ol", "hr", "|",
|
||||||
"link", "reference-link", "image", "code", "preformatted-text", "code-block", "table", "datetime", "emoji", "html-entities", "pagebreak", "|",
|
"link", "reference-link", "image", "code", "preformatted-text", "code-block", "table", "datetime", "emoji", "html-entities", "pagebreak", "|",
|
||||||
"watch", "preview", "clear", "search", "|",
|
"watch", "preview", "|",
|
||||||
"help"
|
"help"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -102,6 +114,7 @@
|
|||||||
//未保存离开提示
|
//未保存离开提示
|
||||||
window.onbeforeunload =function() {
|
window.onbeforeunload =function() {
|
||||||
if(md_changed){
|
if(md_changed){
|
||||||
|
//console.log("页面未保存数据")
|
||||||
return 1;
|
return 1;
|
||||||
}else{
|
}else{
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@ -15,7 +15,6 @@
|
|||||||
</div><br>
|
</div><br>
|
||||||
|
|
||||||
<div class="layui-row">
|
<div class="layui-row">
|
||||||
|
|
||||||
<div class="layui-col-md4 layui-col-sm6 " style="padding-bottom:10px;">
|
<div class="layui-col-md4 layui-col-sm6 " style="padding-bottom:10px;">
|
||||||
<label class="doc-form-label"><i class="fa fa-file-text"></i> 所属文集</label>
|
<label class="doc-form-label"><i class="fa fa-file-text"></i> 所属文集</label>
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
@ -23,7 +22,15 @@
|
|||||||
<option value=""></option>
|
<option value=""></option>
|
||||||
<option value="-1">新建文集</option>
|
<option value="-1">新建文集</option>
|
||||||
{% for p in project_list %}
|
{% for p in project_list %}
|
||||||
<option value="{{ p.id }}">《{{ p.name }}》</option>
|
{% if p.role == 1 %}
|
||||||
|
<option value="{{ p.id }}">[私密]《{{ p.name }}》</option>
|
||||||
|
{% elif p.role == 2 %}
|
||||||
|
<option value="{{ p.id }}">[指定用户]《{{ p.name }}》</option>
|
||||||
|
{% elif p.role == 3 %}
|
||||||
|
<option value="{{ p.id }}">[访问码]《{{ p.name }}》</option>
|
||||||
|
{% else %}
|
||||||
|
<option value="{{ p.id }}">[公开]《{{ p.name }}》</option>
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -146,12 +153,16 @@
|
|||||||
$.post("{% url 'create_doc' %}",data,function(r){
|
$.post("{% url 'create_doc' %}",data,function(r){
|
||||||
if(r.status){
|
if(r.status){
|
||||||
//创建成功
|
//创建成功
|
||||||
layer.msg('发布成功',function(){
|
layer.msg('发布文档成功,即将跳转到文档页面',function(){
|
||||||
window.location.href = "{% url 'pro_list' %}";
|
md_changed = false;
|
||||||
|
//跳转到首页
|
||||||
|
//window.location.href = "{% url 'pro_list' %}";
|
||||||
|
//跳转到发布的文档
|
||||||
|
window.location.href = "/project/" + r.data.pro + "/" + r.data.doc
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
//创建失败
|
//创建失败
|
||||||
layer.msg('保存失败:'+r.data);
|
layer.msg('发布文档失败:'+r.data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -178,12 +189,12 @@
|
|||||||
$.post("{% url 'create_doc' %}",data,function(r){
|
$.post("{% url 'create_doc' %}",data,function(r){
|
||||||
if(r.status){
|
if(r.status){
|
||||||
//创建成功
|
//创建成功
|
||||||
layer.msg('保存成功',function(){
|
layer.msg('保存草稿成功',function(){
|
||||||
window.location.href = "/modify_doc/"+r.data+"/";
|
window.location.href = "/modify_doc/"+r.data+"/";
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
//创建失败
|
//创建失败
|
||||||
layer.msg('保存失败:'+r.data);
|
layer.msg('保存草稿失败:'+r.data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,8 @@
|
|||||||
<!-- 引入静态文件 -->
|
<!-- 引入静态文件 -->
|
||||||
{% load staticfiles %}
|
{% load staticfiles %}
|
||||||
|
|
||||||
|
{% block keyword %}{{ doc.name }},{{ project.name }},{% endblock %}
|
||||||
|
{% block description %}{{doc.pre_content | slice:"0:100"}}{% endblock %}
|
||||||
{% block title %}{{ doc.name }} - {{ project.name }}{% endblock %}
|
{% block title %}{{ doc.name }} - {{ project.name }}{% endblock %}
|
||||||
|
|
||||||
{% block head_toolbar %}
|
{% block head_toolbar %}
|
||||||
@ -37,7 +39,8 @@
|
|||||||
|
|
||||||
{% block doc_previous_next %}
|
{% block doc_previous_next %}
|
||||||
{% load doc_filter %}
|
{% load doc_filter %}
|
||||||
<div class="layui-row" style="margin-top: 10px;padding:10px;display:flex;justify-content:space-around;">
|
<div class="layui-row" style="margin-top: 10px;padding:10px;display:flex;justify-content:space-around;border-top: 1px #e6e6e6 solid;">
|
||||||
|
<hr>
|
||||||
<div>
|
<div>
|
||||||
{% if doc.id|get_doc_previous == None %}
|
{% if doc.id|get_doc_previous == None %}
|
||||||
<button class="layui-btn layui-btn-disabled layui-btn-sm"><i class="layui-icon layui-icon-prev "></i>上一篇</button>
|
<button class="layui-btn layui-btn-disabled layui-btn-sm"><i class="layui-icon layui-icon-prev "></i>上一篇</button>
|
||||||
|
|||||||
@ -8,6 +8,8 @@
|
|||||||
<meta http-equiv="Cache-Control" content="no-siteapp" />
|
<meta http-equiv="Cache-Control" content="no-siteapp" />
|
||||||
<meta http-equiv="Cache-Control" content="max-age=7200" />
|
<meta http-equiv="Cache-Control" content="max-age=7200" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
|
<meta name="keywords" content="{% block keyword %}{% endblock %}mrdoc"/>
|
||||||
|
<meta name="description" content="{% block description %}{% endblock %}" />
|
||||||
<title>{% block title %}{% endblock %} - MrDoc</title>
|
<title>{% block title %}{% endblock %} - MrDoc</title>
|
||||||
<link href="{% static 'layui/css/layui.css' %}" rel="stylesheet">
|
<link href="{% static 'layui/css/layui.css' %}" rel="stylesheet">
|
||||||
<link rel="stylesheet" href="{% static 'editor.md/css/editormd.css' %}" />
|
<link rel="stylesheet" href="{% static 'editor.md/css/editormd.css' %}" />
|
||||||
|
|||||||
6
template/app_doc/foot_base.html
Normal file
6
template/app_doc/foot_base.html
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<div class="layui-footer" style="border-top: 1px #e6e6e6 solid;text-align:center;margin:20px;width:100%;">
|
||||||
|
<div style="margin-top:10px;">
|
||||||
|
© <a href="/">MrDoc 2019</a> -
|
||||||
|
基于<a href="https://www.djangoproject.com/" target="_blank">Django框架</a> -
|
||||||
|
<a href="https://zmister.com" target="_blank">州的先生</a>出品</div>
|
||||||
|
</div>
|
||||||
@ -25,6 +25,16 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- 州的先生博客链接 -->
|
||||||
|
<div class="layui-hide-xs" style="">
|
||||||
|
<ul class="layui-nav" style="">
|
||||||
|
<li class="layui-nav-item">
|
||||||
|
<a href="https://zmister.com" target="_blank">
|
||||||
|
<i class="layui-icon layui-icon-website"></i> <span class="">州的先生</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
<!-- 用户菜单 -->
|
<!-- 用户菜单 -->
|
||||||
<div class="">
|
<div class="">
|
||||||
<ul class="layui-nav layui-layout-right">
|
<ul class="layui-nav layui-layout-right">
|
||||||
|
|||||||
@ -20,26 +20,40 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="create-doc-form">
|
<div class="create-doc-form">
|
||||||
<div class="layui-form">
|
<div class="layui-form">
|
||||||
<label class="doc-form-label">标题</label>
|
|
||||||
<div class="layui-input-inline">
|
<!-- 标题 -->
|
||||||
<input type="text" name="doc-name" id="doc-name" required lay-verify="required" placeholder="请输入文档标题" value="{{ doc.name }}" class="layui-input" >
|
<div>
|
||||||
</div>
|
<label class="layui-form-label" style="padding-left:0px;padding-right:0px;"><i class="layui-icon layui-icon-edit"></i> 文档标题</label>
|
||||||
|
<div class="layui-input-block" style="margin-left:95px;">
|
||||||
|
<input type="text" name="doc-name" id="doc-name" required lay-verify="required" placeholder="请输入文档标题" value="{{ doc.name }}" class="layui-input">
|
||||||
|
</div>
|
||||||
|
</div><br>
|
||||||
|
|
||||||
|
<!--<label class="doc-form-label">标题</label>-->
|
||||||
|
<!--<div class="layui-input-inline">-->
|
||||||
|
<!--<input type="text" name="doc-name" id="doc-name" required lay-verify="required" placeholder="请输入文档标题" value="{{ doc.name }}" class="layui-input" >-->
|
||||||
|
<!--</div>-->
|
||||||
|
|
||||||
|
|
||||||
<label class="doc-form-label">文集</label>
|
<label class="doc-form-label">文集</label>
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
<select name="pro_id" lay-verify="required" lay-filter="project" id="project" disabled>
|
<select name="pro_id" lay-verify="required" lay-filter="project" id="project" disabled>
|
||||||
<option value="{{ project.id }}">{{ project.name }}</option>
|
<option value="{{ project.id }}">{{ project.name }}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<label class="doc-form-label">上级文档</label>
|
<label class="doc-form-label">上级文档</label>
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
<select name="parent_id" lay-verify="required" id="parent-doc">
|
<select name="parent_id" lay-verify="required" id="parent-doc">
|
||||||
<option value="0"></option>
|
<option value="0"></option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<label class="doc-form-label">排序</label>
|
<label class="doc-form-label">排序</label>
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
<input class="layui-input" placeholder="99" style="width:50px;" name="sort" id="sort" value="{{doc.sort}}"/>
|
<input class="layui-input" placeholder="99" style="width:50px;" name="sort" id="sort" value="{{doc.sort}}"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<label class="doc-form-label">
|
<label class="doc-form-label">
|
||||||
<button class="layui-btn layui-btn-primary layui-btn-sm" id="sel-doctemp">插入模板</button>
|
<button class="layui-btn layui-btn-primary layui-btn-sm" id="sel-doctemp">插入模板</button>
|
||||||
</label>
|
</label>
|
||||||
@ -49,6 +63,7 @@
|
|||||||
<label class="doc-form-label">
|
<label class="doc-form-label">
|
||||||
<button class="layui-btn layui-btn-normal layui-btn-sm" onclick="createDoc()">发布文档</button>
|
<button class="layui-btn layui-btn-normal layui-btn-sm" onclick="createDoc()">发布文档</button>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="editor-md">
|
<div id="editor-md">
|
||||||
|
|||||||
@ -7,6 +7,8 @@
|
|||||||
<meta http-equiv="Cache-Control" content="no-transform" />
|
<meta http-equiv="Cache-Control" content="no-transform" />
|
||||||
<meta http-equiv="Cache-Control" content="no-siteapp" />
|
<meta http-equiv="Cache-Control" content="no-siteapp" />
|
||||||
<meta http-equiv="Cache-Control" content="max-age=7200" />
|
<meta http-equiv="Cache-Control" content="max-age=7200" />
|
||||||
|
<meta name="keywords" content="mrdoc,markdown,文档写作,在线教程"/>
|
||||||
|
<meta name="description" content="MrDoc是由州的先生(zmister.com)开发的,基于Python的Django框架的在线MarkDown文档写作系统。" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
<title>MrDoc - 一个简单的文档写作系统</title>
|
<title>MrDoc - 一个简单的文档写作系统</title>
|
||||||
<link href="{% static 'layui/css/layui.css' %}" rel="stylesheet">
|
<link href="{% static 'layui/css/layui.css' %}" rel="stylesheet">
|
||||||
@ -19,7 +21,7 @@
|
|||||||
<!-- 页头结束 -->
|
<!-- 页头结束 -->
|
||||||
|
|
||||||
<!-- 主体 -->
|
<!-- 主体 -->
|
||||||
<div class="" style="display:flex;flex-wrap:wrap;">
|
<div class="layui-container project-list-content" style="display:flex;flex-wrap:wrap;">
|
||||||
<!-- 遍历文集列表 -->
|
<!-- 遍历文集列表 -->
|
||||||
{% for p in project_list %}
|
{% for p in project_list %}
|
||||||
<div class="project-item layui-col-md3 layui-col-xs12">
|
<div class="project-item layui-col-md3 layui-col-xs12">
|
||||||
@ -51,20 +53,14 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<!-- 新建文档 -->
|
|
||||||
<!--<div class="project-item layui-hide-xs">-->
|
|
||||||
<!--<a href="{% url 'create_doc' %}" target="_blank">-->
|
|
||||||
<!--<div class="layui-card">-->
|
|
||||||
<!--<div class="layui-card-header"><i class="layui-icon layui-icon-add-1"></i> 创建文档</div>-->
|
|
||||||
<!--<div class="layui-card-body">-->
|
|
||||||
<!--新建一个文档,马上开始写作……-->
|
|
||||||
<!--</div>-->
|
|
||||||
<!--</div>-->
|
|
||||||
<!--</a>-->
|
|
||||||
<!--</div>-->
|
|
||||||
</div>
|
</div>
|
||||||
<!-- 主体结束 -->
|
<!-- 主体结束 -->
|
||||||
<script src="https://cdn.bootcss.com/jquery/3.1.1/jquery.min.js"></script>
|
|
||||||
|
<!-- 页脚 -->
|
||||||
|
{% include 'app_doc/foot_base.html' %}
|
||||||
|
<!-- 页脚结束 -->
|
||||||
|
|
||||||
|
<script src="{% static 'jquery/3.1.1/jquery.min.js' %}"></script>
|
||||||
<script src="{% static 'layui/layui.all.js' %}"></script>
|
<script src="{% static 'layui/layui.all.js' %}"></script>
|
||||||
{% block custom_script %}
|
{% block custom_script %}
|
||||||
<script>
|
<script>
|
||||||
@ -163,6 +159,32 @@
|
|||||||
{{ static_code | safe }}
|
{{ static_code | safe }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<!-- 统计代码结束 -->
|
<!-- 统计代码结束 -->
|
||||||
|
<script>
|
||||||
|
$(window).bind("load", function() {
|
||||||
|
var footerHeight = 0;
|
||||||
|
var footerTop = 0;
|
||||||
|
positionFooter();
|
||||||
|
function positionFooter() {
|
||||||
|
// 获取页脚的高度
|
||||||
|
footerHeight = $(".layui-footer").height();
|
||||||
|
// 获取页脚的高度
|
||||||
|
/*
|
||||||
|
scrollTop() 设置或获取位于对象最顶端和窗口中可见内容的最顶端之间的距离
|
||||||
|
*/
|
||||||
|
footerTop = ($(window).scrollTop()+$(window).height()-footerHeight-40)+"px";
|
||||||
|
console.log(footerHeight)
|
||||||
|
console.log(footerTop)
|
||||||
|
console.log($(".layui-header").height()+$(".layui-container").height())
|
||||||
|
console.log($(window).height())
|
||||||
|
//如果页面内容高度小于屏幕高度,div#footer将绝对定位到屏幕底部,否则div#footer保留它的正常静态定位
|
||||||
|
if(($(".layui-header").height()+$(".project-list-content").height()) < $(window).height()) {
|
||||||
|
console.log("页脚置底")
|
||||||
|
$(".layui-footer").css({ position: "absolute",left:"0" }).stop().css({top:footerTop});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//$(window).scroll(positionFooter).resize(positionFooter);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Loading…
x
Reference in New Issue
Block a user