← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18254: minor fix in persisting dashboard layout

 

------------------------------------------------------------
revno: 18254
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-02-13 12:45:18 +0100
message:
  minor fix in persisting dashboard layout
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-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/dashboard/dashboard-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js	2015-02-12 10:51:40 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js	2015-02-13 11:45:18 +0000
@@ -39,45 +39,45 @@
                 selectedLayout = $scope.dashboardLayouts [$scope.selectedProgram.id] ? $scope.dashboardLayouts [$scope.selectedProgram.id] : selectedLayout;
             }
 
-            for(var widget in selectedLayout.widgets){
-                switch(selectedLayout.widgets[widget].title){
+            angular.forEach(selectedLayout.widgets, function(widget){
+                switch(widget.title){
                     case 'enrollment':
-                        $rootScope.enrollmentWidget = selectedLayout.widgets[widget];
+                        $rootScope.enrollmentWidget = widget;
                         $rootScope.dashboardWidgets.push($rootScope.enrollmentWidget);
-                        $scope.dashboardStatus[widget] = selectedLayout.widgets[widget];
+                        $scope.dashboardStatus[widget.title] = angular.copy(widget);
                         break;
                     case 'dataentry':
-                        $rootScope.dataentryWidget = selectedLayout.widgets[widget];
+                        $rootScope.dataentryWidget = widget;
                         $rootScope.dashboardWidgets.push($rootScope.dataentryWidget);
-                        $scope.dashboardStatus[widget] = selectedLayout.widgets[widget];
+                        $scope.dashboardStatus[widget.title] = angular.copy(widget);
                         break;
                     case 'report':
-                        $rootScope.reportWidget = selectedLayout.widgets[widget];
+                        $rootScope.reportWidget = widget;
                         $rootScope.dashboardWidgets.push($rootScope.reportWidget);
-                        $scope.dashboardStatus[widget] = selectedLayout.widgets[widget];
+                        $scope.dashboardStatus[widget.title] = angular.copy(widget);
                         break;
                     case 'current_selections':
-                        $rootScope.selectedWidget = selectedLayout.widgets[widget];
+                        $rootScope.selectedWidget = widget;
                         $rootScope.dashboardWidgets.push($rootScope.selectedWidget);
-                        $scope.dashboardStatus[widget] = selectedLayout.widgets[widget];
+                        $scope.dashboardStatus[widget.title] = angular.copy(widget);
                         break;
                     case 'profile':
-                        $rootScope.profileWidget = selectedLayout.widgets[widget];
+                        $rootScope.profileWidget = widget;
                         $rootScope.dashboardWidgets.push($rootScope.profileWidget);
-                        $scope.dashboardStatus[widget] = selectedLayout.widgets[widget];
+                        $scope.dashboardStatus[widget.title] = angular.copy(widget);
                         break;
                     case 'relationships':
-                        $rootScope.relationshipWidget = selectedLayout.widgets[widget];
+                        $rootScope.relationshipWidget = widget;
                         $rootScope.dashboardWidgets.push($rootScope.relationshipWidget);
-                        $scope.dashboardStatus[widget] = selectedLayout.widgets[widget];
+                        $scope.dashboardStatus[widget.title] = angular.copy(widget);
                         break;    
                     case 'notes':
-                        $rootScope.notesWidget = selectedLayout.widgets[widget];
+                        $rootScope.notesWidget = widget;
                         $rootScope.dashboardWidgets.push($rootScope.notesWidget);
-                        $scope.dashboardStatus[widget] = selectedLayout.widgets[widget];
+                        $scope.dashboardStatus[widget.title] = angular.copy(widget);
                         break;    
                 }
-            }
+            });
 
             angular.forEach(orderByFilter($filter('filter')($scope.dashboardWidgets, {parent: "biggerWidget"}), 'order'), function(w){
                 $scope.dashboardWidgetsOrder.biggerWidgets.push(w.title);
@@ -235,7 +235,7 @@
         }
     };
     
-    $scope.saveDashboardLayout = function(){        
+    $scope.saveDashboardLayout = function(){
         var widgets = [];
         angular.forEach($rootScope.dashboardWidgets, function(widget){
             var w = angular.copy(widget);            
@@ -252,8 +252,6 @@
             }            
             widgets.push(w);
         });
-        
-        //$scope.dashboardLayouts 
             
         if($scope.selectedProgram && $scope.selectedProgram.id){
             $scope.dashboardLayouts[$scope.selectedProgram.id] = {widgets: widgets, program: $scope.selectedProgram.id};

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js	2015-02-12 14:25:04 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js	2015-02-13 11:45:18 +0000
@@ -112,8 +112,6 @@
                         $scope.dhis2Events.push(dhis2Event);
                     }
                 });
-                
-                console.log('the events:  ', $scope.dhis2Events);
             }
             
             $scope.dhis2Events = orderByFilter($scope.dhis2Events, '-sortingDate');