← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20473: tracker-capture: right side widgets stick/unstick is now saved as part of dashboard widgets confi...

 

------------------------------------------------------------
revno: 20473
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-10-02 14:05:43 +0200
message:
  tracker-capture: right side widgets stick/unstick is now saved as part of dashboard widgets configuration
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/dashboard/dashboard.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/sticky.min.js
  dhis-2/dhis-web/dhis-web-apps/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-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-10-02 10:23:45 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js	2015-10-02 12:05:43 +0000
@@ -88,6 +88,8 @@
                 selectedLayout = $scope.dashboardLayouts.customLayout && $scope.dashboardLayouts.customLayout[$scope.selectedProgram.id] ? $scope.dashboardLayouts.customLayout[$scope.selectedProgram.id] : $scope.dashboardLayouts.defaultLayout[$scope.selectedProgram.id];
             }            
             selectedLayout = !selectedLayout ?  defaultLayout : selectedLayout;
+            
+            $scope.stickyDisabled = selectedLayout.stickRightSide ? !selectedLayout.stickRightSide : true;
 
             angular.forEach(selectedLayout.widgets, function(widget){
                 $rootScope[widget.title +'Widget'] = widget;
@@ -399,6 +401,17 @@
         });
     };
     
+    $scope.stickUnstick = function(){        
+        $scope.stickyDisabled = !$scope.stickyDisabled;
+        
+        var layout = getCurrentDashboardLayout();        
+        var layoutKey = $scope.selectedProgram && $scope.selectedProgram.id ? $scope.selectedProgram.id : 'DEFAULT';        
+        layout[layoutKey].stickRightSide = !$scope.stickyDisabled;        
+        DashboardLayoutService.saveLayout(layout, false).then(function(){
+        });
+        
+    };
+    
     $scope.showHideWidgets = function(){
         var modalInstance = $modal.open({
             templateUrl: "components/dashboard/dashboard-widgets.html",

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard.html	2015-10-02 10:23:45 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard.html	2015-10-02 12:05:43 +0000
@@ -20,8 +20,12 @@
         
         <!-- dashboard setting begins -->
         <div class="pull-right">
-            <button type="button" title="{{stickyDisabled ? stickLabel : unstickLabel}}" class="btn btn-default" ng-click="stickyDisabled = !stickyDisabled">                    
-                <i class="fa fa-thumb-tack" ng-class="{true: 'red'} [!stickyDisabled]"></i>
+            <button type="button" 
+                    title="{{stickyDisabled ? stickLabel : unstickLabel}}" 
+                    class="btn btn-default" 
+                    ng-class="{true: 'stick', false: 'unstick'} [!stickyDisabled]" 
+                    ng-click="stickUnstick()">                    
+                <i class="fa fa-thumb-tack"></i>
             </button>
             <div class="btn-group trim" dropdown is-open="status.isopen">
                 <button type="button" title="{{settingsLabel}}" class="btn btn-default dropdown-toggle" dropdown-toggle>                    

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/sticky.min.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/sticky.min.js	2015-10-02 11:18:57 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/sticky.min.js	2015-10-02 12:05:43 +0000
@@ -217,7 +217,6 @@
 
           $scope.checkIfShouldStick = function () {
             if ($scope.disabled === true){
-                console.log('sticky disabled...');
               $scope.unStickElement();
               return false;
             }
@@ -315,7 +314,6 @@
           };
 
           $scope.$watch(function () {
-              console.log('sticky changed....', $scope.disabled);
             // triggered on load and on digest cycle
             if ($scope.disabled === true){
               $scope.unStickElement();

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css	2015-10-02 10:23:45 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css	2015-10-02 12:05:43 +0000
@@ -191,8 +191,15 @@
     border-color: #aaa29a;
 }
 
-.red {
-    color: red;
+.stick {
+    font-weight: bolder;
+    color: #000000;
+    background-color: #6E6E6E; 
+}
+
+.unstick {
+    color: #000000;
+    background-color: #FFFFFF;
 }
 
 .right {