<div class="col-xs-24 content">
    <div class="col-md-5 col-sm-6">
        <div class="panel panel-default">
            <div class="panel-heading">模板列表<a href="<?php echo site_url('template/add'); ?>" class="pull-right"><span class="glyphicon glyphicon-plus" ></span></a></div>

            <div class="list-group" style="min-height:600px;">
                <?php
                foreach ($template_list as $item_tpl) {
                    $active = ' ';
                    if (!empty($template)) {
                        if ($template->tp_sn == $item_tpl->tp_sn) {
                            $active = ' active ';
                        }
                    }
                    ?>
                    <a href="<?php echo site_url('template/edit/' . $item_tpl->tp_sn); ?>" class="list-group-item <?php echo $active; ?>"><?php echo $item_tpl->tp_title; ?></a>
                <?php } ?>
            </div>

            <div class="panel-footer"></div>
        </div>

    </div>
    <div class="col-md-19">
        <div class="col-xs-24 btn-lg"></div>
        <?php
        if (!empty($template)) {
            ?>


            <form id="form_template" name="form_template" method="post" action="<?php echo site_url('template/edit_submit') ?>">
                <div class="form-group">
                    <label for="tp_title">模板标题</label>
                    <input type="text" class="form-control" id="tp_title" name="tp_title" value="<?php echo $template->tp_title; ?>" >
                </div>
                <div class="form-group">
                    <div class="form-group">
                        <textarea class="init_editor" id="tp_content" name="tp_content"><?php echo htmlspecialchars_decode($template->tp_content); ?></textarea>
                    </div>
                </div>

                <button type="button" class="btn btn-default" data-loading-text="正在保存" onclick="$(this).button('loading');
                    editor.sync();
                        ajaxSubmit('form_template');">保存</button>

                <input type="hidden" name="tp_sn" value="<?php echo $template->tp_sn; ?>"/>

            </form>


<?php } ?>
    </div>
</div>