Skip to content

Commit

Permalink
Edits to a group appear immediately
Browse files Browse the repository at this point in the history
  • Loading branch information
Karthik Palaniappan committed May 24, 2014
1 parent 18e7c72 commit cb4305d
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions app/assets/javascripts/controllers/groupsViewController.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
$scope.groupsList = GroupModel.groups;
$scope.currentUser = UserModel.get(UserModel.me);
$scope.newMemberList = [$scope.currentUser];

function selectMeGroup() {

// synchronize the group list and current user
// with those of the appropriate models
$scope.$watch('groupsList', function(newVal, oldVal) {
$scope.groupsList = newVal;
if(Object.keys($scope.groupsList).length != 0) {
console.log("Entered watch");
for(var group in $scope.groupsList) {
Expand All @@ -27,13 +30,6 @@
}
}
}
}

// synchronize the group list and current user
// with those of the appropriate models
$scope.$watch('groupsList', function(newVal, oldVal) {
$scope.groupsList = newVal;
selectMeGroup();
});
$scope.$watch('currentUser', function(newVal, oldVal) {});

Expand Down Expand Up @@ -98,8 +94,10 @@
if(error) {
toastr.error(error);
} else {
$scope.editDescription = $scope.editName = "";
$('#editModal').modal('hide');
$scope.$apply(function() {
$scope.editDescription = $scope.editName = "";
$('#editModal').modal('hide');
});
}
});
}
Expand Down

0 comments on commit cb4305d

Please sign in to comment.