
<script type="text/template" id="templ_tpl">
<div class="page-list">
    <% if( rootScope.manager ){ %>
    <div class="page-list-header">
        <button type="button" data-click="addTmpl" class="btn btn-primary">添加模板</button>
        <a href="#template/add" class="btn">创建模板</a>
    </div>
    <% } %>
    <div class="page-list-mainer">
        <div class="tmpl-item">
            <!-- <h3 class="tmpl-item-name">默认模板</h3> -->
            <ul class="tmpl-item-list clearfix" id="tmpl_list"></ul>
        </div>
    </div>
</div>
</script>

<script type="text/template" id="templ_item_tpl">
    <% for(var i=0, len= data.length; i<len; i++){ %>
    <li>
        <h4 style='background: <%= data[i].color %>' data-evt="preview" data-id='<%= data[i].tid %>'>
            <i class="icon-middle <%= data[i].pictureurl %>"></i>
            <%= data[i].tname %>
            <% if(data[i].deltemplate){ %>
            <span data-evt='del' class="o-item-close" data-id='<%= data[i].tid %>'>x</span>
            <% } %>
        </h4>
        <div class="tmpl-item-content">
            <% for(var j=0, jlen= data[i].field.length; j<jlen && j<3; j++){ var field = data[i].field[j]; %>
            <p class="ellipsis" title="<%= U.entity.unescape(field.fieldname) %>：<%= field.fieldtext %>"><span><%= U.entity.unescape(field.fieldname) %>：</span><%= field.fieldtext %></p>
            <% } %>
        </div>
        <div class="tmpl-item-operator <% if(!data[i].edittemplate){ %>noeidt<% } %>">
            <% if(data[i].settemplate){ %>
            <span data-evt='set' data-id='<%= data[i].tid %>'>设置</span>
            <% } %>
            <% if(data[i].edittemplate){ %>
            <span data-evt='edit' data-id='<%= data[i].tid %>'>修改</span>
            <% } %>
        </div>
    </li>
    <% } %>
    <% if( !data.length ){ %>
        <div class="no-data-tip"></div>
    <% } %>
</script>
<script type="text/template" id="tmpl_store_tpl">
    <div class="tmpl-store">
        <div class="tmpl-store-content">
            <% for(var i=0, ilen=data.length; i<ilen; i++){ %>
            <div class="tmpl-store-category">
                <%= data[i].catename %>
            </div>
            <div class="tmpl-store-list">
                <% for(var j=0, jlen=data[i].template.length; j<jlen; j++){ %>
                <div class="tmpl-store-item <% if(data[i].template[j].isadd){ %>exist<% } %>" data-id="<%= data[i].template[j].tid %>">
                    <div class="clearfix">
                        <div class="img pull-left">
                            <i class="icon <%= data[i].template[j].pictureurl %>"></i>
                            <div class="mark"></div>
                        </div>
                        <div class="text">
                            <h4 class="xcm"><%= data[i].template[j].tname %> <span>已添加</span></h4>
                            <span>提供者：<%= data[i].template[j].provider %></span>
                            <p><%= data[i].template[j].description %></p>
                        </div>
                    </div>
                </div>
                <% } %>
            </div>
            <% } %>
        </div>
        <div class="tmpl-store-detail"></div>
    </div>
</script>
<script type="text/template" id="store_tmpl_detail">
    <div class="tmpl-detail">
        <div class="tmpl-detail-header">模板内容</div>
        <div class="tmpl-detail-content">
            <% for(var i=0, len=data.field.length; i< len && i< 11; i++){ %>
            <p><span><%= data.field[i].fieldname %></span><span><%= data.field[i].fieldtext %></span></p>
            <% } %>
        </div>
        <div class="tmpl-detail-footer">
            <button class="btn btn-primary template-add" data-id="<%= data.tid %>">添加</button>
        </div>
        <div class="tmpl-detail-close">
            <i class='o-detail-close'></i>
        </div>
    </div>
</script>