{% extends "old/base.html" %}

{% block header %}
    <title>[{{ template_name }}]编辑</title>

{% endblock %}

{% block content %}
    <form action="/analysis/query/template_edit?template_name={{ template_name }}&edit_type={{ edit_type }}&action=save"
          method="post">
        <div id="bar">
            [{{ template_name }}] 模版编辑
            <div class="buttons">
                <input class="submit" class="btn btn-default" type="submit" value="保存">
                <a href="javascript:window.close()">关闭</a>
            </div>
        </div>
        <div class="sub-menu">

            <textarea id="code" name="code">{{ file_content|safe }}</textarea>
            <br>
            <hr>


        </div>
        <div class="well">
            <p>模版变量:request ,query_analysis
            <p>
            <pre>

全局变量:
    $SEARCH_FORM = $('#search_form'),
    QUERT_URL = "{{ request.get_full_path() }}",

    $CONT = $('#plugins-cont'),                           //
    $SEARCH= $('#search_btn'),                           //查询按钮
    $EXPORT_ALL = $('#export_all_btn'),            //导出按钮
    $EXPORT_CURRENTLY = $('#export_currently_btn'),      // 导出当前按钮
    $QUERY_TABLE = $('#query_table')
    函数:
    getThindex(thText) //获取th索引
    
    dataTableOption.convertInputDataFuncs = [function(data){return data}]  //增加转换数据输入处理方法数组
    dataTableOption.convertOutputDataFuncs = [function(data){return data}] //增加转换数据输出处理方法数组

</pre>
        </div>
    </form>

    {% with URL = '/static/assets/codemirror'  %}

        <script src={{ URL }}/lib/codemirror.js></script>
        <link rel="stylesheet" href="{{ URL }}/lib/codemirror.css"/>
        <script src="{{ URL }}/mode/vbscript/vbscript.js"></script>
        <script src="{{ URL }}/mode/javascript/javascript.js"></script>
        <script src="{{ URL }}/mode/xml/xml.js"></script>
        <script src="{{ URL }}/mode/css/css.js"></script>
        <script src="{{ URL }}/mode/htmlmixed/htmlmixed.js"></script>

        <script type="text/javascript">
            window.onload = function () {
                var mixedMode = {
                    name: "htmlmixed",
                    scriptTypes: [{
                        matches: /\/x-handlebars-template|\/x-mustache/i,
                        mode: null
                    },
                        {
                            matches: /(text|application)\/(x-)?vb(a|script)/i,
                            mode: "vbscript"
                        }]
                };
                var editor = CodeMirror.fromTextArea(document.getElementById('code'), {
                    mode: mixedMode,
                    indentWithTabs: true,
                    smartIndent: true,
                    lineNumbers: true,
                    matchBrackets: true,
                    lineWrapping: true,
                    //autofocus: true,
                    tabSize: 4,
                });
                editor.setSize('100%', '100%')

            };
        </script>
    {% endwith %}
{% endblock %}

