← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19103: event-capture - minor changes: apply paging only when needed; bug fix on showing print button

 

------------------------------------------------------------
revno: 19103
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-05-07 10:21:29 +0200
message:
  event-capture - minor changes: apply paging only when needed; bug fix on showing print button
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/services.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/home.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-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js	2015-05-04 07:52:12 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js	2015-05-07 08:21:29 +0000
@@ -227,7 +227,7 @@
                 $scope.selectedProgram.programStages[0].id){
             
             //Load events for the selected program stage and orgunit
-            DHIS2EventFactory.getByStage($scope.selectedOrgUnit.id, $scope.selectedProgramStage.id, $scope.pager ).then(function(data){
+            DHIS2EventFactory.getByStage($scope.selectedOrgUnit.id, $scope.selectedProgramStage.id, $scope.pager, true ).then(function(data){
 
                 if(data.events){
                     $scope.eventLength = data.events.length;

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/services.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/services.js	2015-05-04 07:52:12 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/services.js	2015-05-07 08:21:29 +0000
@@ -298,12 +298,20 @@
 .factory('DHIS2EventFactory', function($http, $q, ECStorageService, $rootScope) {   
     
     return {
-        getByStage: function(orgUnit, programStage, pager){
-        	var pgSize = pager ? pager.pageSize : 50;
-        	var pg = pager ? pager.page : 1;
-            pgSize = pgSize > 1 ? pgSize  : 1;
-            pg = pg > 1 ? pg : 1;              
-            var url = '../api/events.json?' + 'orgUnit=' + orgUnit + '&programStage=' + programStage + '&pageSize=' + pgSize + '&page=' + pg + '&totalPages=true';
+        getByStage: function(orgUnit, programStage, pager, paging){
+            
+            var url = '../api/events.json?' + 'orgUnit=' + orgUnit + '&programStage=' + programStage;
+            
+            if(paging){
+                var pgSize = pager ? pager.pageSize : 50;
+                var pg = pager ? pager.page : 1;
+                pgSize = pgSize > 1 ? pgSize  : 1;
+                pg = pg > 1 ? pg : 1; 
+                url = url  + '&pageSize=' + pgSize + '&page=' + pg + '&totalPages=true';
+            }
+            else{
+                url = url  + '&skipPaging=true';
+            }
             
             var promise = $http.get( url ).then(function(response){                    
                 return response.data;        

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/home.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/home.html	2015-04-30 11:28:47 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/home.html	2015-05-07 08:21:29 +0000
@@ -52,7 +52,7 @@
                         {{'register_event'| translate}}
                     </button>  
                 </td>
-                <td ng-if="dhis2Events.length > 0" style='padding-left: 10px;'>
+                <td ng-if="dhis2Events.length > 0 || eventRegistration || editingEventInFull" style='padding-left: 10px;'>
                     <button class="button button-std hideInPrint"
                             onclick="javascript:window.print()">
                         <span ng-if="!eventRegistration && !editingEventInFull">{{'print_list'| translate}}</span>