------------------------------------------------------------ revno: 10067 committer: Morten Olav Hansen <morte...@gmail.com> branch nick: dhis2 timestamp: Fri 2013-03-08 11:41:32 +0300 message: FRED-API: added very basic pager to UI modified: dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FacilityController.java dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity/v1/facilities.vm
-- 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-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FacilityController.java' --- dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FacilityController.java 2013-03-08 06:21:00 +0000 +++ dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FacilityController.java 2013-03-08 08:41:32 +0000 @@ -341,6 +341,16 @@ model.addAttribute( "pageName", "facilities" ); model.addAttribute( "page", FredController.PREFIX + "/facilities.vm" ); + if ( offset == 0 ) + { + model.addAttribute( "prevDisabled", true ); + } + + if ( (offset + limitValue) >= organisationUnitService.getNumberOfOrganisationUnits() ) + { + model.addAttribute( "nextDisabled", true ); + } + return FredController.PREFIX + "/layout"; } === modified file 'dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity/v1/facilities.vm' --- dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity/v1/facilities.vm 2013-03-07 19:03:23 +0000 +++ dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity/v1/facilities.vm 2013-03-08 08:41:32 +0000 @@ -34,13 +34,13 @@ var lngs = 0.0; var n = 0; - $.each(facilities, function (idx, item) { - if (item.coordinates !== undefined && JSON.parse(item.coordinates).length > 0) { - var coords = JSON.parse(item.coordinates); + $.each(facilities, function (idx, facility) { + if (facility.coordinates !== undefined && JSON.parse(facility.coordinates).length > 0) { + var coords = JSON.parse(facility.coordinates); var latlng = new google.maps.LatLng(coords[1], coords[0]); - var name = item.name; - var id = item.uuid; - var href = item.href; + var name = facility.name; + var id = facility.uuid; + var href = facility.href; lats += coords[1]; lngs += coords[0]; @@ -199,6 +199,15 @@ #end </tbody> </table> + +<div class="pagination pagination-right"> + <ul> + #set( $nextOffset = $entity.meta.offset + $entity.meta.limit) + #set( $prevOffset = $entity.meta.offset - $entity.meta.limit) + <li class="#if($prevDisabled)disabled#end"><a class="prev-button" href="facilities?offset=$prevOffset">Prev</a></li> + <li class="#if($nextDisabled)disabled#end"><a class="next-button" href="facilities?offset=$nextOffset">Next</a></li> + </ul> +</div> #end #macro( mapContent )
_______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp