});
$scope.RegistrationState = RegistrationState;
- $scope.update = function(registration, state) {
+ $scope.info = { message: '', css_class: '' } ; // alert box
+
+ $scope.update = function(registration, state, info_message) {
registration.state = state;
}
registration.$save( function(registration) {
- $log.info("saved", registration);
$log.info('id =', registration.id, 'state = ', registration.state);
if ( registration.id && registration.state ) {
- $location.path( '/' + registration.state + '/' + registration.id );
+ if ( ! info_message ) {
+ $location.path( '/' + registration.state + '/' + registration.id );
+ } else {
+ $scope.info = { message: info_message, css_class: 'alert-success' };
+ }
} else {
$log.error("can't find id in ", registration);
}
return abstract.length <= 2000 ? abstract.length : 2000 - abstract.length;
}
+ $scope.change_state = function(new_state) {
+ if ( new_state == $scope.registration.state ) return;
+ $scope.info = { css_class: 'alert-warning', message: 'Changed state from "'+$scope.registration.state+'" to "'+new_state+'"' };
+ $scope.registration.state = new_state;
+ }
+
$scope.reset();
}
RegistrationCtrl.$inject = [ '$scope', '$log', 'Registration', '$routeParams', '$location', '$route', 'Organizations', 'RegistrationState' ];