2019-07-24 10:45:45 +08:00
|
|
|
{% extends 'app_doc/create_base.html' %}
|
2019-07-23 22:03:51 +08:00
|
|
|
{% load staticfiles %}
|
2019-07-24 10:45:45 +08:00
|
|
|
{% block title %}修改文档模板{% endblock %}
|
|
|
|
|
|
|
|
{% block content %}
|
2019-07-23 22:03:51 +08:00
|
|
|
<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>
|
2019-07-24 10:45:45 +08:00
|
|
|
{% endblock %}
|
2019-07-21 22:08:04 +08:00
|
|
|
|
2019-07-23 22:03:51 +08:00
|
|
|
{% 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>
|
2019-07-24 10:45:45 +08:00
|
|
|
{% endblock %}
|