← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21990: Approval. Fix for cat option combo approval UI.

 

------------------------------------------------------------
revno: 21990
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2016-02-17 14:02:47 -0500
message:
  Approval. Fix for cat option combo approval UI.
modified:
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/dataApprovalForm.vm
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataApproval.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-reporting/src/main/webapp/dhis-web-reporting/dataApprovalForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/dataApprovalForm.vm	2016-02-16 21:19:35 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/dataApprovalForm.vm	2016-02-17 19:02:47 +0000
@@ -46,6 +46,8 @@
 var i18n_accept = '$encoder.jsEscape( $i18n.getString( "accept" ), "'")';
 var i18n_unaccept = '$encoder.jsEscape( $i18n.getString( "unaccept" ), "'")';
 var i18n_items = '$encoder.jsEscape( $i18n.getString( "items" ), "'")';
+var i18n_please_make_selection = '$encoder.jsEscape( $i18n.getString( "please_make_selection" ), "'")';
+var i18n_done = '$encoder.jsEscape( $i18n.getString( "done" ), "'")';
 </script>
 
 <style type="text/css">

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataApproval.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataApproval.js	2016-02-09 21:30:25 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataApproval.js	2016-02-17 19:02:47 +0000
@@ -99,7 +99,7 @@
 	if ( !ui.ds || !ui.pe || !ui.ou ) {
 		return false;
 	}
-		
+	
 	var cc = dhis2.appr.dataSets[ui.ds].categoryCombo,
 		ccUrl = "../api/categoryCombos/" + cc.id + ".json?fields=id,displayName,categoryOptionCombos[id,displayName]",
 		apUrl = "../api/dataApprovals/categoryOptionCombos?ds=" + ui.ds + "&pe=" + ui.pe + "&ou=" + ui.ou,
@@ -291,7 +291,7 @@
  * Gets the state of the user interface selections.
  */
 dhis2.appr.getUiState = function()
-{		
+{
 	var ui = {
 		ds: $( "#dataSetId" ).val(),
 		pe: $( "#periodId" ).val(),
@@ -471,6 +471,13 @@
 	}	
 };
 
+dhis2.appr.resetApprovalOptions = function()
+{
+	$( ".approveButton" ).hide();
+	$( "#approvalNotification" ).html( i18n_done + ". " + i18n_please_make_selection );
+	dhis2.appr.clearItemsDialog();
+}
+
 /**
  * Sets the state of the approval buttons and notification for regular
  * data sets.
@@ -492,7 +499,7 @@
 		dhis2.appr.permissions = json;
 		
 	    $( ".approveButton" ).hide();
-	
+
 	    switch ( json.state ) {
 	        case "UNAPPROVABLE":
 		        $( "#approvalNotification" ).html( i18n_approval_not_relevant );
@@ -619,7 +626,7 @@
 			contentType: "application/json",
 			data: JSON.stringify( json ),
 			success: function() {
-				dhis2.appr.setApprovalState();
+				dhis2.appr.resetApprovalOptions();
 			},
 			error: function( xhr, status, error ) {
 				alert( xhr.responseText );
@@ -660,7 +667,7 @@
 			contentType: "application/json",
 			data: JSON.stringify( json ),
 			success: function() {
-				dhis2.appr.setApprovalState();
+				dhis2.appr.resetApprovalOptions();
 			},
 			error: function( xhr, status, error ) {
 				alert( xhr.responseText );
@@ -701,7 +708,7 @@
 			contentType: "application/json",
 			data: JSON.stringify( json ),
 			success: function() {
-				dhis2.appr.setApprovalState();
+				dhis2.appr.resetApprovalOptions();
 			},
 			error: function( xhr, status, error ) {
 				alert( xhr.responseText );
@@ -742,7 +749,7 @@
 			contentType: "application/json",
 			data: JSON.stringify( json ),
 			success: function() {
-				dhis2.appr.setApprovalState();
+				dhis2.appr.resetApprovalOptions();
 			},
 			error: function( xhr, status, error ) {
 				alert( xhr.responseText );