projects.hbs 3.46 KB
<div class="pageheader">
    <div class="media">
        <div class="pageicon pull-left">
            <i class="fa fa-th-list"></i>
        </div>
        <div class="media-body">
            <ul class="breadcrumb">
                <li><a href="/"><i class="glyphicon glyphicon-home"></i></a></li>
                <li><a href="/servers">Projects</a></li>
            </ul>
            <h4>项目列表</h4>
        </div>
    </div>
    <!-- media -->
</div>
<!-- pageheader -->

<div class="contentpanel servers-page">
    <div class="row row-stat">
        {{#each projects}}
            <div class="col-md-4">
                <div class="panel panel-{{color}} noborder">
                    <div class="panel-heading noborder">
                        <div class="panel-btns">
                            {{#if @root.is_master}}
                                <a href="/projects/edit?id={{_id}}" class="tooltips" title="设置"><i
                                        class="fa fa-gear"></i></a>
                            {{/if}}
                        </div><!-- panel-btns -->
                        <div class="panel-icon"><i class="fa fa-git" style="padding-left:12px;"></i></div>
                        <div class="media-body">
                            <h1 class="nomargin">{{name}}</h1>
                            <h5 class="md-title mt5">{{subname}}&nbsp;</h5>
                        </div><!-- media-body -->
                        <hr>
                        <div class="clearfix mt20">
                            <div class="col-xs-4 project-env" data-id="{{_id}}" data-env="production">
                                <h5 class="md-title nomargin">线上环境</h5>
                                <h4 class="nomargin">{{deploy.production.target.length}}</h4>
                            </div>
                            <div class="col-xs-4 project-env" data-id="{{_id}}" data-env="preview">
                                <h5 class="md-title nomargin">灰度环境</h5>
                                <h4 class="nomargin">{{deploy.preview.target.length}}</h4>
                            </div>
                            <div class="col-xs-4 project-env" data-id="{{_id}}" data-env="test">
                                <h5 class="md-title nomargin">测试环境</h5>
                                <h4 class="nomargin">{{deploy.test.target.length}}</h4>
                            </div>
                        </div>
                    </div><!-- panel-body -->
                </div><!-- panel -->
            </div><!-- col-md-4 -->
        {{/each}}
        {{#if is_master}}
            <div class="col-md-4">
                <div class="panel panel-default noborder">
                    <div class="panel-heading noborder">
                        <div style="text-align: center; font-size: 97px;">
                            <a href="/projects/new" class="">
                                <i class="fa fa-plus"></i>
                            </a>
                        </div>
                    </div>
                </div>
            </div>
        {{/if}}
    </div><!-- row -->
</div>


<script>
    $(function() {
        $('.servers-page').pjax('a', '#pjax-container');
        $('.project-env').click(function() {
            var id = $(this).data('id');
            var env = $(this).data('env');
            $.pjax({
                url: '/projects/' + id + '?env=' + env,
                container: '#pjax-container'
            });
        });

    });

</script>