← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14051: app for event capture - WIP, show/hide grid columns

 

------------------------------------------------------------
revno: 14051
committer: Abyot Asalefew Gizaw abyota@xxxxxxxxx
branch nick: dhis2
timestamp: Mon 2014-02-17 12:45:07 +0100
message:
  app for event capture - WIP, show/hide grid columns
modified:
  dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/app/i18n/en.json
  dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/app/scripts/controllers.js
  dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/app/views/eventList.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/app/i18n/en.json'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/app/i18n/en.json	2014-02-17 10:22:59 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/app/i18n/en.json	2014-02-17 11:45:07 +0000
@@ -16,7 +16,9 @@
     "cancel": "Cancel",
     "remove": "Remove",
     "are_you_sure_to_remove": "Are you sure you want to remove the selected item?",
-    "show_hide_columns": "Show/Hide columns",
+    "show_hide_columns": "Show/Hide grid columns",
+    "show_all": "Show all",
+    "hide": "Hide",
     "show_details": "Show details",
     "new_event": "New Event",
     "register_new_event": "Register New Event",

=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/app/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/app/scripts/controllers.js	2014-02-17 10:22:59 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/app/scripts/controllers.js	2014-02-17 11:45:07 +0000
@@ -32,6 +32,7 @@
     $scope.programStageDataElements = [];
     $scope.dhis2Events = [];
     $scope.eventRegistration = false;
+    $scope.editGridHeaders = false;
     $scope.eventGridHeaders = [];
     $scope.newDhis2Event = {dataValues: []};
     
@@ -125,7 +126,7 @@
                        var dataElement = $scope.programStageDataElements[dataElement];
                        var name = dataElement.formName || dataElement.name;
                        $scope.newDhis2Event.dataValues.push({dataElement: dataElement, value: '', name: name});                       
-                       $scope.eventGridHeaders.push({name: name, id: dataElement.id, filter: ''});
+                       $scope.eventGridHeaders.push({name: name, id: dataElement.id, filter: '', hide: false});
                    }                   
                });
             });            
@@ -147,6 +148,17 @@
         $scope.reverse = false;    
     };
     
+    $scope.showHideColumns = function(showAllColumns){
+        if(showAllColumns){
+            angular.forEach($scope.eventGridHeaders, function(gridHeader){
+                gridHeader.hide = false;
+            });
+        }
+        else{
+            $scope.editGridHeaders = !$scope.editGridHeaders;
+        }        
+    };
+    
     $scope.registerEvent = function(){
         $scope.eventRegistration = true;        
     };

=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/app/views/eventList.html'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/app/views/eventList.html	2014-02-17 10:22:59 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/app/views/eventList.html	2014-02-17 11:45:07 +0000
@@ -12,25 +12,55 @@
     <tr>
         <td style="vertical-align:top">
             <div id="content">
+                <div ng-show="editGridHeaders" class="container-1-4">
+                    <label>{{'show_hide_columns'| translate}}</label>
+                    <table>
+                        <tr ng-repeat="eventGridHeader in eventGridHeaders">
+                            <td>
+                                {{eventGridHeader.name}}
+                            </td>
+                            <td>
+                                <input type="checkbox" ng-model="eventGridHeader.hide">{{'hide'| translate}}
+                            </td>
+                        </tr>                    
+                        <tr>
+                            <td>
+                                <button ng-click="showHideColumns(false)">{{'close'| translate}}</button>
+                            </td>
+                            <td>
+                                <button ng-click="showHideColumns(true)">{{'show_all'| translate}}</button>
+                            </td>                        
+                        </tr>
+                    </table>
+                </div>
                 <table class="listTable dhis2-table-striped dhis2-table-hover">                    
                     <thead>
+                        <!--<tr ng-show="editGridHeaders">
+                            <td ng-repeat="eventGridHeader in eventGridHeaders">
+                                {{eventGridHeader.name}}&nbsp;&nbsp;<input type="checkbox" ng-model="eventGridHeader.hide">{{'hide'| translate}}
+                            </td>
+                            <td>
+                                <a href ng-click="showHideColumns(false)" title="{{'close'| translate}}" class="black"><i class="fa fa-times-circle"></i></a>
+                                <a href ng-click="showHideColumns(true)" title="{{'show_all'| translate}}" class="black"><i class="fa fa-check-square"></i></a>
+                            </td>
+                        </tr>-->
                         <tr>
