Rename afformApi3* to afApi3*
authorTim Otten <totten@civicrm.org>
Thu, 12 Sep 2019 22:13:07 +0000 (18:13 -0400)
committerCiviCRM <info@civicrm.org>
Wed, 16 Sep 2020 02:13:19 +0000 (19:13 -0700)
ext/afform/core/ang/afformCore/Api3Ctrl.js
ext/afform/core/ang/afformCore/Api3Ctrl.md
ext/afform/docs/writing.md

index e1f7506f3356ffcdb78b22f71d86e841ed10cdfc..a7a7f642155c022c8c8a22e14f61700da0a01a86 100644 (file)
@@ -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];
           });
         };
 
-        $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;
index 0b328eca5b964bc83be89c6174a2a58350f2c794..cfb040d6a17eae3c849d67605b5a98aba2fa9a60 100644 (file)
@@ -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 `<afform-api3-ctrl>` and `<afform-api3>`, as in:
+You can initialize this object using `<af-api3-ctrl>` and `<af-api3>`, as in:
 
 ```html
 <div
-  afform-api3-ctrl="apiData"
-  afform-api3="['Contact','get', {display_name: ''}]">
+  af-api3-ctrl="apiData"
+  af-api3="['Contact','get', {display_name: ''}]">
 
     <div crm-ui-debug="apiData"></div>
 
@@ -37,13 +37,13 @@ You can initialize this object using `<afform-api3-ctrl>` and `<afform-api3>`, 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
 <div
-  afform-api3-ctrl="apiData"
-  afform-api3="['Contact','get', {display_name: ''}]"
-  afform-api3-refresh="init">
+  af-api3-ctrl="apiData"
+  af-api3="['Contact','get', {display_name: ''}]"
+  af-api3-refresh="init">
 
     <div crm-ui-debug="apiData"></div>
 
@@ -65,8 +65,8 @@ properties of the API object (`entity`, `action`, `params`, `result`).
 
 ```html
 <div
-  afform-api3-ctrl="apiData"
-  afform-api3="['Contact','get', {display_name: ''}]"
+  af-api3-ctrl="apiData"
+  af-api3="['Contact','get', {display_name: ''}]"
   on-refresh="doSomething(result)">
   ...
 </div>
index 1df877d743e7e1a7892e2da0f8638139e8a7fd2c..fc3ab06ae216969151538a88b41e6f8e20c096e7 100644 (file)
@@ -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
 <div ng-if="!routeParams.cid">
   {{ts('Please provide the "cid"')}}
 </div>
 <div ng-if="routeParams.cid"
-  afform-api3="['Contact', 'get', {id: routeParams.cid}]"
-  afform-api3-ctrl="apiData">
+  af-api3="['Contact', 'get', {id: routeParams.cid}]"
+  af-api3-ctrl="apiData">
 
   <div ng-repeat="contact in apiData.result.values">
     <h1 crm-page-title="">{{contact.display_name}}</h1>