Rename affApi4* to afApi4*
authorTim Otten <totten@civicrm.org>
Thu, 12 Sep 2019 22:10:36 +0000 (18:10 -0400)
committerCiviCRM <info@civicrm.org>
Wed, 16 Sep 2020 02:13:18 +0000 (19:13 -0700)
ext/afform/auditor/backlog.md
ext/afform/core/ang/afformCore.css
ext/afform/core/ang/afformCore/Api4Action.js
ext/afform/core/ang/afformCore/Api4Action.md
ext/afform/core/ang/afformCore/Api4Ctrl.js
ext/afform/docs/roadmap.md
ext/afform/html/ang/afHtmlEditor.aff.html
ext/afform/html/ang/afHtmlList.aff.html

index 27d01df1e23e01f357a9a50e81d7d2ac5411c317..3e9a620ca08bc3a42470892ef6d07427cf40bc27 100644 (file)
@@ -13,7 +13,7 @@ validator to catch. Loosely/informally:
     * Future consideration: how to validate when it's part of a subform?
 * `<af-model>` should reference a declared model.
 * `<af-field field-defn="...">` should contain an object.
-* `<a>` should have `href` or `ng-click` or `aff-api4-action`
+* `<a>` should have `href` or `ng-click` or `af-api4-action`
 * Accept a restricted subset of HTML (e.g. `p h1 h2 h3` but not `script` or `[onclick]`)
 * Accept a restricted subset of BootstrapCSS
 * Accept a restricted subset of Angular HTML
