server_form.hbs 4.31 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="">服务器管理</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="/servers/save" method="POST" data-pjax>
        <input type="hidden" name="_id" value="{{_id}}">
        <div class="panel-body">
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="control-label">Host</label>
                        <input type="text" name="host" value="{{host}}" class="form-control" placeholder="服务器地址">
                    </div>
                    <!-- form-group -->
                </div>
                <!-- col-sm-6 -->

                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="control-label">Username</label>
                        <input type="text" name="username" value="{{username}}" class="form-control" placeholder="用户名">
                    </div>
                    <!-- form-group -->
                </div>
                <!-- col-sm-6 -->
            </div>
            <!-- row -->

            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="control-label">Password</label>
                        <input type="text" name="password" value="{{password}}" class="form-control" placeholder="密码">
                    </div>
                    <!-- form-group -->
                </div>
                <!-- col-sm-6 -->

                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="control-label">Port</label>
                        <input type="text" name="port" value="{{port}}" class="form-control" value="22" placeholder="端口">
                    </div>
                    <!-- form-group -->
                </div>
                <!-- col-sm-6 -->
            </div>
            <div class="row">
                <div class="col-sm-2">
                    <div class="form-group">
                        <label class="control-label">Env</label>
                        <div class="rdio rdio-primary">
                            <input type="radio" name="env" id="proEnv" value="production" {{#equals env 'production'}}checked="checked"{{/equals}}>
                            <label for="proEnv">线上环境</label>
                        </div>
                    </div>
                </div>
                <div class="col-sm-4">
                    <label class="control-label">&nbsp;</label>
                    <div class="rdio rdio-primary">
                        <input type="radio" name="env" id="testEnv" value="test" {{#equals env 'test'}}checked="checked"{{/equals}}>
                        <label for="testEnv">测试环境</label>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="control-label">Deploy Path</label>
                        <input type="text" name="deployDir" class="form-control" placeholder="部署目录" value="{{deployDir}}">
                    </div>
                </div>
            </div>
            <!-- row -->
        </div>
        <!-- panel-body -->
        <div class="panel-footer">
            <button type="submit" class="btn btn-primary">保存</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'
            });
        });
    });
</script>