From dce8ad72f520c9535e9433a23fa98fb9bc891ef2 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Fri, 13 Sep 2019 12:21:26 -0400 Subject: [PATCH] Rename to --- ext/afform/auditor/backlog.md | 4 +- ext/afform/core/CRM/Afform/ArrayHtml.php | 2 +- ext/afform/core/Civi/Afform/Utils.php | 2 +- ext/afform/core/afform.php | 2 +- .../core/ang/af/{Model.js => Fieldset.js} | 6 +-- ext/afform/core/ang/af/WillBeModel.js | 2 +- ext/afform/core/ang/afBlock/ContactEmail.html | 2 +- ext/afform/core/ang/afBlock/ContactEmail.js | 4 +- ext/afform/core/ang/afBlock/ContactName.html | 2 +- ext/afform/core/ang/afBlock/ContactName.js | 6 +-- ext/afform/core/ang/afField/afField.js | 10 ++--- ext/afform/docs/sandbox/planning-v0.3.md | 40 +++++++++---------- ext/afform/mock/ang/afex.aff.html | 16 ++++---- 13 files changed, 49 insertions(+), 49 deletions(-) rename ext/afform/core/ang/af/{Model.js => Fieldset.js} (81%) diff --git a/ext/afform/auditor/backlog.md b/ext/afform/auditor/backlog.md index cd3e4f95ca..19a6d1a7f3 100644 --- a/ext/afform/auditor/backlog.md +++ b/ext/afform/auditor/backlog.md @@ -7,11 +7,11 @@ validator to catch. Loosely/informally: * HTML partials should be well-formed/parseable XML * Warnings about any unrecognized tags/attributes/classes. -* ``, ``, ``, `` should have suitable relationships. +* ``, ``, ``, `` should have suitable relationships. * `` should reference legit entities. * `` should reference legit fields. * Future consideration: how to validate when it's part of a subform? -* `` should reference a declared model. +* `` should reference a declared model. * `` should contain an object. * `` 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]`) diff --git a/ext/afform/core/CRM/Afform/ArrayHtml.php b/ext/afform/core/CRM/Afform/ArrayHtml.php index b27bb3b331..9d11d35df9 100644 --- a/ext/afform/core/CRM/Afform/ArrayHtml.php +++ b/ext/afform/core/CRM/Afform/ArrayHtml.php @@ -30,7 +30,7 @@ class CRM_Afform_ArrayHtml { 'field-name' => 'text', 'field-defn' => 'js', ], - 'af-model' => [ + 'af-fieldset' => [ 'af-name' => 'text', ], ]; diff --git a/ext/afform/core/Civi/Afform/Utils.php b/ext/afform/core/Civi/Afform/Utils.php index 1ffb2ca95f..6c04167695 100644 --- a/ext/afform/core/Civi/Afform/Utils.php +++ b/ext/afform/core/Civi/Afform/Utils.php @@ -40,7 +40,7 @@ class Utils { */ protected static function getFields($layout, &$entities) { foreach ($layout['#children'] as $child) { - if ($child['#tag'] == 'af-model' && !empty($child['#children'])) { + if ($child['#tag'] == 'af-fieldset' && !empty($child['#children'])) { $entities[$child['af-name']]['fields'] = array_merge($entities[$child['af-name']]['fields'] ?? [], self::getTags($child, 'af-field')); } elseif (!empty($child['#children'])) { diff --git a/ext/afform/core/afform.php b/ext/afform/core/afform.php index 8efdb66500..03316a5c3d 100644 --- a/ext/afform/core/afform.php +++ b/ext/afform/core/afform.php @@ -182,7 +182,7 @@ function afform_civicrm_alterAngular($angular) { foreach (pq('af-field', $doc) as $afField) { /** @var DOMElement $afField */ $fieldName = $afField->getAttribute('field-name'); - $entityName = pq($afField)->parent('af-model[af-name]')->attr('af-name'); // TEST ME + $entityName = pq($afField)->parent('af-fieldset[af-name]')->attr('af-name'); // TEST ME if (!preg_match(';^[a-zA-Z0-9\_\-\. ]+$;', $entityName)) { throw new \CRM_Core_Exception("Cannot process $path: malformed entity name ($entityName)"); } diff --git a/ext/afform/core/ang/af/Model.js b/ext/afform/core/ang/af/Fieldset.js similarity index 81% rename from ext/afform/core/ang/af/Model.js rename to ext/afform/core/ang/af/Fieldset.js index d3b314ff6c..60b61e0942 100644 --- a/ext/afform/core/ang/af/Model.js +++ b/ext/afform/core/ang/af/Fieldset.js @@ -1,7 +1,7 @@ (function(angular, $, _) { - // "afModel" is a basic skeletal directive. - // Example usage: ... ... ... - angular.module('af').directive('afModel', function() { + // "afFieldset" is a basic skeletal directive. + // Example usage: ... ... ... + angular.module('af').directive('afFieldset', function() { return { restrict: 'AE', require: '^afForm', diff --git a/ext/afform/core/ang/af/WillBeModel.js b/ext/afform/core/ang/af/WillBeModel.js index df0f98fcf9..6dbda8c701 100644 --- a/ext/afform/core/ang/af/WillBeModel.js +++ b/ext/afform/core/ang/af/WillBeModel.js @@ -2,7 +2,7 @@ // "afWillBeModel" is a basic skeletal directive. // Example usage: ... ... angular.module('af').directive('afWillBeModel', function() { - // Whitelist of all allowed properties of an af-model + // Whitelist of all allowed properties of an af-fieldset // (at least the ones we care about client-side - other's can be added for server-side processing and we'll just ignore them) var modelProps = { type: '@', diff --git a/ext/afform/core/ang/afBlock/ContactEmail.html b/ext/afform/core/ang/afBlock/ContactEmail.html index 41aab8b722..0a451eb5b8 100644 --- a/ext/afform/core/ang/afBlock/ContactEmail.html +++ b/ext/afform/core/ang/afBlock/ContactEmail.html @@ -1 +1 @@ -
{{ts('Contact email block for a model of type %1 named %2', {1: afModel.getDefn().type, 2: afModel.getDefn().afName})}}
+
{{ts('Contact email block for a model of type %1 named %2', {1: afFieldset.getDefn().type, 2: afFieldset.getDefn().afName})}}
diff --git a/ext/afform/core/ang/afBlock/ContactEmail.js b/ext/afform/core/ang/afBlock/ContactEmail.js index 88c744effe..44c3b23ebb 100644 --- a/ext/afform/core/ang/afBlock/ContactEmail.js +++ b/ext/afform/core/ang/afBlock/ContactEmail.js @@ -3,12 +3,12 @@ angular.module('afBlock').directive('afBlockContactEmail', function() { return { restrict: 'AE', - require: ['^afModel'], + require: ['^afFieldset'], templateUrl: '~/afBlock/ContactEmail.html', scope: {}, link: function($scope, $el, $attr, ctrls) { var ts = $scope.ts = CRM.ts('afform'); - $scope.afModel = ctrls[0]; + $scope.afFieldset = ctrls[0]; } }; }); diff --git a/ext/afform/core/ang/afBlock/ContactName.html b/ext/afform/core/ang/afBlock/ContactName.html index 08b62db246..f991556625 100644 --- a/ext/afform/core/ang/afBlock/ContactName.html +++ b/ext/afform/core/ang/afBlock/ContactName.html @@ -1 +1 @@ -
{{ts('Contact name block for a model of type %1 named %2', {1: afModel.getDefn().type, 2: afModel.getDefn().afName})}}
+
{{ts('Contact name block for a model of type %1 named %2', {1: afFieldset.getDefn().type, 2: afFieldset.getDefn().afName})}}
diff --git a/ext/afform/core/ang/afBlock/ContactName.js b/ext/afform/core/ang/afBlock/ContactName.js index 16001f812c..da68c0b45b 100644 --- a/ext/afform/core/ang/afBlock/ContactName.js +++ b/ext/afform/core/ang/afBlock/ContactName.js @@ -1,14 +1,14 @@ (function(angular, $, _) { - // Example usage: + // Example usage: angular.module('afBlock').directive('afBlockContactName', function() { return { restrict: 'AE', - require: ['^afModel'], + require: ['^afFieldset'], templateUrl: '~/afBlock/ContactName.html', scope: {}, link: function($scope, $el, $attr, ctrls) { var ts = $scope.ts = CRM.ts('afform'); - $scope.afModel = ctrls[0]; + $scope.afFieldset = ctrls[0]; } }; }); diff --git a/ext/afform/core/ang/afField/afField.js b/ext/afform/core/ang/afField/afField.js index 29523ed9ee..42a4ae56e2 100644 --- a/ext/afform/core/ang/afField/afField.js +++ b/ext/afform/core/ang/afField/afField.js @@ -1,9 +1,9 @@ (function(angular, $, _) { - // Example usage: + // Example usage: angular.module('afField').directive('afField', function() { return { restrict: 'E', - require: ['^afModel', '^afForm'], + require: ['^afFieldset', '^afForm'], templateUrl: '~/afField/afField.html', scope: { fieldName: '@', @@ -11,10 +11,10 @@ }, link: function($scope, $el, $attr, ctrls) { var ts = $scope.ts = CRM.ts('afform'); - $scope.afModel = ctrls[0]; + $scope.afFieldset = ctrls[0]; var modelList = ctrls[1]; - $scope.fieldId = $scope.afModel.getDefn().afName + '-' + $scope.fieldName; - $scope.getData = $scope.afModel.getData; + $scope.fieldId = $scope.afFieldset.getDefn().afName + '-' + $scope.fieldName; + $scope.getData = $scope.afFieldset.getData; $scope.getOptions = function() { return _.transform($scope.fieldDefn.options, function(result, val, key) { diff --git a/ext/afform/docs/sandbox/planning-v0.3.md b/ext/afform/docs/sandbox/planning-v0.3.md index ce2fe93dd8..6c4b66b87f 100644 --- a/ext/afform/docs/sandbox/planning-v0.3.md +++ b/ext/afform/docs/sandbox/planning-v0.3.md @@ -65,19 +65,19 @@ - + - +
- + - +
- + - +
``` @@ -100,23 +100,23 @@ /> - + - + - + - +

Your spouse should go to the gym.

- + - + @@ -137,9 +137,9 @@ - + - + ``` @@ -164,18 +164,18 @@ - + - + - + - + @@ -183,9 +183,9 @@ Your spouse should go to the gym.

- + - + diff --git a/ext/afform/mock/ang/afex.aff.html b/ext/afform/mock/ang/afex.aff.html index ff3e552a27..c0689336a8 100644 --- a/ext/afform/mock/ang/afex.aff.html +++ b/ext/afform/mock/ang/afex.aff.html @@ -6,25 +6,25 @@ - + - + - + - + - + - + - + - + -- 2.25.1