← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14476: column show/hide dialog improved

 

------------------------------------------------------------
revno: 14476
committer: Abyot Asalefew Gizaw abyota@xxxxxxxxx
branch nick: dhis2
timestamp: Thu 2014-03-27 11:00:29 +0100
message:
  column show/hide dialog improved
modified:
  dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/event-capture.appcache
  dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/i18n/en.json
  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
  dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/directives.js
  dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/column-modal.html


--
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/event-capture.appcache'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/event-capture.appcache	2014-03-19 10:37:49 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/event-capture.appcache	2014-03-27 10:00:29 +0000
@@ -83,6 +83,7 @@
 views/serverside-pagination.html
 views/modal.html
 views/dialog.html
+views/column-modal.html
 
 i18n/en.json
 

=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/i18n/en.json'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/i18n/en.json	2014-03-26 22:33:08 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/i18n/en.json	2014-03-27 10:00:29 +0000
@@ -24,7 +24,7 @@
     "show_hide_columns": "Show/Hide columns",
     "show_all": "Show all",
     "hide": "Hide",
-    "select_columns_to_hide": "Select columns to hide",
+    "select_columns_to_show": "Select columns to show",
     "show_details": "Show details",
     "new_event": "New Event",
     "data_element": "Data element",

=== 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-26 22:33:08 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/index.html	2014-03-27 10:00:29 +0000
@@ -170,7 +170,7 @@
                                 <table class="listTable dhis2-table-striped-border dhis2-table-hover">                                       
                                     <thead>                        
                                         <tr>
-                                            <th ng-show="!eventGridColumn.hide" 
+                                            <th ng-show="eventGridColumn.show" 
                                                 class="max-column-width"                                                
                                                 ng-repeat="eventGridColumn in eventGridColumns">
                                                 
@@ -223,7 +223,7 @@
                                             <td dhis-context-menu 
                                                 selected-item={{dhis2Event}} 
                                                 class="max-column-width" 
-                                                ng-hide="(currentEvent.event == dhis2Event.event) || eventGridColumn.hide" 
+                                                ng-hide="(currentEvent.event == dhis2Event.event) || !eventGridColumn.show" 
                                                 ng-repeat="eventGridColumn in eventGridColumns">                                                
                                                 {{dhis2Event[eventGridColumn.id]}}                                                
                                             </td>
@@ -231,7 +231,7 @@
                                             <!-- Visible when event is under editing - in grid -->
                                             <td class="max-column-width"
                                                 style="cursor:default;"                                                
-                                                ng-if="(currentEvent.event == dhis2Event.event) && !eventGridColumn.hide" 
+                                                ng-if="(currentEvent.event == dhis2Event.event) && eventGridColumn.show" 
                                                 ng-repeat="eventGridColumn in eventGridColumns">
                                                 <ng-form name="innerFormGrid">
                                                     <div ng-switch="eventGridColumn.type">

=== 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-26 22:33:08 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/controllers.js	2014-03-27 10:00:29 +0000
@@ -35,13 +35,13 @@
     $scope.editingEventInGrid = false;   
     $scope.currentGridColumnId = '';    
     
-    $scope.programStageDataElements = [];
+    /*$scope.programStageDataElements = [];
                 
     $scope.dhis2Events = [];
     $scope.eventGridColumns = [];
     $scope.hiddenGridColumns = 0;
     $scope.newDhis2Event = {dataValues: []};
-    $scope.currentEvent = {dataValues: []};
+    $scope.currentEvent = {dataValues: []};*/    
     $scope.currentEventOrginialValue = '';   
     
     //watch for selection of org unit from tree
@@ -103,7 +103,7 @@
 
             $scope.programStageDataElements = [];  
             $scope.eventGridColumns = [];
-            $scope.hiddenGridColumns = 0;
+
             $scope.newDhis2Event = {dataValues: []};
             $scope.currentEvent = {dataValues: []};
 
