<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('新增文章模板')"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-articletemplate-add">
        <div class="form-group">
            <label class="col-sm-3 control-label"><span style="color: red; ">*</span>模板名称：</label>
            <div class="col-sm-8">
                <input name="templeName" class="form-control" type="text" required maxlength="255">
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">模板内容：</label>
            <div class="col-sm-8">
                <script id="editor" name="templeContent" type="text/plain"></script>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: ueditor"/>

<script type="text/javascript">
    var prefix = ctx + "bussiness_cms/articletemplate"
    $("#form-articletemplate-add").validate({
        focusCleanup: true
    });
    var ue = UE.getEditor('editor');

    function getContentTxt() {
        return UE.getEditor('editor').getContentTxt();
    }

    function submitHandler() {
        if ($.validate.form()) {
            var c = getContentTxt();
            if (c == '' || c.length == 0) {
                $.modal.alertWarning("请输入模板内容！");
                return;
            }
            $.operate.save(prefix + "/add", $('#form-articletemplate-add').serialize());
        }
    }

    $(function () {
        $("#editor").css("height", "380px");
    })
</script>
</body>
</html>