make invalid abstract big and red
[angular-drzb] / app / js / controllers.js
index eabec94..e173fd5 100644 (file)
@@ -105,7 +105,6 @@ if(0){//FIXME
        $scope.change_student = function() {
                if ( $scope.user.student ) {
                        $scope.user.hpd_member = false;
-                       $scope.user.reception = false;
                        $scope.user.dinner = false;
                }
        }
@@ -128,6 +127,33 @@ if(0){//FIXME
                works.push({ persons: [{}] });
        }
 
+       $scope.symposium_work_remove = function(work_index) {
+               if ( ! angular.isNumber(work_index) ) {
+                       $log.error("work_index", work_index);
+                       return;
+               }
+               var works = $scope.work.symposium_works;
+               $log.info('symposium_work_remove', works, work_index);
+               var removed = works.splice( work_index, 1 );
+               if ( angular.isArray(removed) && removed[0] ) {
+                       removed = removed[0];
+                       removed.deleted = true;
+                       if ( ! angular.isArray( $scope.work.symposium_works_deleted ) )
+                               $scope.work.symposium_works_deleted = [];
+                       $scope.work.symposium_works_deleted.push( removed );
+                       $log.info("work deleted", works);
+               } else {
+                       $log.warn("symposium_work_remove no work to remove", works, work);
+               }
+       }
+
+       $scope.abstract_class = function(abstract) {
+               return abstract.length < 2000 ? 'ok' : 'ng-invalid';
+       }
+       $scope.abstract_length = function(abstract) {
+               return abstract.length < 2000 ? abstract.length : 2000 - abstract.length;
+       }
+
        $scope.reset();
 }
 //RegistrationCtrl.$inject = [ '$scope', '$log' ];