← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8610: mobile: removed async: false, makes loader work correctly for long running requests

 

------------------------------------------------------------
revno: 8610
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2012-10-21 17:12:36 +0200
message:
  mobile: removed async: false, makes loader work correctly for long running requests
modified:
  dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/base.vm
  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/message.vm
  dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/new-message.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-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/base.vm'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/base.vm	2012-10-21 14:38:57 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/base.vm	2012-10-21 15:12:36 +0000
@@ -1,6 +1,6 @@
 <!DOCTYPE html>
-<html manifest="../dhis-web-mobile-resources/manifest.appcache">
-<!--  <html> -->
+<!--  <html manifest="../dhis-web-mobile-resources/manifest.appcache"> -->
+<html>
 <head>
 	<title>DHIS2</title>
 	<meta name="viewport" content="width=device-width, initial-scale=1">

=== 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-21 14:38:30 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/data-entry.vm	2012-10-21 15:12:36 +0000
@@ -182,7 +182,7 @@
             value: field.val()
            };
 
-           dataValues.push(dataValue);
+           dataValues.push( dataValue );
         });
 
         dataValueSet.dataValues = dataValues;

=== modified file 'dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/message.vm'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/message.vm	2012-10-10 17:14:33 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/message.vm	2012-10-21 15:12:36 +0000
@@ -1,24 +1,22 @@
 
 <script>
-    jQuery(document).bind('pagebeforecreate', function () {
-        jQuery.ajax({
+    $(document).bind('pageinit', function() {
+        $.ajax({
             url   : '$baseUrl/../api/messageConversations/${messageId}.json',
-            dataType: 'json',
-            async : false
+            dataType: 'json'
         }).success(function ( data ) {
             var tmpl = jQuery('#message-template').html();
 
-            jQuery('section[data-role="content"]').html(
+            $('section[data-role="content"]').html(
                 _.template(tmpl, data)
             );
 
-            console.log(data);
+            $('section[data-role="content"]').trigger('create');
         }).error(function () {
-            console.log('error fetching message')
+            $.mobile.showPageLoadingMsg( $.mobile.pageLoadErrorMessageTheme, "Unable to load message, please try again later", true );
+            setTimeout( $.mobile.hidePageLoadingMsg, 1500 );
         });
-    });
 
-    jQuery(document).bind('pageinit', function() {
        $('#reply-form input:submit').bind('click', function(e) {
             var msg = jQuery('#reply-text').val();
 
@@ -40,7 +38,6 @@
            }).error(function () {
                $.mobile.showPageLoadingMsg( $.mobile.pageLoadErrorMessageTheme, "Unable to send reply, please try again later", true );
                setTimeout( $.mobile.hidePageLoadingMsg, 1500 );
-               console.log("failed to send message");
            });
 
            e.preventDefault();

=== modified file 'dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/new-message.vm'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/new-message.vm	2012-10-18 14:06:57 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/new-message.vm	2012-10-21 15:12:36 +0000
@@ -108,10 +108,11 @@
                 return;
             }
 
+            $.mobile.showPageLoadingMsg();
+
             $.ajax({
                 url  : '$baseUrl/../api/currentUser/recipients',
                 type : 'get',
-                async: false,
                 dataType: 'json',
                 data : {
                     'filter' : search
@@ -145,7 +146,10 @@
                 }
 
                 $('#selection-list').listview('refresh');
-
+                $.mobile.hidePageLoadingMsg();
+            }).error(function() {
+                $.mobile.showPageLoadingMsg( $.mobile.pageLoadErrorMessageTheme, "Unable to search, please try again later", true );
+                setTimeout( $.mobile.hidePageLoadingMsg, 1500 );
             });
 
             $('form[role="search"] input:text').bind('keyup', fn1);