From 7637307989f7ec0ee1cb76450c5cf122a040bf57 Mon Sep 17 00:00:00 2001
From: Jaap Jansma <jaap.jansma@civicoop.org>
Date: Tue, 7 Jan 2020 11:33:49 +0100
Subject: [PATCH] Updated user interface with clearer terms for better
 usability.

---
 .../DefaultDataActionTable.html               |  5 +++-
 .../DefaultDataInputTable.html                |  5 +++-
 .../actions/crmFormProcessorActions.html      |  6 ++--
 .../actions/crmFormProcessorActions.js        | 23 ++++++++-------
 .../inputs/crmFormProcessorInputs.html        |  4 +--
 .../inputs/crmFormProcessorInputs.js          | 29 ++++++++++---------
 6 files changed, 42 insertions(+), 30 deletions(-)

diff --git a/ang/form_processor/FormProcessorEditCtrl/DefaultDataActionTable.html b/ang/form_processor/FormProcessorEditCtrl/DefaultDataActionTable.html
index 1970f72..f883839 100644
--- a/ang/form_processor/FormProcessorEditCtrl/DefaultDataActionTable.html
+++ b/ang/form_processor/FormProcessorEditCtrl/DefaultDataActionTable.html
@@ -7,5 +7,8 @@
 	deleted-actions="deletedDefaultDataActions"
 	entity="FormProcessorDefaultDataAction"
 	context="form_processor"
-	enable-delay="false">
+	enable-delay="false"
+  add-button-label="{{ts('Add retrieval method')}}"
+  add-dropdown-label="{{ts('- Select retrieval method -')}}"
+  dialog-title="{{ts('Edit retrieval method of default data')}}">
 </crm-form-processor-actions>
diff --git a/ang/form_processor/FormProcessorEditCtrl/DefaultDataInputTable.html b/ang/form_processor/FormProcessorEditCtrl/DefaultDataInputTable.html
index 81a0eff..7b5e322 100644
--- a/ang/form_processor/FormProcessorEditCtrl/DefaultDataInputTable.html
+++ b/ang/form_processor/FormProcessorEditCtrl/DefaultDataInputTable.html
@@ -3,5 +3,8 @@
 	form-processor="formProcessor"
 	inputs="formProcessor.default_data_inputs"
 	deleted-inputs="deletedDefaultDataInputs"
-	entity="FormProcessorDefaultDataInput">
+	entity="FormProcessorDefaultDataInput"
+  add-button-label="{{ts('Add retrieval criteria')}}"
+  add-dropdown-label="{{ts('- Select criteria type -')}}"
+  dialog-title="{{ts('Edit retrieval criteria for default data')}}">
 </crm-form-processor-inputs>
diff --git a/ang/form_processor/actions/crmFormProcessorActions.html b/ang/form_processor/actions/crmFormProcessorActions.html
index 18bfe53..53a86a6 100644
--- a/ang/form_processor/actions/crmFormProcessorActions.html
+++ b/ang/form_processor/actions/crmFormProcessorActions.html
@@ -42,11 +42,11 @@
         ui-options="{dropdownAutoWidth : true, allowClear: true}"
         ng-model="actionType"
         ng-options="actionType as title for (actionType, title) in  actionTitles">
-        <option value="">{{ts('- Select action type -')}}</option>
+        <option value="">{{addDropdownLabel ? addDropdownLabel : ts('- Select action type -')}}</option>
       </select>
-      <button crm-icon="fa-check" ng-click="addAction(actionType)">{{ts('Add action')}}</button>	    	
+      <button crm-icon="fa-check" ng-click="addAction(actionType)">{{addButtonLabel ? addButtonLabel : ts('Add action')}}</button>
 	    </td>
 	  </tr>
   </tfoot>
 </table>
-</div>
\ No newline at end of file
+</div>
diff --git a/ang/form_processor/actions/crmFormProcessorActions.js b/ang/form_processor/actions/crmFormProcessorActions.js
index 7aafeed..641ed0f 100644
--- a/ang/form_processor/actions/crmFormProcessorActions.js
+++ b/ang/form_processor/actions/crmFormProcessorActions.js
@@ -1,5 +1,5 @@
 (function(angular, $, _) {
-	
+
 	angular.module('form_processor').directive('crmFormProcessorActions', function(formProcessorFactory, dialogService, $timeout) {
 	  return {
 	    restrict: 'E',
@@ -12,6 +12,9 @@
 	      context: '@',
 	      entity: '@',
 				enableDelay: '@',
+        addButtonLabel: '@',
+        addDropdownLabel: '@',
+        dialogTitle: '@'
 	    },
 	    templateUrl: '~/form_processor/actions/crmFormProcessorActions.html',
 	    link: function($scope, element, attrs){
@@ -27,9 +30,9 @@
 						});
 					}
 				}
-	    	
+
 	    	$scope.new_id = -1;
-	    	
+
 	    	$timeout(function(){
 		    	// The select boxes for input type and action type do not count for the @pristine state of the
 		    	// form.
@@ -41,7 +44,7 @@
             autoOpen: false,
             width: '40%',
             height: '80%',
-            title: ts('Edit condition')
+            title: $scope.dialogTitle ? $scope.dialogTitle : ts('Edit condition')
           });
 
           formProcessorFactory.getFieldList($scope.inputs, $scope.actions, action, $scope.context)
@@ -90,7 +93,7 @@
 										});
 							});
 				};