index d5a9b31fcb444a8a95e889c8fb954260113ab1e8..83b008df299e7d9d99a65a1645e6f4b87b5df91d 100644 (file)
@@ -1,7 +1,7 @@
-.aff-api4-action-running {
+.af-api4-action-running {
     cursor: not-allowed;
     color: black;
 }
-a.aff-api4-action-idle {
+a.af-api4-action-idle {
     cursor: pointer;
 }
index b68b729ce31b41a35b325da0418724dfef782618..01b335c6101b45ebe8a36450bb8473458e915ac9 100644 (file)
@@ -1,10 +1,10 @@
 (function(angular, $, _) {
 
-  angular.module('afformCore').directive('affApi4Action', function($parse, crmStatus, crmApi4) {
+  angular.module('afformCore').directive('afApi4Action', function($parse, crmStatus, crmApi4) {
     return {
       restrict: 'A',
       scope: {
-        affApi4Action: '@',
+        afApi4Action: '@',
         msgStart: '=',
         msgError: '=',
         msgSuccess: '=',
       },
       link: function($scope, $el, $attr) {
         var ts = CRM.ts(null);
-        function running(x) {$el.toggleClass('aff-api4-action-running', x).toggleClass('aff-api4-action-idle', !x);}
+        function running(x) {$el.toggleClass('af-api4-action-running', x).toggleClass('af-api4-action-idle', !x);}
         running(false);
         $el.click(function(){
-          var parts = $parse($scope.affApi4Action)($scope.$parent);
+          var parts = $parse($scope.afApi4Action)($scope.$parent);
           var msgs = {start: $scope.msgStart || ts('Submitting...'), success: $scope.msgSuccess, error: $scope.msgError};
           running(true);
           crmStatus(msgs, crmApi4(parts[0], parts[1], parts[2]))
index d1f4f810e29bdbf0a74506fbff35f32b2e30e7ef..7e43867850bee301ac2532b95fb3c98f4d3db826 100644 (file)
@@ -1,11 +1,11 @@
-# aff-api4-action
+# af-api4-action
 
 This directive is designed for invoking an action via APIv4. Much like
 `ng-click`, one would use `api4-action` to add behavior to a button or link.
 
 ```html
 <button
-  aff-api4-action="['Contact','delete',{where:['id','=','100]}}]"
+  af-api4-action="['Contact','delete',{where:['id','=','100]}}]"
   >Delete</button>
 ```
 
@@ -16,19 +16,19 @@ trigger further actions on failure or success.
 
 ```html
 <button
-  aff-api4-action="['Contact','delete',{where:['id','=','100]}}]"
+  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})"
 >Delete</button>
-<!-- Automated flag with aff-api4-action-{running -->
+<!-- Automated flag with af-api4-action-{running -->
 ```
 
 ### Styling
 
-The `aff-api4-action` element will have the follow classes
+The `af-api4-action` element will have the follow classes
 toggled automatically:
 
-* `aff-api4-action-running`: User has clicked to fire the action, and action is still running.
-* `aff-api4-action-idle`: The action is not running.
+* `af-api4-action-running`: User has clicked to fire the action, and action is still running.
+* `af-api4-action-idle`: The action is not running.
index 41648cfc1d3b08b233ad7bbd6b8a1f43182fcd88..7bc7abdf4d59909aedd104ced78c2897048a599f 100644 (file)
@@ -1,20 +1,20 @@
 (function(angular, $, _) {
 
-  angular.module('afformCore').directive('affApi4Ctrl', function() {
+  angular.module('afformCore').directive('afApi4Ctrl', function() {
     return {
       restrict: 'EA',
       scope: {
-        affApi4Ctrl: '=',
-        affApi4: '@',
-        affApi4Refresh: '@',
+        afApi4Ctrl: '=',
+        afApi4: '@',
+        afApi4Refresh: '@',
         onRefresh: '@'
       },
-      controllerAs: 'affApi4Ctrl',
+      controllerAs: 'afApi4Ctrl',
       controller: function($scope, $parse, crmThrottle, crmApi4) {
         var ctrl = this;
 
         // CONSIDER: Trade-offs of upfront vs ongoing evaluation.
-        var parts = $parse($scope.affApi4)($scope.$parent);
+        var parts = $parse($scope.afApi4)($scope.$parent);
         ctrl.entity = parts[0];
         ctrl.action = parts[1];
         ctrl.params = parts[2];
           });
         };
 
-        $scope.affApi4Ctrl = this;
+        $scope.afApi4Ctrl = this;
 
-        var mode = $scope.affApi4Refresh ? $scope.affApi4Refresh : 'auto';
+        var mode = $scope.afApi4Refresh ? $scope.afApi4Refresh : 'auto';
         switch (mode) {
           case 'auto':
             // Note: Do NOT watch '.result' or '.loading' - causes infinite reloads.
-            $scope.$watchCollection('affApi4Ctrl.params', ctrl.refresh, true);
-            $scope.$watch('affApi4Ctrl.index', ctrl.refresh, true);
-            $scope.$watch('affApi4Ctrl.entity', ctrl.refresh, true);
-            $scope.$watch('affApi4Ctrl.action', ctrl.refresh, true);
+            $scope.$watchCollection('afApi4Ctrl.params', ctrl.refresh, true);
+            $scope.$watch('afApi4Ctrl.index', ctrl.refresh, true);
+            $scope.$watch('afApi4Ctrl.entity', ctrl.refresh, true);
+            $scope.$watch('afApi4Ctrl.action', ctrl.refresh, true);
             break;
           case 'init': ctrl.refresh(); break;
           case 'manual': break;
index eb55f35545a1a6b79e32576c979c1168d76edb20..3b0b0c6b1fc07d32f6219560a9163aac2aa1d94f 100644 (file)
@@ -29,7 +29,7 @@ This extension is expected to be the base for a suite of related extensions:
 
 Within this extension, there are things which need updating/addressing:
 
-* Test coverage for key Angular directives (e.g. `aff-api4-ctrl`, `aff-api4-action`)
+* Test coverage for key Angular directives (e.g. `af-api4-ctrl`, `af-api4-action`)
 * There are several `FIXME`/`TODO` declarations in the code for checking pre-conditions, reporting errors, handling edge-cases, etc.
 * Although afforms can be used in AngularJS, they don't fully support tooling like `cv ang:html:list`
   and `hook_civicrm_alterAngular` changesets. We'll need a core patch to allow that. (Ex: Define partials via callback.)
index d97af4c0d1a3a37ac5533f8d3fd383a557d1e0dd..a17b66d6baa1e44b5dd3b5497e3ec208a2eda08d 100644 (file)
@@ -1,4 +1,4 @@
-<div aff-api4-ctrl="apiData" aff-api4="['Afform', 'get', {layoutFormat: 'html', where: [['name', '=', options.name]]}]">
+<div af-api4-ctrl="apiData" af-api4="['Afform', 'get', {layoutFormat: 'html', where: [['name', '=', options.name]]}]">
 
   <div ng-if="apiData.result.length == 0">
     {{ts('Failed to find requested form.')}}
@@ -10,7 +10,7 @@
     <div>
       <a ng-href="#/">{{ts('Back')}}</a>
       |
-      <a aff-api4-action="['Afform', 'update', {layoutFormat: 'html', where: [['name', '=', resultForm.name]], values:resultForm}]">{{ts('Save')}}</a>
+      <a af-api4-action="['Afform', 'update', {layoutFormat: 'html', where: [['name', '=', resultForm.name]], values:resultForm}]">{{ts('Save')}}</a>
       <span ng-if="resultForm.server_route">
         | <a target="_blank" ng-href="{{crmUrl(resultForm.server_route)}}">Open</a>
       </span>
index b6ccc76c18ffb65763f97cc9a685cc4418ea15fa..f78ca5362ced379adf4dd1c72a020e9a1615453c 100644 (file)
@@ -1,6 +1,6 @@
 <div
-  aff-api4="['Afform', 'get', {select: ['name','title','is_public','server_route'], orderBy: {name:'ASC'}}]"
-  aff-api4-ctrl="listCtrl">
+  af-api4="['Afform', 'get', {select: ['name','title','is_public','server_route'], orderBy: {name:'ASC'}}]"
+  af-api4-ctrl="listCtrl">
 
   <div ng-if="apiData.result.length == 0">
     {{ts('There are no forms! Tell Aristotle!')}}
@@ -26,7 +26,7 @@
       <td>{{availForm.is_public ? ts('Frontend') : ts('Backend')}}</td>
       <td>
         <!--<a ng-click="crmStatus({start: ts('Reverting...'), success: ts('Reverted')}, crmApi4('Afform', 'revert', {where: [['name', '=', availForm.name]]}))">{{ts('Revert')}}</a>-->
-        <a aff-api4-action="['Afform', 'revert', {where: [['name','=', availForm.name]]}]"
+        <a af-api4-action="['Afform', 'revert', {where: [['name','=', availForm.name]]}]"
            msg-start="ts('Reverting...')"
            msg-success="ts('Reverted')"
           >{{ts('Revert')}}</a>