@@ -116,7 +116,7 @@
                 var dataElement = prStDe.dataElement;
                 var name = dataElement.formName || dataElement.name;
                 $scope.newDhis2Event.dataValues.push({id: dataElement.id, value: ''});                       
-                $scope.eventGridColumns.push({name: name, id: dataElement.id, type: dataElement.type, compulsory: prStDe.compulsory, showFilter: false, hide: false});
+                $scope.eventGridColumns.push({name: name, id: dataElement.id, type: dataElement.type, compulsory: prStDe.compulsory, showFilter: false, show: prStDe.displayInReports});
 
                 if(dataElement.type === 'date'){
                      $scope.filterText[dataElement.id]= {start: '', end: ''};
@@ -206,7 +206,15 @@
         $scope.reverse = false;    
     };
     
-    $scope.showHideColumns = function(){               
+    $scope.showHideColumns = function(){
+        
+        $scope.hiddenGridColumns = 0;
+        
+        angular.forEach($scope.eventGridColumns, function(eventGridColumn){
+            if(!eventGridColumn.show){
+                $scope.hiddenGridColumns++;
+            }
+        })
         
         var modalInstance = $modal.open({
             templateUrl: 'views/column-modal.html',
@@ -473,21 +481,13 @@
       $modalInstance.close($scope.eventGridColumns);
     };
     
-    $scope.showHideColumns = function(gridColumn, showAllColumns){
-        if(showAllColumns){
-            angular.forEach($scope.eventGridColumns, function(gridHeader){
-                gridHeader.hide = false;                
-            });
-            $scope.hiddenGridColumns = 0;
-        }
-        if(!showAllColumns){            
-            if(gridColumn.hide){
-                $scope.hiddenGridColumns++;
-            }
-            else{
-                $scope.hiddenGridColumns--;
-            }
-        }
-    };
-    
+    $scope.showHideColumns = function(gridColumn){
+       
+        if(gridColumn.show){                
+            $scope.hiddenGridColumns--;            
+        }
+        else{
+            $scope.hiddenGridColumns++;            
+        }      
+    };    
 });
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/directives.js'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/directives.js	2014-03-26 10:34:25 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/directives.js	2014-03-27 10:00:29 +0000
@@ -203,6 +203,15 @@
     };
 })
 
+.directive('modalWindow', function(){
+    return {
+      restrict: 'EA',
+      link: function(scope, element) {
+        element.draggable();
+      }
+    };  
+})
+  
 .directive('clientsidePaginator', function factory() {
     return {
         restrict: 'E',

=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/column-modal.html'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/column-modal.html	2014-03-26 22:33:08 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/column-modal.html	2014-03-27 10:00:29 +0000
@@ -1,5 +1,5 @@
 <div class="modal-header">
-    <h3>{{'select_columns_to_hide'| translate}}</h3>
+    <h3>{{'select_columns_to_show'| translate}}</h3>
 </div>
 
 <div class="modal-body">   
@@ -9,13 +9,12 @@
                 {{eventGridColumn.name}}
             </td>
             <td>
-                <input type="checkbox" ng-model="eventGridColumn.hide" ng-change="showHideColumns(eventGridColumn, false)" ng-disabled="hiddenGridColumns + 1 == eventGridColumns.length && !eventGridColumn.hide">
+                <input type="checkbox" ng-model="eventGridColumn.show" ng-change="showHideColumns(eventGridColumn)" ng-disabled="hiddenGridColumns + 1 == eventGridColumns.length && eventGridColumn.show">
             </td>
         </tr>                                    
     </table>    
 </div>
 
-<div class="modal-footer">    
-    <button ng-click="showHideColumns(null, true)" ng-disabled="hiddenGridColumns < 1">{{'show_all'| translate}}</button>
+<div class="modal-footer">        
     <button data-ng-click="close()">{{'close'| translate}}</button>
 </div> 
\ No newline at end of file