From c37151d286d5501800b6c54430521abc4c24f4eb Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Fri, 13 Sep 2019 22:09:21 -0400 Subject: [PATCH] Rename `` to `` to better match API terminology --- ext/afform/auditor/backlog.md | 4 ++-- ext/afform/core/CRM/Afform/ArrayHtml.php | 4 ++-- ext/afform/core/Civi/Afform/Utils.php | 4 ++-- ext/afform/core/afform.php | 2 +- ext/afform/core/ang/af/{Model.js => Entity.js} | 8 ++++---- ext/afform/core/ang/afBlock/ContactName.html | 9 ++++++++- ext/afform/docs/sandbox/planning-v0.3.md | 10 +++++----- ext/afform/docs/style.md | 6 +++--- ext/afform/mock/ang/afex.aff.html | 6 +++--- ext/afform/mock/ang/testAfform.aff.html | 6 +++--- 10 files changed, 33 insertions(+), 26 deletions(-) rename ext/afform/core/ang/af/{Model.js => Entity.js} (71%) diff --git a/ext/afform/auditor/backlog.md b/ext/afform/auditor/backlog.md index ed5941e976..c5230b4150 100644 --- a/ext/afform/auditor/backlog.md +++ b/ext/afform/auditor/backlog.md @@ -7,8 +7,8 @@ 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 reference legit entities. +* ``, ``, ``, `` 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. diff --git a/ext/afform/core/CRM/Afform/ArrayHtml.php b/ext/afform/core/CRM/Afform/ArrayHtml.php index 7a4e7b76bd..1839271f16 100644 --- a/ext/afform/core/CRM/Afform/ArrayHtml.php +++ b/ext/afform/core/CRM/Afform/ArrayHtml.php @@ -21,7 +21,7 @@ class CRM_Afform_ArrayHtml { '*' => [ '*' => 'text', ], - 'af-model' => [ + 'af-entity' => [ 'name' => 'text', 'type' => 'text', 'data' => 'js', @@ -158,7 +158,7 @@ class CRM_Afform_ArrayHtml { * Determine the type of data that is stored in an attribute. * * @param string $tag - * Ex: 'af-model' + * Ex: 'af-entity' * @param string $attrName * Ex: 'label' * @return string diff --git a/ext/afform/core/Civi/Afform/Utils.php b/ext/afform/core/Civi/Afform/Utils.php index d343894dc8..f8f4cc1505 100644 --- a/ext/afform/core/Civi/Afform/Utils.php +++ b/ext/afform/core/Civi/Afform/Utils.php @@ -11,13 +11,13 @@ class Utils { * @return array */ public static function getEntities($layout) { - $entities = array_column(self::getTags($layout, 'af-model'), NULL, 'name'); + $entities = array_column(self::getTags($layout, 'af-entity'), NULL, 'name'); self::getFields($layout, $entities); return $entities; } /** - * Returns all tags with a certain tag name, e.g. 'af-model' + * Returns all tags with a certain tag name, e.g. 'af-entity' * * @param array $collection * @param string $tagName diff --git a/ext/afform/core/afform.php b/ext/afform/core/afform.php index ba3f5c2ec5..28caaf8952 100644 --- a/ext/afform/core/afform.php +++ b/ext/afform/core/afform.php @@ -217,7 +217,7 @@ function afform_civicrm_alterAngular($angular) { function _afform_getMetadata(phpQueryObject $doc) { $entities = []; - foreach ($doc->find('af-model') as $afmModelProp) { + foreach ($doc->find('af-entity') as $afmModelProp) { $entities[$afmModelProp->getAttribute('name')] = [ 'type' => $afmModelProp->getAttribute('type'), ]; diff --git a/ext/afform/core/ang/af/Model.js b/ext/afform/core/ang/af/Entity.js similarity index 71% rename from ext/afform/core/ang/af/Model.js rename to ext/afform/core/ang/af/Entity.js index b7390a43ff..561563d6ca 100644 --- a/ext/afform/core/ang/af/Model.js +++ b/ext/afform/core/ang/af/Entity.js @@ -1,7 +1,7 @@ (function(angular, $, _) { - // "afModel" is a basic skeletal directive. - // Example usage: ... ... - angular.module('af').directive('afModel', function() { + // "afEntity" is a basic skeletal directive. + // Example usage: ... ... + angular.module('af').directive('afEntity', function() { // 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 = { @@ -21,7 +21,7 @@ entity.id = null; entity.fields = []; afFormCtrl.registerEntity(entity); - // $scope.$watch('afModel', function(newValue){$scope.myOptions = newValue;}); + // $scope.$watch('afEntity', function(newValue){$scope.myOptions = newValue;}); } }; }); diff --git a/ext/afform/core/ang/afBlock/ContactName.html b/ext/afform/core/ang/afBlock/ContactName.html index 541edcc84d..3a345a3322 100644 --- a/ext/afform/core/ang/afBlock/ContactName.html +++ b/ext/afform/core/ang/afBlock/ContactName.html @@ -1 +1,8 @@ -
{{ts('Contact name block for a model of type %1 named %2', {1: afFieldset.getDefn().type, 2: afFieldset.getDefn().modelName})}}
+ + + + + + + + diff --git a/ext/afform/docs/sandbox/planning-v0.3.md b/ext/afform/docs/sandbox/planning-v0.3.md index cce1eb4601..2273a4b889 100644 --- a/ext/afform/docs/sandbox/planning-v0.3.md +++ b/ext/afform/docs/sandbox/planning-v0.3.md @@ -86,13 +86,13 @@ ```html - - - + @@ -148,13 +148,13 @@ ```html - - ` + * Example: `` * Mix-in directives (e.g. `afMonaco` or `afApi4Action`) * The directive name must begin with the `af` prefix. @@ -18,7 +18,7 @@ __Discussion__: These differ in two ways: * Namespacing * Standalone directives form an implicit namespace. - (*Anything passed to `` is implicitly about `af-model`.) + (*Anything passed to `` is implicitly about `af-entity`.) * Mix-in directives must share a namespace with other potential mix-ins. (*The *) * Directive arguments diff --git a/ext/afform/mock/ang/afex.aff.html b/ext/afform/mock/ang/afex.aff.html index 8596e3877b..f81aff3c5f 100644 --- a/ext/afform/mock/ang/afex.aff.html +++ b/ext/afform/mock/ang/afex.aff.html @@ -1,8 +1,8 @@ - - - + + + diff --git a/ext/afform/mock/ang/testAfform.aff.html b/ext/afform/mock/ang/testAfform.aff.html index add785cd58..50acb5062c 100644 --- a/ext/afform/mock/ang/testAfform.aff.html +++ b/ext/afform/mock/ang/testAfform.aff.html @@ -1,9 +1,9 @@
- - - + + + -- 2.25.1