{% extends wide_base %}

{% block body %}

{% include common/script/load_select2.html %}
{% include common/script/load_codemirror.html %}

{% init code = "" %}
{% init name = "" %}
{% init lines = [] %}
{% init title = "Template Cache" %}

<div class="card">
    {% include common/base_title.html %}
</div>

<div class="card">
    <div>
        <label>请选择模板</label>
        <select id="nameSelect" value = "{{name}}" class="row">
            {% for tname in templates %}
                <option>{{tname}}</option>
            {% end %}
        </select>
    </div>
    <div class="top-offset-1 border">
        <textarea id="code" class="row code">{{code}}</textarea>
    </div>
</div>

<script>
    initCodeMirror("#code", {});
    $("#nameSelect").change(function() {
        var name = $(this).val();
        window.location.href = "?name=" + name;
    });
</script>

{% end %}