dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #19820
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8803: mobile: notification if there are no orgUnits available
------------------------------------------------------------
revno: 8803
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-10-31 19:22:26 +0100
message:
mobile: notification if there are no orgUnits available
modified:
dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/data-entry.vm
dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/dhis-web-mobile-resources/js/dhis2.storage.js
--
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-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/data-entry.vm'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/data-entry.vm 2012-10-31 13:05:25 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/data-entry.vm 2012-10-31 18:22:26 +0000
@@ -266,9 +266,13 @@
<script id="organisation-units-template" type="text/template">
<ul id="organisation-unit-list" data-role="listview" data-inset="true">
- <% _( organisationUnits ).each( function(organisationUnit, idx) { %>
- <li><a href="#data-sets-page" data-id="<%= organisationUnit.id %>"><%= organisationUnit.label %></a></li>
- <% }); %>
+ <% if( _.size( organisationUnits ) > 0 ) { %>
+ <% _( organisationUnits ).each( function(organisationUnit, idx) { %>
+ <li><a href="#data-sets-page" data-id="<%= organisationUnit.id %>"><%= organisationUnit.label %></a></li>
+ <% }); %>
+ <% } else { %>
+ <li>No organisation units available for data entry</li>
+ <% } %>
</ul>
</script>
=== modified file 'dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/dhis-web-mobile-resources/js/dhis2.storage.js'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/dhis-web-mobile-resources/js/dhis2.storage.js 2012-10-30 15:56:17 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/dhis-web-mobile-resources/js/dhis2.storage.js 2012-10-31 18:22:26 +0000
@@ -39,8 +39,17 @@
url : '../api/currentUser/forms',
dataType : 'json'
}).success(function ( data ) {
- localStorage['organisationUnits'] = JSON.stringify(data.organisationUnits);
- localStorage['forms'] = JSON.stringify(data.forms);
+ if( data.organisationUnits ) {
+ localStorage['organisationUnits'] = JSON.stringify(data.organisationUnits);
+ } else {
+ localStorage['organisationUnits'] = JSON.stringify({});
+ }
+
+ if( data.forms ) {
+ localStorage['forms'] = JSON.stringify(data.forms);
+ } else {
+ localStorage['forms'] = JSON.stringify({});
+ }
});
};