users_form.hbs 4.36 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>&nbsp;</p>
    </div>
    <form id="user-form" action="/users/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">Username</label>
                        <input type="text" name="username" value="{{username}}" class="form-control" placeholder="用户名">
                    </div>
                    <!-- form-group -->
                </div>
                <!-- col-sm-6 -->
                <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>
            <!-- row -->
            <div class="row">
                <div class="col-sm-2">
                    <div class="form-group">
                        <label class="control-label">Role</label>
                        <div class="rdio rdio-primary">
                            <input type="radio" name="role" id="role1" value="1000" {{#equals role '1000'}}checked="checked"{{/equals}}>
                            <label for="role1">运维</label>
                        </div>
                    </div>
                </div>
                <div class="col-sm-2">
                    <label class="control-label">&nbsp;</label>
                    <div class="rdio rdio-primary">
                        <input type="radio" name="role" id="role2" value="2000" {{#equals role '2000'}}checked="checked"{{/equals}}>
                        <label for="role2">开发</label>
                    </div>
                </div>
                <div class="col-sm-2">
                    <label class="control-label">&nbsp;</label>
                    <div class="rdio rdio-primary">
                        <input type="radio" name="role" id="role3" value="3000" {{#equals role '3000'}}checked="checked"{{/equals}}>
                        <label for="role3">运营</label>
                    </div>
                </div>
                <div class="col-sm-2">
                    <div class="form-group">
                        <label class="control-label">状态</label>
                        <div class="rdio rdio-primary">
                            <input type="radio" name="state" id="state1" value="1" {{#equals state '1'}}checked="checked"{{/equals}}>
                            <label for="state1">启用</label>
                        </div>
                    </div>
                </div>
                <div class="col-sm-4">
                    <label class="control-label">&nbsp;</label>
                    <div class="rdio rdio-primary">
                        <input type="radio" name="state" id="state2" value="0" {{#equals state '0'}}checked="checked"{{/equals}}>
                        <label for="state2">禁用</label>
                    </div>
                </div>
            </div>
            <!-- row -->
        </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>
    $(document).on('ready pjax:success', function() {
         $('#user-form').ajaxForm(function() {
            location.href = '/users/setting';
        });

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