← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14529: minor

 

------------------------------------------------------------
revno: 14529
committer: Abyot Asalefew Gizaw abyota@xxxxxxxxx
branch nick: dhis2
timestamp: Fri 2014-03-28 19:02:06 +0100
message:
  minor
modified:
  dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/index.html
  dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/controllers.js


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/index.html'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/index.html	2014-03-28 17:25:21 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/index.html	2014-03-28 18:02:06 +0000
@@ -134,14 +134,17 @@
 
                 <!-- event grid begins -->
                 <div ng-show="selectedProgramStage && !eventRegistration && !editingEventInFull">                    
-                    <div ng-switch="eventLength">
+                    <img src="../images/ajax-loader-bar.gif" ng-if="!eventFetched"/>
+                    <div ng-switch="eventLength">                        
                         <div ng-switch-when="undefined">
                             <h2>
                                 {{'empty_event_list'| translate}}
                             </h2>
                         </div>                        
-                        <div ng-switch-when="0">
-                            <img id="ouwt_loader" src="../images/ajax-loader-bar.gif"/>
+                        <div ng-switch-when="0">  
+                            <h2 ng-if="eventFetched">
+                                {{'empty_event_list'| translate}}
+                            </h2>
                         </div>
                         <div ng-switch-default>
                             <h2>

=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/controllers.js	2014-03-28 17:25:21 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/controllers.js	2014-03-28 18:02:06 +0000
@@ -32,7 +32,7 @@
     $scope.editGridColumns = false;
     $scope.editingEventInFull = false;
     $scope.editingEventInGrid = false;   
-    $scope.currentGridColumnId = '';    
+    $scope.currentGridColumnId = '';       
     
     /*$scope.programStageDataElements = [];
                 
@@ -74,9 +74,11 @@
             if( programs && programs != 'undefined' ){
                 for(var i=0; i<programs.length; i++){
                     var program = storage.get(programs[i].id);   
-                    if(program.organisationUnits.hasOwnProperty(orgUnit.id)){
-                        $scope.programs.push(program);
-                    }
+                    if(angular.isObject(program)){
+                        if(program.organisationUnits.hasOwnProperty(orgUnit.id)){
+                            $scope.programs.push(program);
+                        }
+                    }                    
                 }
                 
                 if( !angular.isUndefined($scope.programs)){                    
@@ -95,6 +97,8 @@
         
         $scope.dhis2Events = [];
         $scope.eventLength = 0;
+
+        $scope.eventFetched = false;
                
         if( program ){
             
@@ -130,7 +134,9 @@
             //Load events for the selected program stage and orgunit
             DHIS2EventFactory.getByStage($scope.selectedOrgUnit.id, $scope.selectedProgramStage.id, pager ).then(function(data){
                 
-                $scope.eventLength = data.events.length;
+                if(data.events){
+                    $scope.eventLength = data.events.length;
+                }                
                 
                 $scope.dhis2Events = data.events; 
                 
@@ -183,7 +189,9 @@
                             i--;                           
                         }
                     }                                  
-                }                                            
+                }
+                
+                $scope.eventFetched = true;
             });            
         }        
     };
@@ -350,6 +358,8 @@
                 }
                 $scope.dhis2Events.splice(0,0,newEvent);
                 
+                $scope.eventLength++;
+                
                 //decide whether to stay in the current screen or not.
                 if(!addingAnotherEvent){
                     $scope.eventRegistration = false;