2020-09-26 21:27:06 +08:00
|
|
|
{% extends 'app_doc/create_base_vditor.html' %}
|
2020-10-18 08:05:41 +08:00
|
|
|
{% load static %}
|
2020-09-26 21:27:06 +08:00
|
|
|
{% block title %}修改文档模板{% endblock %}
|
|
|
|
{% block editor_type %}修改文档模板{% endblock %}
|
|
|
|
|
|
|
|
{% block head_toolbar %}
|
|
|
|
<a class="btn pull-left" aria-label="" href="{% url 'create_doctemp' %}?pid={{project.id}}" target="_blank">
|
|
|
|
<i class="fa fa-plus-square"></i> <span class="layui-hide-xs">新建模板</span>
|
|
|
|
</a>
|
|
|
|
<a class="btn pull-left" aria-label="" href="{% url 'manage_doctemp' %}?pid={{project.id}}" target="_blank">
|
|
|
|
<i class="fa fa-cubes"></i> <span class="layui-hide-xs">管理模板</span>
|
|
|
|
</a>
|
|
|
|
<a class="btn pull-left" aria-label="" href="{% url 'manage_project' %}" target="_blank">
|
|
|
|
<i class="fa fa-cubes"></i> <span class="layui-hide-xs">管理文集</span>
|
|
|
|
</a>
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block left_opera %}
|
|
|
|
<div class="layui-form" style="padding: 10px;">
|
|
|
|
<div class="layui-row">
|
|
|
|
<div class="layui-col-md12" style="margin-bottom: 10px;">
|
|
|
|
<label class="doc-form-label">
|
|
|
|
<button class="layui-btn layui-btn-normal layui-btn-fluid" onclick="modifyDocTemp()">
|
|
|
|
<i class="fa fa-save"></i> 保存模板
|
|
|
|
</button>
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- 已有模板 -->
|
|
|
|
<div class="layui-row">
|
|
|
|
<div class="layui-card">
|
|
|
|
<div class="layui-card-header">现有模板</div>
|
|
|
|
<div class="layui-card-body">
|
|
|
|
{% for temp in doctemps %}
|
|
|
|
<li><a href="{% url 'modify_doctemp' temp.id %}" target="_blank" title="点击查看修改《{{temp.name}}》的内容"><i class="fa fa-file"></i> {{temp.name}}</a></li>
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
|
|
|
|
{% block content %}
|
|
|
|
<div class="create-doc-form">
|
|
|
|
<div class="layui-form" style="padding-bottom:10px;">
|
|
|
|
<div class="layui-input-block" style="margin-left:0px;">
|
|
|
|
<input type="text" name="doc-name" id="doctemp-name" required lay-verify="required" value="{{doctemp.name}}" placeholder="请输入模板名称" autocomplete="off" class="layui-input">
|
|
|
|
</div>
|
|
|
|
</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(){
|
|
|
|
$('button.layui-btn').attr("disabled",true);
|
|
|
|
$('button.layui-btn').addClass('layui-btn-disabled');
|
|
|
|
layer.load(1);
|
|
|
|
var data = {
|
|
|
|
'doctemp_id':'{{ doctemp.id }}',
|
|
|
|
'name':$("#doctemp-name").val(),
|
|
|
|
'content':editor.getValue(),
|
|
|
|
}
|
|
|
|
$.post("{% url 'modify_doctemp' doctemp_id=doctemp.id %}",data,function(r){
|
|
|
|
layer.closeAll("loading");
|
|
|
|
if(r.status){
|
|
|
|
//修改成功
|
|
|
|
layer.msg('修改成功,即将跳转',function(){
|
|
|
|
md_changed = false;
|
|
|
|
window.location.href = "{% url 'manage_doctemp' %}";
|
|
|
|
});
|
|
|
|
}else{
|
|
|
|
//创建失败
|
|
|
|
layer.msg('保存失败');
|
|
|
|
$('button.layui-btn').attr("disabled",false);
|
|
|
|
$('button.layui-btn').removeClass('layui-btn-disabled');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
{% endblock %}
|