← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20125: tracker-capture: minor refactoring

 

------------------------------------------------------------
revno: 20125
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-09-14 12:11:37 +0200
message:
  tracker-capture: minor refactoring
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.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-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js	2015-09-11 15:16:03 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js	2015-09-14 10:11:37 +0000
@@ -465,9 +465,6 @@
         
         if($scope.showRegistrationDiv){
             $scope.showTrackedEntityDiv = false;
-            /*$timeout(function() { 
-                $rootScope.$broadcast('registrationWidget', {registrationMode: 'RELATIONSHIP'});
-            }, 100);*/
         }
         else{
             $scope.showTrackedEntityDiv = true;            
@@ -562,20 +559,22 @@
     
     var selections = CurrentSelection.get();
     $scope.optionSets = selections.optionSets;
-    $scope.programs = selections.prs;    
+    $scope.programs = selections.prs;
+    
+    var getProgramAttributes = function(program){
+        AttributesFactory.getByProgram(program).then(function(atts){
+            $scope.attributes = atts;
+        });
+    };
   
     if(angular.isObject($scope.programs) && $scope.programs.length === 1){
         $scope.selectedProgramForRelative = $scope.programs[0];
-        AttributesFactory.getByProgram($scope.selectedProgramForRelative).then(function(atts){
-            $scope.attributes = atts;
-        });
+        getProgramAttributes($scope.selectedProgramForRelative);
     }  
     
     //watch for selection of program
-    $scope.$watch('selectedProgramForRelative', function() {        
-        AttributesFactory.getByProgram($scope.selectedProgramForRelative).then(function(atts){
-            $scope.attributes = atts;
-        });
+    $scope.$watch('selectedProgramForRelative', function() {
+        getProgramAttributes($scope.selectedProgramForRelative);
     }); 
             
     $scope.trackedEntities = {available: []};