Here's the bash script...
```
for REGEX in \
s/msg-start/af-api4-start-msg/g \
s/msgStart/afApi4StartMsg/g \
s/msg-error/af-api4-error-msg/g \
s/msgError/afApi4ErrorMsg/g \
s/msg-success/af-api4-success-msg/g \
s/msgSuccess/afApi4SuccessMsg/g \
s/on-success/af-api4-success/g \
s/onSuccess/afApi4Success/g \
s/on-error/af-api4-error/g \
s/on-error/afApi4Error/g
do
DIRS="core docs gui html mock auditor"
echo "Processing regex [$REGEX] in [$DIRS]"
find $DIRS -name '*.js' -o -name '*.html' -o -name '*.json' -o -name '*.md' \
| grep -v /node_modules/ \
| xargs -L1 sed -i.bak "$REGEX"
find $DIRS -name '*.bak' -delete
done
```
restrict: 'A',
scope: {
afApi4Action: '@',
- msgStart: '=',
- msgError: '=',
- msgSuccess: '=',
- onSuccess: '@',
+ afApi4StartMsg: '=',
+ afApi4ErrorMsg: '=',
+ afApi4SuccessMsg: '=',
+ afApi4Success: '@',
onError: '@'
},
link: function($scope, $el, $attr) {
running(false);
$el.click(function(){
var parts = $parse($scope.afApi4Action)($scope.$parent);
- var msgs = {start: $scope.msgStart || ts('Submitting...'), success: $scope.msgSuccess, error: $scope.msgError};
+ var msgs = {start: $scope.afApi4StartMsg || ts('Submitting...'), success: $scope.afApi4SuccessMsg, error: $scope.afApi4ErrorMsg};
running(true);
crmStatus(msgs, crmApi4(parts[0], parts[1], parts[2]))
.finally(function(){running(false);})
- .then(function(response){$scope.$parent.$eval($scope.onSuccess, {response: response});})
+ .then(function(response){$scope.$parent.$eval($scope.afApi4Success, {response: response});})
.catch(function(error){$scope.$parent.$eval($scope.onError, {error: error});});
});
}
```html
<button
af-api4-action="['Contact','delete',{where:['id','=','100]}}]"
- msg-start="ts('Deleting...')"
- msg-success="ts('Deleted')"
- on-success="crmUiAlert({text:'Received ' + response.length + ' items'})"
- on-error="crmUiAlert({text:'Failure: ' + error})"
+ af-api4-start-msg="ts('Deleting...')"
+ af-api4-success-msg="ts('Deleted')"
+ af-api4-success="crmUiAlert({text:'Received ' + response.length + ' items'})"
+ af-api4-error="crmUiAlert({text:'Failure: ' + error})"
>Delete</button>
<!-- Automated flag with af-api4-action-{running -->
```
<td>
<!--<a ng-click="crmStatus({start: ts('Reverting...'), success: ts('Reverted')}, crmApi4('Afform', 'revert', {where: [['name', '=', availForm.name]]}))">{{ts('Revert')}}</a>-->
<a af-api4-action="['Afform', 'revert', {where: [['name','=', availForm.name]]}]"
- msg-start="ts('Reverting...')"
- msg-success="ts('Reverted')"
+ af-api4-start-msg="ts('Reverting...')"
+ af-api4-success-msg="ts('Reverted')"
>{{ts('Revert')}}</a>
</td>
</tr>