← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15760: profile widget now gets title from selected tei

 

------------------------------------------------------------
revno: 15760
committer: Abyot Asalefew Gizaw abyota@xxxxxxxxx
branch nick: dhis2
timestamp: Thu 2014-06-19 12:07:22 +0200
message:
  profile widget now gets title from selected tei
modified:
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/profile/profile-controller.js
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/services.js
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/styles/style.css


--
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-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/profile/profile-controller.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/profile/profile-controller.js	2014-06-17 07:48:20 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/profile/profile-controller.js	2014-06-19 10:07:22 +0000
@@ -1,7 +1,7 @@
 trackerCapture.controller('ProfileController',
         function($scope,                
-                storage,
                 CurrentSelection,
+                TEService,
                 TEIService,
                 AttributesFactory,
                 TranslationService) {
@@ -23,20 +23,20 @@
         var selections = CurrentSelection.get();
         $scope.selectedEntity = selections.tei; 
         $scope.selectedProgram = selections.pr; 
-
-        $scope.processTeiAttributes();
+        
+        if($scope.selectedEntity){
+            TEService.get($scope.selectedEntity.trackedEntity).then(function(te){
+                $scope.trackedEntity = te;
+            });
+            
+            $scope.processTeiAttributes();
+        }
         
     });
     
     //display only those attributes that belong the selected program
     //if no program, display attributesInNoProgram
-    $scope.processTeiAttributes = function(){
-       
-        angular.forEach(storage.get('TRACKED_ENTITIES'), function(te){
-            if($scope.selectedEntity.trackedEntity === te.id){
-                $scope.trackedEntity = te;
-            }
-        });
+    $scope.processTeiAttributes = function(){        
         
         angular.forEach($scope.selectedEntity.attributes, function(att){
             if(att.type === 'number' && !isNaN(parseInt(att.value))){

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/services.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/services.js	2014-06-17 07:48:20 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/services.js	2014-06-19 10:07:22 +0000
@@ -203,6 +203,18 @@
                 });
             });            
             return def.promise;
+        },
+        get: function(uid){            
+            var def = $q.defer();
+            
+            StorageService.currentStore.open().done(function(){
+                StorageService.currentStore.get('trackedEntities', uid).done(function(te){                    
+                    $rootScope.$apply(function(){
+                        def.resolve(te);
+                    });
+                });
+            });                        
+            return def.promise;            
         }
     };
 })

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/styles/style.css'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/styles/style.css	2014-06-19 09:37:45 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/styles/style.css	2014-06-19 10:07:22 +0000
@@ -719,25 +719,11 @@
     padding: 6px 12px;
     font-size: 14px;
 }
-/*input[type=number], input[type=text], input[type=password], textarea {
-    border: 1px solid #aaa;
-    padding: 6px 12px;
-    font-size: 14px;
-}
-
-input[type=number] {
-    border: 1px solid #aaa;
-    padding: 4px 1px;
-    border-radius: 3px;
-}
-
-input[type=text], input[type=password], textarea, select {
-    border: 1px solid #aaa;
-    padding: 6px 12px;
-    font-size: 14px;
-    border-radius: 3px;
-}*/
-
+input[type=number], input[type=text], input[type=password], textarea {
+    border: 1px solid #aaa;
+    padding: 6px 12px;
+    font-size: 14px;
+}
 
 /*----------------------------------------------------------------------------*/
 /* Search filters