-                            <th class="max-column-width" ng-click="sortEventGrid(eventGridHeader)" ng-repeat="eventGridHeader in eventGridHeaders">
+                            <th ng-show="!eventGridHeader.hide" class="max-column-width" ng-click="sortEventGrid(eventGridHeader)" ng-repeat="eventGridHeader in eventGridHeaders">
                                 {{eventGridHeader.name}}
                                 <i ng-show="sortHeader == eventGridHeader.id && !reverse" class="fa fa-sort-desc"></i>
                                 <i ng-show="sortHeader == eventGridHeader.id && reverse" class="fa fa-sort-asc"></i>
                             </th>
-                            <th>
-                                <a href ng-click="editGridHeader()" title="{{'show_hide_columns'| translate}}"><i class="fa fa-cog"></i></a>
+                            <th ng-hide="editGridHeaders">
+                                <a href ng-click="showHideColumns(false)" title="{{'show_hide_columns'| translate}}"><i class="fa fa-cog"></i></a>
                             </th>         
-                        </tr>
+                        </tr>                        
                     </thead>
                     <tbody id="list">
-                        <tr id={{dhis2Event.event}} data-id={{dhis2Event.event}} data-uid={{dhis2Event.event}} ng-repeat="dhis2Event in dhis2Events| paginate:rowsPerPage| orderBy:sortHeader:reverse" ng-click="showContextMenu(dhis2Event)">
-                            <td dhis-context-menu selected-item={{dhis2Event}} class="max-column-width" ng-hide="eventUnderEditing.event == dhis2Event.event" ng-repeat="eventGridHeader in eventGridHeaders">
+                        <tr ng-repeat="dhis2Event in dhis2Events| paginate:rowsPerPage| orderBy:sortHeader:reverse" ng-click="showContextMenu(dhis2Event)">
+                            <td dhis-context-menu selected-item={{dhis2Event}} class="max-column-width" ng-hide="(eventUnderEditing.event == dhis2Event.event) || eventGridHeader.hide" ng-repeat="eventGridHeader in eventGridHeaders">
                                 {{dhis2Event[eventGridHeader.id]}}                                              
                             </td>
-                            <td class="max-column-width" ng-show="eventUnderEditing.event == dhis2Event.event" ng-repeat="eventGridHeader in eventGridHeaders">
+                            <td class="max-column-width" ng-show="(eventUnderEditing.event == dhis2Event.event) && !eventGridHeader.hide" ng-repeat="eventGridHeader in eventGridHeaders">
                                 <div ng-switch="programStageDataElements[eventGridHeader.id].type">
                                     <div ng-switch-when="int">
                                         <input type="number" style="width:90%;" ng-model="eventUnderEditing[eventGridHeader.id]" value="eventUnderEditing[eventGridHeader.id]"/>
@@ -52,11 +82,7 @@
                                     </div>
                                 </div>
                             </td>
-                            <td>
-                                <!--<span ng-hide="eventUnderEditing == dhis2Event">
-                                <a href ng-click="editEvent(dhis2Event)" title="{{'edit'| translate}}"><span class='anchor-color'><i class="fa fa-pencil-square-o fa-2x"></i></span></a>
-                                <a href ng-click="deleteEvent(dhis2Event)" title="{{'delete'| translate}}"><span class='red'><i class="fa fa-trash-o fa-2x"></i></span></a>       
-                                </span>-->
+                            <td>                                
                                 <span ng-show="eventUnderEditing.event == dhis2Event.event">
                                     <a href ng-click="updateEvent(dhis2Event)" title="{{'update'| translate}}"><span class='black'><i class="fa fa-floppy-o fa-2x"></i></span></a>
                                     <a href ng-click="cancelEditing(dhis2Event)" title="{{'cancel'| translate}}"><span class='red'><i class="fa fa-undo fa-2x"></i></span></a>