From: Tim Otten Date: Thu, 12 Sep 2019 22:10:36 +0000 (-0400) Subject: Rename affApi4* to afApi4* X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=894cb44dcb84d23b2863e334e58a5f3715b88fc7;p=civicrm-core.git Rename affApi4* to afApi4* --- diff --git a/ext/afform/auditor/backlog.md b/ext/afform/auditor/backlog.md index 27d01df1e2..3e9a620ca0 100644 --- a/ext/afform/auditor/backlog.md +++ b/ext/afform/auditor/backlog.md @@ -13,7 +13,7 @@ validator to catch. Loosely/informally: * Future consideration: how to validate when it's part of a subform? * `` should reference a declared model. * `` should contain an object. -* `` should have `href` or `ng-click` or `aff-api4-action` +* `` 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 diff --git a/ext/afform/core/ang/afformCore.css b/ext/afform/core/ang/afformCore.css index d5a9b31fcb..83b008df29 100644 --- a/ext/afform/core/ang/afformCore.css +++ b/ext/afform/core/ang/afformCore.css @@ -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; } diff --git a/ext/afform/core/ang/afformCore/Api4Action.js b/ext/afform/core/ang/afformCore/Api4Action.js index b68b729ce3..01b335c610 100644 --- a/ext/afform/core/ang/afformCore/Api4Action.js +++ b/ext/afform/core/ang/afformCore/Api4Action.js @@ -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: '=', @@ -13,10 +13,10 @@ }, 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])) diff --git a/ext/afform/core/ang/afformCore/Api4Action.md b/ext/afform/core/ang/afformCore/Api4Action.md index d1f4f810e2..7e43867850 100644 --- a/ext/afform/core/ang/afformCore/Api4Action.md +++ b/ext/afform/core/ang/afformCore/Api4Action.md @@ -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 ``` @@ -16,19 +16,19 @@ trigger further actions on failure or success. ```html - + ``` ### 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. diff --git a/ext/afform/core/ang/afformCore/Api4Ctrl.js b/ext/afform/core/ang/afformCore/Api4Ctrl.js index 41648cfc1d..7bc7abdf4d 100644 --- a/ext/afform/core/ang/afformCore/Api4Ctrl.js +++ b/ext/afform/core/ang/afformCore/Api4Ctrl.js @@ -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]; @@ -36,16 +36,16 @@ }); }; - $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; diff --git a/ext/afform/docs/roadmap.md b/ext/afform/docs/roadmap.md index eb55f35545..3b0b0c6b1f 100644 --- a/ext/afform/docs/roadmap.md +++ b/ext/afform/docs/roadmap.md @@ -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.) diff --git a/ext/afform/html/ang/afHtmlEditor.aff.html b/ext/afform/html/ang/afHtmlEditor.aff.html index d97af4c0d1..a17b66d6ba 100644 --- a/ext/afform/html/ang/afHtmlEditor.aff.html +++ b/ext/afform/html/ang/afHtmlEditor.aff.html @@ -1,4 +1,4 @@ -
+
{{ts('Failed to find requested form.')}} @@ -10,7 +10,7 @@
{{ts('Back')}} | - {{ts('Save')}} + {{ts('Save')}} | Open diff --git a/ext/afform/html/ang/afHtmlList.aff.html b/ext/afform/html/ang/afHtmlList.aff.html index b6ccc76c18..f78ca5362c 100644 --- a/ext/afform/html/ang/afHtmlList.aff.html +++ b/ext/afform/html/ang/afHtmlList.aff.html @@ -1,6 +1,6 @@
+ af-api4="['Afform', 'get', {select: ['name','title','is_public','server_route'], orderBy: {name:'ASC'}}]" + af-api4-ctrl="listCtrl">
{{ts('There are no forms! Tell Aristotle!')}} @@ -26,7 +26,7 @@ {{availForm.is_public ? ts('Frontend') : ts('Backend')}} - {{ts('Revert')}}