hide pagination if showing all results
[angular-drzb] / app / js / controllers.js
index 33bafe3..3561aff 100644 (file)
@@ -158,6 +158,19 @@ function RegistrationCtrl($scope, $log, Registration, $routeParams, $location, $
                $scope.registration.state = new_state;
        }
 
+       $scope.show_submission_type = function() {
+               // FIXME check if all submission are allowed by date and allow them!
+               return (
+                       angular.isUndefined( $scope.user.registration_type ) // new registration
+                       || angular.isUndefined( $scope.registration.state ) // not saved yet
+                       || $scope.registration.state == 'draft'
+                       || $scope.registration.state == 'confirmation'
+               ) ? false : true;
+       }
+       $scope.show_registration_type = function() {
+               return true;
+       }
+
        $scope.reset();
 }
 RegistrationCtrl.$inject = [ '$scope', '$log', 'Registration', '$routeParams', '$location', '$route', 'Organizations', 'RegistrationState' ];
@@ -170,7 +183,8 @@ function ListCtrl($scope, $log, Registration, RegistrationTypes, $filter, Regist
                page: 1,
                limit: 10,
                results: 1,
-               last_page: 1
+               last_page: 1,
+               show_all: false
        };
        $scope.search = {};
        $scope.ready = false;
@@ -254,7 +268,7 @@ function ListCtrl($scope, $log, Registration, RegistrationTypes, $filter, Regist
                var from = ( $scope.pager.page - 1 ) * $scope.pager.limit;
                $scope.list = [];
                angular.forEach( filtered, function(v,k) {
-                       if ( k >= from && k < from + $scope.pager.limit ) {
+                       if ( k >= from && k < from + $scope.pager.limit || $scope.pager.show_all ) {
                                v.nr = k + 1;
                                this.push(v);
                        }