MrDoc/template/app_doc/modify_doctemp.html
2019-07-24 10:45:45 +08:00

45 lines
1.7 KiB
HTML

{% extends 'app_doc/create_base.html' %}
{% load staticfiles %}
{% block title %}修改文档模板{% endblock %}
{% block content %}
<div class="create-doc-form">
<div class="layui-form">
<label class="layui-form-label">模板标题</label>
<div class="layui-input-inline">
<input type="text" name="doc-name" id="doctemp-name" required lay-verify="required" value="{{doctemp.name}}" placeholder="请输入模板名称" autocomplete="off" class="layui-input">
</div>
<label class="doc-form-label">
<button class="layui-btn layui-btn-normal" onclick="modifyDocTemp()">保存</button>
</label>
</div>
</div>
<div id="editor-md">
<textarea style="display:none;">{{doctemp.content}}</textarea>
<textarea class="editormd-html-textarea" name="$id-html-code"></textarea>
</div>
{% endblock %}
{% block custom_script %}
<script>
//修改文档模板
modifyDocTemp = function(){
var data = {
'doctemp_id':{{ doctemp.id }},
'name':$("#doctemp-name").val(),
'content':editor.getMarkdown(),
}
$.post("{% url 'modify_doctemp' doctemp_id=doctemp.id %}",data,function(r){
if(r.status){
//修改成功
layer.msg('修改成功,即将跳转',function(){
window.location.href = "{% url 'manage_doctemp' %}";
});
}else{
//创建失败
layer.msg('保存失败');
}
});
};
</script>
{% endblock %}