X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=app%2Fjs%2Fcontrollers.js;h=4ddca47c4f37fc02f661e32004042170543ad171;hb=7dfbd7031b7ca284c8551f65dcd8b0a2ba0a5594;hp=3561aff8471fab98c5d5a27cd7c7a34373a3bf7e;hpb=b14309c11bae263d6b897edf5e64393bcc76f469;p=angular-drzb diff --git a/app/js/controllers.js b/app/js/controllers.js index 3561aff..4ddca47 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -2,7 +2,7 @@ /* Controllers */ -function RegistrationCtrl($scope, $log, Registration, $routeParams, $location, $route, Organizations, RegistrationState) { +function RegistrationCtrl($scope, $log, Registration, $routeParams, $location, $route, Organizations, ValidStates) { $scope.$routeParams = $routeParams; $scope.$location = $location; @@ -11,7 +11,7 @@ function RegistrationCtrl($scope, $log, Registration, $routeParams, $location, $ $scope.organizations = data; $log.info('organizations promise ', $scope.organizations); }); - $scope.RegistrationState = RegistrationState(); + $scope.ValidStates = ValidStates(); $scope.info = { message: '', css_class: '' } ; // alert box @@ -160,6 +160,7 @@ function RegistrationCtrl($scope, $log, Registration, $routeParams, $location, $ $scope.show_submission_type = function() { // FIXME check if all submission are allowed by date and allow them! + if ( angular.isUndefined( $scope.user ) || angular.isUndefined( $scope.registration ) ) return false; return ( angular.isUndefined( $scope.user.registration_type ) // new registration || angular.isUndefined( $scope.registration.state ) // not saved yet @@ -173,9 +174,9 @@ function RegistrationCtrl($scope, $log, Registration, $routeParams, $location, $ $scope.reset(); } -RegistrationCtrl.$inject = [ '$scope', '$log', 'Registration', '$routeParams', '$location', '$route', 'Organizations', 'RegistrationState' ]; +RegistrationCtrl.$inject = [ '$scope', '$log', 'Registration', '$routeParams', '$location', '$route', 'Organizations', 'ValidStates' ]; -function ListCtrl($scope, $log, Registration, RegistrationTypes, $filter, RegistrationState ) { +function ListCtrl($scope, $log, Registration, RegistrationTypes, $filter, ValidStates ) { $scope.list = []; $scope.list_results = 0; @@ -196,7 +197,7 @@ function ListCtrl($scope, $log, Registration, RegistrationTypes, $filter, Regist states: true, pager_numeric: false }; - $scope.RegistrationState = RegistrationState(); + $scope.ValidStates = ValidStates(); $scope.create_counts = function( array ) { $log.info('create_counts', array.length ); @@ -289,5 +290,5 @@ function ListCtrl($scope, $log, Registration, RegistrationTypes, $filter, Regist } } -ListCtrl.$inject = [ '$scope', '$log', 'Registration', 'RegistrationTypes', '$filter', 'RegistrationState' ]; +ListCtrl.$inject = [ '$scope', '$log', 'Registration', 'RegistrationTypes', '$filter', 'ValidStates' ];