-	    	
+
 	    	$scope.removeAction = function removeAction(action) {
 		    	var index = $scope.actions.indexOf(action);
 		    	if (index >= 0) {
@@ -99,7 +102,7 @@
 		    	}
 		    	$scope.formProcessorActionsForm.$setDirty();
 		    };
-		  
+
 		   	// Open a dialog for adding an action
 		    $scope.addAction = function addAction(actionType) {
 		    	if (!actionType) {
@@ -115,9 +118,9 @@
 					};
 					$scope.editAction(action);
 		    };
-		    
+
 		    // Open a dialog for editting an action
-		    $scope.editAction = function editAction(action) {    	    	
+		    $scope.editAction = function editAction(action) {
 		      var options = CRM.utils.adjustDialogDefaults({
 		        autoOpen: false,
 		        width: '40%',
@@ -159,5 +162,5 @@
 	    }
 	  };
 	});
-	
-})(angular, CRM.$, CRM._);
\ No newline at end of file
+
+})(angular, CRM.$, CRM._);
diff --git a/ang/form_processor/inputs/crmFormProcessorInputs.html b/ang/form_processor/inputs/crmFormProcessorInputs.html
index c31f91a..16e5102 100644
--- a/ang/form_processor/inputs/crmFormProcessorInputs.html
+++ b/ang/form_processor/inputs/crmFormProcessorInputs.html
@@ -42,9 +42,9 @@
         ui-options="{dropdownAutoWidth : true, allowClear: true}"
         ng-model="inputType"
         ng-options="inputType.label for inputType in inputTypes">
-        <option value="">{{ts('- Select input type -')}}</option>
+        <option value="">{{addDropdownLabel ? addDropdownLabel : ts('- Select input type -')}}</option>
       </select>
-      <button crm-icon="fa-check" ng-click="addInput(inputType)">{{ts('Add input')}}</button>
+      <button crm-icon="fa-check" ng-click="addInput(inputType)">{{ addButtonLabel ? addButtonLabel : ts('Add input')}}</button>
 	    </td>
 	  </tr>
   </tfoot>
diff --git a/ang/form_processor/inputs/crmFormProcessorInputs.js b/ang/form_processor/inputs/crmFormProcessorInputs.js
index e89f27e..3ff1632 100644
--- a/ang/form_processor/inputs/crmFormProcessorInputs.js
+++ b/ang/form_processor/inputs/crmFormProcessorInputs.js
@@ -1,5 +1,5 @@
 (function(angular, $, _) {
-	
+
 	angular.module('form_processor').directive('crmFormProcessorInputs', function(formProcessorFactory, dialogService, $timeout) {
 	  return {
 	    restrict: 'E',
@@ -8,26 +8,29 @@
 	      formProcessor: '=',
 	      deletedInputs: '=',
 	      entity: '@',
+        addButtonLabel: '@',
+        addDropdownLabel: '@',
+        dialogTitle: '@'
 	    },
 	    templateUrl: '~/form_processor/inputs/crmFormProcessorInputs.html',
 	    link: function($scope, element, attrs){
 	    	$scope.ts = CRM.ts(null);
-	    	
+
 	    	$scope.new_id = -1;
-	    	
+
 	    	$scope.inputTypes = angular.copy(CRM.form_processor.inputTypes);
 			  for(var i=0; i<$scope.inputTypes.length; i++) {
 			  	if ($scope.inputTypes[i].description) {
 			  		$scope.inputTypes[i].description = $sce.trustAsHtml($scope.inputTypes[i].description);
 			  	}
 			  }
-			  
+
 			  $timeout(function(){
 		    	// The select boxes for input type and action type do not count for the @pristine state of the
 		    	// form.
 		  		$scope.formProcessorInputsForm.type.$pristine = false;
 				});
-	    	
+
 	    	$scope.removeInput = function removeInput(input) {
 		    	var index = $scope.inputs.indexOf(input);
 		    	if (index >= 0) {
@@ -36,12 +39,12 @@
 		    	}
 		    	$scope.formProcessorInputsForm.$setDirty();
 		    };
-		    
+
 		     // Open a dialog for adding an input
 		    $scope.addInput = function addInput(inputType) {
 		    	if (!inputType) {
 		    		return;
-		    	}    	    	
+		    	}
 		    	var input = {
 		    		'id': $scope.new_id,
 		    		'type': angular.copy(inputType),
@@ -54,14 +57,14 @@
 		    	};
 		      $scope.editInput(input);
 		    };
-		    
+
 		    // Open a dialog for editting an input
-		    $scope.editInput = function editInput(input) {    	    	
+		    $scope.editInput = function editInput(input) {
 		      var options = CRM.utils.adjustDialogDefaults({
 		        autoOpen: false,
 		        width: '40%',
 		        height: '80%',
-		        title: ts('Edit input')
+		        title: $scope.dialogTitle ? $scope.dialogTitle : ts('Edit input')
 		      });
 		      index = $scope.inputs.indexOf(input);
 		      var model = {
@@ -81,9 +84,9 @@
 						}
 					});
 		    };
-	    	
+
 	    }
 	  };
 	});
-	
-})(angular, CRM.$, CRM._);
\ No newline at end of file
+
+})(angular, CRM.$, CRM._);
-- 
GitLab