From 500247a7459394cc64debc24aa68779653ae8577 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Thu, 12 Sep 2019 18:13:07 -0400 Subject: [PATCH] Rename afformApi3* to afApi3* --- ext/afform/core/ang/afformCore/Api3Ctrl.js | 18 +++++++++--------- ext/afform/core/ang/afformCore/Api3Ctrl.md | 20 ++++++++++---------- ext/afform/docs/writing.md | 6 +++--- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/ext/afform/core/ang/afformCore/Api3Ctrl.js b/ext/afform/core/ang/afformCore/Api3Ctrl.js index e1f7506f33..a7a7f64215 100644 --- a/ext/afform/core/ang/afformCore/Api3Ctrl.js +++ b/ext/afform/core/ang/afformCore/Api3Ctrl.js @@ -1,20 +1,20 @@ (function(angular, $, _) { - angular.module('afformCore').directive('afformApi3Ctrl', function() { + angular.module('afformCore').directive('afApi3Ctrl', function() { return { restrict: 'EA', scope: { - afformApi3Ctrl: '=', - afformApi3: '@', - afformApi3Refresh: '@', + afApi3Ctrl: '=', + afApi3: '@', + afApi3Refresh: '@', onRefresh: '@' }, - controllerAs: 'afformApi3Ctrl', + controllerAs: 'afApi3Ctrl', controller: function($scope, $parse, crmThrottle, crmApi) { var ctrl = this; // CONSIDER: Trade-offs of upfront vs ongoing evaluation. - var parts = $parse($scope.afformApi3)($scope.$parent); + var parts = $parse($scope.afApi3)($scope.$parent); ctrl.entity = parts[0]; ctrl.action = parts[1]; ctrl.params = parts[2]; @@ -35,11 +35,11 @@ }); }; - $scope.afformApi3Ctrl = this; + $scope.afApi3Ctrl = this; - var mode = $scope.afformApi3Refresh ? $scope.afformApi3Refresh : 'auto'; + var mode = $scope.afApi3Refresh ? $scope.afApi3Refresh : 'auto'; switch (mode) { - case 'auto': $scope.$watchCollection('afformApi3Ctrl.params', ctrl.refresh); break; + case 'auto': $scope.$watchCollection('afApi3Ctrl.params', ctrl.refresh); break; case 'init': ctrl.refresh(); break; case 'manual': break; default: throw 'Unrecognized refresh mode: '+ mode; diff --git a/ext/afform/core/ang/afformCore/Api3Ctrl.md b/ext/afform/core/ang/afformCore/Api3Ctrl.md index 0b328eca5b..cfb040d6a1 100644 --- a/ext/afform/core/ang/afformCore/Api3Ctrl.md +++ b/ext/afform/core/ang/afformCore/Api3Ctrl.md @@ -1,4 +1,4 @@ -# afform-api3-ctrl +# af-api3-ctrl This directive is designed for querying and displaying data from APIv3. Each API call is represented with an object like this: @@ -16,12 +16,12 @@ This directive is designed for querying and displaying data from APIv3. Each API } ``` -You can initialize this object using `` and ``, as in: +You can initialize this object using `` and ``, as in: ```html
+ af-api3-ctrl="apiData" + af-api3="['Contact','get', {display_name: ''}]">
@@ -37,13 +37,13 @@ You can initialize this object using `` and ``, a By default, the API call will refresh its results automatically - as soon as the filter parameters change. -If you'd rather wait and trigger the refresh another way, then set the `afform-api3-refresh` policy to `init` or `manual`. Don't forget to fire the refresh some other way, such as `ng-click`: +If you'd rather wait and trigger the refresh another way, then set the `af-api3-refresh` policy to `init` or `manual`. Don't forget to fire the refresh some other way, such as `ng-click`: ```html
+ af-api3-ctrl="apiData" + af-api3="['Contact','get', {display_name: ''}]" + af-api3-refresh="init">
@@ -65,8 +65,8 @@ properties of the API object (`entity`, `action`, `params`, `result`). ```html
...
diff --git a/ext/afform/docs/writing.md b/ext/afform/docs/writing.md index 1df877d743..fc3ab06ae2 100644 --- a/ext/afform/docs/writing.md +++ b/ext/afform/docs/writing.md @@ -30,15 +30,15 @@ http://dmaster.localhost/civicrm/hello-world/#/?cid=123 ``` How do we use the `cid` to get information about the contact? Update `helloWorld.aff.html` to fetch data with -`Contact.get` API and call the [afform-api3](https://github.com/totten/afform/blob/master/ang/afformCore/Api3Ctrl.md) utility: +`Contact.get` API and call the [af-api3](https://github.com/totten/afform/blob/master/ang/afformCore/Api3Ctrl.md) utility: ```html
{{ts('Please provide the "cid"')}}
+ af-api3="['Contact', 'get', {id: routeParams.cid}]" + af-api3-ctrl="apiData">

{{contact.display_name}}

-- 2.25.1