updates for reload action when editing project-member.

This commit is contained in:
kunw 2016-05-25 12:13:07 +08:00
parent bab38f2514
commit 8d30879fc2
4 changed files with 13 additions and 14 deletions

View File

@ -31,9 +31,6 @@
AddProjectMemberService(vm.projectId, vm.optRole, pm.username)
.success(addProjectMemberComplete)
.error(addProjectMemberFailed);
vm.username = '';
vm.optRole = 1;
vm.reload();
}
}
@ -48,6 +45,7 @@
function addProjectMemberComplete(data, status, header) {
console.log('addProjectMemberComplete: status:' + status + ', data:' + data);
vm.reload();
}
function addProjectMemberFailed(data, status, headers) {

View File

@ -28,7 +28,6 @@
function updateProjectMember(e) {
if(vm.editMode) {
vm.editMode = false;
console.log('update project member, roleId:' + e.roleId);
EditProjectMemberService(e.projectId, e.userId, e.roleId)
.success(editProjectMemberComplete)
@ -42,12 +41,13 @@
DeleteProjectMemberService(e.projectId, e.userId)
.success(editProjectMemberComplete)
.error(editProjectMemberFailed);
vm.reload();
}
function editProjectMemberComplete(data, status, headers) {
console.log('edit project member complete: ' + status);
vm.lastRoleName = vm.roleName;
vm.editMode = false;
vm.reload();
}
function editProjectMemberFailed(e) {
@ -56,7 +56,6 @@
function cancelUpdate() {
vm.editMode = false;
console.log('lastRoleName:' + vm.lastRoleName);
vm.roleName = vm.lastRoleName;
}

View File

@ -16,6 +16,7 @@
vm.currentRole = getRole({'key': 'roleName', 'value': current});
}
});
vm.selectRole = selectRole;
function selectRole(role) {

View File

@ -39,19 +39,20 @@
function link(scope, element, attrs, ctrl) {
var visited = ctrl.url.substring(1);
if(visited.indexOf('?') >= 0) {
visited = ctrl.url.substring(1, ctrl.url.indexOf('?') - 1);
visited = ctrl.url.substring(1, ctrl.url.indexOf('?'));
}
scope.$watch('vm.selectedProject', function(current) {
if(current) {
element.find('a').removeClass('active');
element.find('a:first').addClass('active');
if(visited) {
element.find('a[tag="' + visited + '"]').addClass('active');
}else{
element.find('a:first').addClass('active');
}
}
});
element.find('a[tag*="' + visited + '"]').addClass('active');
element.find('a').on('click', click);
function click(event) {