2015-04-20 02:12:11 +00:00
|
|
|
|
{% extends 'base.html' %}
|
|
|
|
|
{% load mytags %}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{% block content %}
|
|
|
|
|
{% include 'nav_cat_bar.html' %}
|
|
|
|
|
<div class="wrapper wrapper-content animated fadeInRight">
|
|
|
|
|
<div class="row">
|
2015-12-19 09:26:34 +00:00
|
|
|
|
<div class="col-sm-10">
|
2015-04-20 02:12:11 +00:00
|
|
|
|
<div class="ibox float-e-margins">
|
|
|
|
|
<div class="ibox-title">
|
|
|
|
|
<h5>编辑用户信息</h5>
|
|
|
|
|
<div class="ibox-tools">
|
|
|
|
|
<a class="collapse-link">
|
|
|
|
|
<i class="fa fa-chevron-up"></i>
|
|
|
|
|
</a>
|
|
|
|
|
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
|
|
|
|
|
<i class="fa fa-wrench"></i>
|
|
|
|
|
</a>
|
|
|
|
|
<a class="close-link">
|
|
|
|
|
<i class="fa fa-times"></i>
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="ibox-content">
|
2015-12-19 09:26:34 +00:00
|
|
|
|
<form method="post" id="userForm" class="form-horizontal" action="{% url 'user_edit' %}?id={{ user.id }}">
|
2015-04-20 02:12:11 +00:00
|
|
|
|
{% if error %}
|
|
|
|
|
<div class="alert alert-warning text-center">{{ error }}</div>
|
|
|
|
|
{% endif %}
|
|
|
|
|
{% if msg %}
|
|
|
|
|
<div class="alert alert-success text-center">{{ msg }}</div>
|
|
|
|
|
{% endif %}
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label for="username" class="col-sm-2 control-label">用户名<span class="red-fonts">*</span></label>
|
|
|
|
|
<div class="col-sm-8">
|
|
|
|
|
<input id="username" name="username" placeholder="Username" type="text" class="form-control" value="{{ user.username }}" readonly>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="hr-line-dashed"></div>
|
|
|
|
|
<div class="form-group">
|
2015-12-19 09:26:34 +00:00
|
|
|
|
<label for="password" class="col-sm-2 control-label">密码</label>
|
2015-04-20 02:12:11 +00:00
|
|
|
|
<div class="col-sm-8">
|
2015-12-19 09:26:34 +00:00
|
|
|
|
<input id="password" name="password" placeholder="Password" type="password" class="form-control">
|
2015-04-20 02:12:11 +00:00
|
|
|
|
<span class="help-block m-b-none">
|
2015-12-19 09:26:34 +00:00
|
|
|
|
登陆web的密码(如不修改请留空)
|
2015-04-20 02:12:11 +00:00
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="hr-line-dashed"></div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label for="name" class="col-sm-2 control-label">姓名<span class="red-fonts">*</span></label>
|
|
|
|
|
<div class="col-sm-8">
|
|
|
|
|
<input id="name" name="name" placeholder="Name" type="text" class="form-control" value="{{ user.name }}">
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="hr-line-dashed"></div>
|
|
|
|
|
<div class="form-group">
|
2015-12-19 09:26:34 +00:00
|
|
|
|
<label for="groups" class="col-sm-2 control-label">小组</label>
|
2015-04-20 02:12:11 +00:00
|
|
|
|
<div class="col-sm-8">
|
|
|
|
|
<select id="groups" name="groups" class="form-control m-b" multiple size="12">
|
|
|
|
|
{% for group in group_all %}
|
|
|
|
|
{% if group.id|int2str in groups_str %}
|
|
|
|
|
<option value="{{ group.id }}" selected>{{ group.name }}</option>
|
|
|
|
|
{% else %}
|
|
|
|
|
<option value="{{ group.id }}">{{ group.name }}</option>
|
|
|
|
|
{% endif %}
|
|
|
|
|
{% endfor %}
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="hr-line-dashed"></div>
|
|
|
|
|
<div class="form-group">
|
2015-12-19 09:26:34 +00:00
|
|
|
|
<label for="role" class="col-sm-2 control-label">权限<span class="red-fonts">*</span></label>
|
2015-04-20 02:12:11 +00:00
|
|
|
|
<div class="col-sm-8">
|
2015-12-19 09:26:34 +00:00
|
|
|
|
{% for r, role_name in user_role.items %}
|
|
|
|
|
<div class="col-sm-3">
|
|
|
|
|
<div class="radio i-checks">
|
|
|
|
|
<label><input type="radio" value="{{ r }}" class="role" name="role" {% ifequal r user.role %} checked {% endifequal %}>{{ role_name }}</label>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{% endfor %}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group" id="admin_groups" {% ifnotequal user.role "GA" %} style="display: none" {% endifnotequal %}>
|
|
|
|
|
<label for="role" class="col-sm-2 control-label">管理用户组</label>
|
|
|
|
|
<div class="col-sm-8">
|
|
|
|
|
{% for user_group in group_all %}
|
|
|
|
|
<div class="col-sm-3">
|
|
|
|
|
<div class="checkbox i-checks">
|
|
|
|
|
<label>
|
|
|
|
|
{% if user_group.id|int2str in admin_groups_str %}
|
|
|
|
|
<input type="checkbox" value="{{ user_group.id }}" name="admin_groups" checked >
|
|
|
|
|
{% else %}
|
|
|
|
|
<input type="checkbox" value="{{ user_group.id }}" name="admin_groups" >
|
|
|
|
|
{% endif %}
|
|
|
|
|
{{ user_group.name }}
|
|
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{% endfor %}
|
2015-04-20 02:12:11 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="hr-line-dashed"></div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label for="email" class="col-sm-2 control-label">Email<span class="red-fonts">*</span></label>
|
|
|
|
|
<div class="col-sm-8">
|
|
|
|
|
<input id="email" name="email" type="email" placeholder="Email" class="form-control" value="{{ user.email }}" >
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="hr-line-dashed"></div>
|
2015-12-19 09:26:34 +00:00
|
|
|
|
<div class="form-group"><label class="col-sm-2 control-label">额外</label>
|
|
|
|
|
<div class="col-sm-2">
|
|
|
|
|
<div class="checkbox i-checks">
|
|
|
|
|
<label><input type="checkbox" value="0" name="extra" {% ifequal user.is_active 1 %} checked {% endifequal %} >启用 </label>
|
2015-04-20 02:12:11 +00:00
|
|
|
|
</div>
|
2015-12-19 09:26:34 +00:00
|
|
|
|
</div>
|
|
|
|
|
<div class="col-sm-2">
|
|
|
|
|
<div class="checkbox i-checks">
|
2016-02-24 04:29:47 +00:00
|
|
|
|
<label><input type="checkbox" value="1" name="extra">发送邮件 </label>
|
2015-04-20 02:12:11 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="hr-line-dashed"></div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<div class="col-sm-4 col-sm-offset-2">
|
|
|
|
|
<button class="btn btn-white" type="submit">取消</button>
|
|
|
|
|
<button id="submit_button" class="btn btn-primary" type="submit">确认保存</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2015-12-19 09:26:34 +00:00
|
|
|
|
{% endblock %}
|
2015-04-20 02:12:11 +00:00
|
|
|
|
|
2015-12-19 09:26:34 +00:00
|
|
|
|
{% block self_footer_js %}
|
2015-04-20 02:12:11 +00:00
|
|
|
|
<script>
|
|
|
|
|
$('#userForm').validator({
|
|
|
|
|
timely: 2,
|
|
|
|
|
theme: "yellow_right_effect",
|
|
|
|
|
rules: {
|
2015-12-19 09:26:34 +00:00
|
|
|
|
check_pass: [/^\w+$/, '数字和字符']
|
2015-04-20 02:12:11 +00:00
|
|
|
|
},
|
|
|
|
|
fields: {
|
|
|
|
|
"username": {
|
|
|
|
|
rule: "required",
|
|
|
|
|
tip: "输入用户名",
|
|
|
|
|
ok: "",
|
|
|
|
|
msg: {required: "必须填写!"}
|
|
|
|
|
},
|
|
|
|
|
"name": {
|
|
|
|
|
rule: "required",
|
|
|
|
|
tip: "姓名",
|
|
|
|
|
ok: "",
|
|
|
|
|
msg: {required: "必须填写"}
|
|
|
|
|
},
|
|
|
|
|
"email": {
|
|
|
|
|
rule: "required",
|
|
|
|
|
tip: "Email",
|
|
|
|
|
ok: "",
|
|
|
|
|
msg: {required: "必须填写"}
|
|
|
|
|
},
|
2015-12-19 09:26:34 +00:00
|
|
|
|
valid: function (form) {
|
|
|
|
|
form.submit();
|
2015-04-20 02:12:11 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2015-12-19 09:26:34 +00:00
|
|
|
|
$("document").ready(function(){
|
|
|
|
|
$("input.role").click(function(){
|
|
|
|
|
if($("input.role[value=GA]").is( ":checked" )){
|
|
|
|
|
$("#admin_groups").css("display", 'block');
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$("#admin_groups").css("display", 'none');
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
2015-04-20 02:12:11 +00:00
|
|
|
|
</script>
|
|
|
|
|
{% endblock %}
|