project_form.hbs 2.8 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>项目信息</li>
            </ul>
            <h4>项目信息</h4>
        </div>
    </div>
    <!-- media -->
</div>
<!-- pageheader -->

<div class="panel panel-default">
    <div class="panel-heading">
        <p>请配置项目信息.</p>
    </div>
    <form action="/projects/save" method="POST" data-pjax>
        <input type="hidden" name="_id" value="{{project._id}}">
        <div class="panel-body">
            <div class="row">
                <div class="col-sm-12">
                    <h5 class="lg-title mb10">基本信息</h5>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="control-label">Name</label>
                        <input type="text" name="name" value="{{project.name}}" class="form-control"
                               placeholder="项目名称, 须和gitlab中的名称一致">
                    </div>
                    <!-- form-group -->
                </div>
                <!-- col-sm-6 -->
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="control-label">Name</label>
                        <input type="text" name="subname" value="{{project.subname}}" class="form-control"
                               placeholder="项目名称,ex: 前端wap版">
                    </div>
                    <!-- form-group -->
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="control-label">Repository Url</label>
                        <input type="text" name="gitlab" value="{{project.gitlab}}" class="form-control"
                               placeholder="Gitlab 地址">
                    </div>
                </div>
            </div>
        </div>
        <!-- panel-body -->
        <div class="panel-footer">
            <button type="submit" class="btn btn-primary">保存</button>
            <button type="button" class="btn btn-default ml20 go-back">取消</button>
        </div>
    </form>
    <!-- panel-footer -->
</div>

<script>
    $(function() {
        $(document.body).off().on('submit', 'form[data-pjax]', function(event) {
            event.preventDefault(); // stop default submit behavior
            $.pjax.submit(event, '#pjax-container', {
                type: 'POST'
            });
        });

        $('.go-back').click(function() {
            window.history.go(-1);
        });
    });

</script>