<div class="panel panel-default">
    <div class="panel-body">
        <ul class="nav">
            <h5><strong><i class="glyphicon glyphicon-hand-down"></i> 用户项目授权</strong></h5>
            <hr>
        </ul>
        {{$userProjects := .userProjects}}{{$user := .user}}{{$defaultProjectIds := .defaultProjectIds}}
        <form class="form-horizontal" method="post" action="/user/projectSave">
            {{range $userProject := $userProjects}}
            <div class="w230 inline-group">
                <h4><span class="label label-default">{{$userProject.group_name}}</span>
                <span class="small">
                    <input name="project_id" type="checkbox" data-type="group" value="{{$userProject.group_id}}" onclick="User.project(this)" />
                </span>
                </h4>
                <ul class="list-group">
                    {{range $project := $userProject.projects}}
                    <li class="list-group-item">{{$project.name}}
                        <span class="pull-right">
                        <input name="project_id" type="checkbox" data-parent="{{$userProject.group_id}}" data-type="project" value="{{$project.project_id}}" onclick="User.project(this)" />
                        </span>
                    </li>
                    {{end}}
                </ul>
            </div>
            {{end}}
            <input type="hidden" name="user_id" value="{{$user.user_id}}">
        </form>
    </div>
</div>
<script type="text/javascript" src="/static/style/module/user.js"></script>
<script type="text/javascript">
    User.defaults({{ $defaultProjectIds }});
</script>