{% extends base %}

{% block head %}
<style type="text/css">
    pre {
        margin: 0px;
    }
    input[name=input] {
        overflow: inherit;
    }
    input[name=input]:focus {
        outline: none;
        border: 1px solid #8cc;
    }
    .plugin-input {
        width: 200px;
    }
    .output-textarea {
        width: 100%;
        height: 400px;
    }
</style>
<style type="text/css">
    {% raw css_style %}
</style>
{% end %}

{% block body %}
    {% init error       = "" %}
    {% init description = "" %}
    {% init input       = "" %}
    {% init output      = "" %}

    {# 标题 #}
    {% include plugin/base/base_plugin_title.html %}

    {# HTML输出 #}
    {% if html != None and html != "" %}
        {% raw html %}
    {% end %}

    {# 文本输出放到后面 #}
    {% if output != None and output != "" %}
    <div class="card">
        <textarea class="output-textarea">{{ output }}</textarea>
    </div>
    {% end %}

    {% if model.show_pagenation %}
    <div class="card">
        {# 分页 #}
        {% set page = model.page %}
        {% set page_max = model.page_max %}
        {% set page_url = model.page_url %}
        {% include mod_pagenation.html %}
    </div>
    {% end %}

    <div class="hide form-plugin-dialog-tpl">
        <form id="$formId" method="{{method}}">
            <!-- 输入框区域 BEGIN -->
            <textarea class="col-md-12 code" name="input" rows=20 placeholder="{{model.placeholder}}">{{model.get_input_template()}}</textarea>
            <!-- 输入框区域 END -->
        </form>
    </div>

<script type="text/javascript">
$(function () {
    $("#createBtn").click(function () {
        var title = "提交数据";
        var html  = $(".form-plugin-dialog-tpl").html().replace("$formId", "form-1");
        var buttons = ["提交", "取消"];
        var functions = [function (index, layero) {
            // 提交数据
            $("#form-1").submit();
        }];

        xnote.showDialog(title, html, buttons, functions);
    })
})
</script>

{% end %}


