controller logic to show submission and registration radio buttons
authorDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 25 Jan 2013 16:11:23 +0000 (17:11 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 25 Jan 2013 16:11:23 +0000 (17:11 +0100)
app/js/controllers.js
app/partials/registration.html.ep

index 33bafe3..6ff5079 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' ];
index cde9f88..24e1364 100644 (file)
@@ -9,20 +9,19 @@
 
 <form ng-controller="RegistrationCtrl" name="RegistrationForm" class="span12">
 
-<fieldset class="controls">
+<fieldset class="controls" ng-show="show_submission_type()">
 
 <legend><%= locale
        en => 'Registration type',
-       hr => 'Odaberite tip registracije'
+       hr => 'Odaberite tip prijave'
 %></legend>
 
-% if (0) {
 <label class="radio"><input type="radio" ng-model="user.registration_type" value="lecture" ><%= locale
        en => 'Oral presentation',
        hr => 'Prijava usmenog izlaganja',
 %></label>
 <label class="radio"><input type="radio" ng-model="user.registration_type" value="poster" ><%= locale
-       en => 'Poster prezentation',
+       en => 'Poster presentation',
        hr => 'Prijava poster prezentacije'
 %></label>
 <label class="radio"><input type="radio" ng-model="user.registration_type" value="symposium" ><%= locale
     en => 'Round table',
        hr => 'Prijava okruglog stola',
 %></label>
-<hr />
-% }
+
+</fieldset>
+
+<fieldset class="controls" ng-show="show_registration_type()">
+
+<legend><!-- show line -->
+</legend>
 
 <label class="radio"><input type="radio" ng-model="user.registration_type" value="participant" ><%= locale
     en => 'Registration',
        hr => 'Registracija'
 %></label>
+
 <label class="radio"><input type="radio" ng-model="user.registration_type" value="accomp" ><%= locale
     en => 'Registration for accompanying persons',
        hr => 'Registracija za osobe u pratnji' %>
 </label>
+
 </fieldset>
 
 <fieldset ng-show="user.registration_type">