Merge pull request #4630 from chrismeyersfsu/fix-4368_2

handle reload when deleting org card under edit
This commit is contained in:
Chris Meyers 2017-01-10 13:00:18 -05:00 committed by GitHub
commit 6c4df56223

View File

@ -127,6 +127,16 @@ export default ['$stateParams', '$scope', '$rootScope', '$location',
});
};
function isDeletedOrganizationBeingEdited(deleted_organization_id, editing_organization_id) {
if (editing_organization_id === undefined) {
return false;
}
if (deleted_organization_id === editing_organization_id) {
return true;
}
return false;
}
$scope.deleteOrganization = function(id, name) {
var action = function() {
@ -137,7 +147,11 @@ export default ['$stateParams', '$scope', '$rootScope', '$location',
Rest.destroy()
.success(function() {
Wait('stop');
$state.reload('organizations');
if (isDeletedOrganizationBeingEdited(id, parseInt($stateParams.organization_id)) === true) {
$state.go('^', null, { reload: true });
} else {
$state.reload('organizations');
}
})
.error(function(data, status) {
ProcessErrors($scope, data, status, null, {