← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17506: move discard button to only show when upload fails

 

------------------------------------------------------------
revno: 17506
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-11-17 22:29:14 +0700
message:
  move discard button to only show when upload fails
modified:
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.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-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2014-11-17 15:08:22 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2014-11-17 15:29:14 +0000
@@ -182,13 +182,11 @@
 	        if ( dhis2.de.storageManager.hasLocalData() )
 	        {
 	            var message = i18n_need_to_sync_notification
-	            	+ ' <button id="sync_button" type="button">' + i18n_sync_now + '</button>'
-	            	+ ' <button id="discard_button" type="button">' + i18n_discard + '</button>';
+	            	+ ' <button id="sync_button" type="button">' + i18n_sync_now + '</button>';
 
 	            setHeaderMessage( message );
 
 	            $( '#sync_button' ).bind( 'click', dhis2.de.uploadLocalData );
-	            $( '#discard_button' ).bind( 'click', dhis2.de.discardLocalData );
 	        }
 	        else
 	        {
@@ -349,10 +347,13 @@
             	else // Connection lost during upload
         		{
                     var message = i18n_sync_failed
-                        + ' <button id="sync_button" type="button">' + i18n_sync_now + '</button>';
+                        + ' <button id="sync_button" type="button">' + i18n_sync_now + '</button>'
+                        + ' <button id="discard_button" type="button">' + i18n_discard + '</button>';
 
                     setHeaderMessage( message );
+
                     $( '#sync_button' ).bind( 'click', dhis2.de.uploadLocalData );
+                    $( '#discard_button' ).bind( 'click', dhis2.de.discardLocalData );
         		}
             }
         } );
@@ -410,10 +411,13 @@
             	else // Connection lost during upload
             	{
 	                var message = i18n_sync_failed
-	                    + ' <button id="sync_button" type="button">' + i18n_sync_now + '</button>';
-	
+                    + ' <button id="sync_button" type="button">' + i18n_sync_now + '</button>'
+                    + ' <button id="discard_button" type="button">' + i18n_discard + '</button>';
+
 	                setHeaderMessage( message );
+
 	                $( '#sync_button' ).bind( 'click', dhis2.de.uploadLocalData );
+                  $( '#discard_button' ).bind( 'click', dhis2.de.discardLocalData );
             	}
             }
         } );