前端 增加修改小组信息部分
This commit is contained in:
15
group/migrations/0004_merge.py
Normal file
15
group/migrations/0004_merge.py
Normal file
@@ -0,0 +1,15 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('group', '0003_auto_20150811_1906'),
|
||||
('group', '0002_auto_20150811_1649'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
]
|
||||
@@ -13,28 +13,8 @@ require(["jquery", "avalon", "csrf", "bs_alert", "validation"], function ($, ava
|
||||
page_count: 1,
|
||||
name: "",
|
||||
description: "",
|
||||
join_group_setting: {0: false, 1: false, 2: false},
|
||||
checked_setting: "0",
|
||||
|
||||
updateGroupInfo: function () {
|
||||
$.ajax({
|
||||
beforeSend: csrfHeader,
|
||||
url: "/api/admin/group/",
|
||||
method: "put",
|
||||
data: {group_id: avalon.vmodels.admin.group_id, name: vm.name,
|
||||
description: vm.description, join_group_setting: vm.checked_setting},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (!data.code) {
|
||||
bs_alert("修改成功");
|
||||
}
|
||||
else {
|
||||
bs_alert(data.data);
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
getNext: function () {
|
||||
if (!vm.next_page)
|
||||
return;
|
||||
@@ -110,6 +90,59 @@ require(["jquery", "avalon", "csrf", "bs_alert", "validation"], function ($, ava
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
$("#edit_group_form")
|
||||
.formValidation({
|
||||
framework: "bootstrap",
|
||||
fields: {
|
||||
name: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: "请填写小组名"
|
||||
},
|
||||
stringLength: {
|
||||
max: 20,
|
||||
message: '小组名长度必须在20位之内'
|
||||
}
|
||||
}
|
||||
},
|
||||
description: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: "请填写描述"
|
||||
},
|
||||
stringLength: {
|
||||
max: 300,
|
||||
message: '描述长度必须在300位之内'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
).on('success.form.fv', function (e) {
|
||||
e.preventDefault();
|
||||
var data = {
|
||||
group_id: avalon.vmodels.admin.group_id,
|
||||
name: vm.name,
|
||||
description: vm.description,
|
||||
join_group_setting: vm.checked_setting
|
||||
};
|
||||
$.ajax({
|
||||
beforeSend: csrfHeader,
|
||||
url: "/api/admin/group/",
|
||||
method: "put",
|
||||
data: data,
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (!data.code) {
|
||||
bs_alert("修改成功");
|
||||
}
|
||||
else {
|
||||
bs_alert(data.data);
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
@@ -25,11 +25,9 @@
|
||||
<button ms-attr-class="getBtnClass(0)" ms-click="getPrevious">上一页</button>
|
||||
<button ms-attr-class="getBtnClass(1)" ms-click="getNext">下一页</button>
|
||||
</div>
|
||||
|
||||
<h1>修改小组信息</h1>
|
||||
|
||||
<div>
|
||||
|
||||
<form id="edit_group_form">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group"><label>小组名</label>
|
||||
<input type="text" name="name" class="form-control" ms-duplex="name">
|
||||
@@ -37,22 +35,21 @@
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<div class="form-group"><label>描述</label>
|
||||
<textarea rows="3" class="form-control" ms-duplex="description"></textarea>
|
||||
<textarea rows="3" name="description" class="form-control" ms-duplex="description"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
|
||||
<label>加入小组设置</label>
|
||||
<input type="radio" name="join_group_setting" value="0" ms-duplex-string="checked_setting">允许任何人加入
|
||||
<input type="radio" name="join_group_setting" value="1" ms-duplex-string="checked_setting">提交请求后管理员审核
|
||||
<input type="radio" name="join_group_setting" value="2" ms-duplex-string="checked_setting">不允许任何人加入
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<button class="btn btn-primary" ms-click="updateGroupInfo()">提交</button>
|
||||
<button class="btn btn-primary" type="submit">提交</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<script src="/static/js/app/admin/group/group_detail.js"></script>
|
||||
@@ -71,7 +71,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="sbumit" class="btn btn-primary">提交</button>
|
||||
<button type="submit" class="btn btn-primary">提交</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user