Rename `<af-will-be-model>` to its real name, `<af-model>`
authorTim Otten <totten@civicrm.org>
Fri, 13 Sep 2019 16:27:00 +0000 (12:27 -0400)
committerCiviCRM <info@civicrm.org>
Wed, 16 Sep 2020 02:13:19 +0000 (19:13 -0700)
ext/afform/auditor/backlog.md
ext/afform/core/CRM/Afform/ArrayHtml.php
ext/afform/core/Civi/Afform/Utils.php
ext/afform/core/afform.php
ext/afform/core/ang/af/Model.js [moved from ext/afform/core/ang/af/WillBeModel.js with 70% similarity]
ext/afform/docs/sandbox/planning-v0.3.md
ext/afform/docs/style.md
ext/afform/mock/ang/afex.aff.html

index 19a6d1a7f3a3ba81f72275798b4aec2decabed19..bdd7a71f56d7b8b9b78f90fd82625da2d4ee5fef 100644 (file)
@@ -7,8 +7,8 @@ validator to catch. Loosely/informally:
 
 * HTML partials should be well-formed/parseable XML
 * Warnings about any unrecognized tags/attributes/classes.
-* `<af-form>`, `<af-will-be-model>`, `<af-fieldset>`, `<af-field>` should have suitable relationships.
-* `<af-will-be-model>` should reference legit entities.
+* `<af-form>`, `<af-model>`, `<af-fieldset>`, `<af-field>` should have suitable relationships.
+* `<af-model>` should reference legit entities.
 * `<af-field>` should reference legit fields.
     * Future consideration: how to validate when it's part of a subform?
 * `<af-fieldset>` should reference a declared model.
index 9d11d35df947a73206a1bfd52f377e84533ac8eb..e957e5cba0713095cbf19223db2bbc25800a69ed 100644 (file)
@@ -21,7 +21,7 @@ class CRM_Afform_ArrayHtml {
     '*' => [
       '*' => 'text',
     ],
-    'af-will-be-model' => [
+    'af-model' => [
       'af-name' => 'text',
       'af-entity' => 'text',
       'af-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-will-be-model'
+   *   Ex: 'af-model'
    * @param string $attrName
    *   Ex: 'af-name'
    * @return string
index 6c04167695d93e988442b4de806bf1e12d5e826d..9095ed0208349e19bc69246b1f5169c463924bc7 100644 (file)
@@ -11,13 +11,13 @@ class Utils {
    * @return array
    */
   public static function getEntities($layout) {
-    $entities = array_column(self::getTags($layout, 'af-will-be-model'), NULL, 'af-name');
+    $entities = array_column(self::getTags($layout, 'af-model'), NULL, 'af-name');
     self::getFields($layout, $entities);
     return $entities;
   }
 
   /**
-   * Returns all tags with a certain tag name, e.g. 'af-will-be-model'
+   * Returns all tags with a certain tag name, e.g. 'af-model'
    *
    * @param array $collection
    * @param string $tagName
index 03316a5c3df7cf4d89298659773a4a94c5ff3169..cf1189520d42bbf5c7e5ced76824c7a31bfd72c9 100644 (file)
@@ -214,7 +214,7 @@ function afform_civicrm_alterAngular($angular) {
 
 function _afform_getMetadata(phpQueryObject $doc) {
   $entities = [];
-  foreach ($doc->find('af-will-be-model') as $afmModelProp) {
+  foreach ($doc->find('af-model') as $afmModelProp) {
     $entities[$afmModelProp->getAttribute('af-name')] = [
       'type' => $afmModelProp->getAttribute('type'),
     ];
similarity index 70%
rename from ext/afform/core/ang/af/WillBeModel.js
rename to ext/afform/core/ang/af/Model.js
index 6dbda8c70193810cface4f28c7ff9cff772d880e..6d94908c70689edb55e2a6a02143c17e9a293fa5 100644 (file)
@@ -1,7 +1,7 @@
 (function(angular, $, _) {
-  // "afWillBeModel" is a basic skeletal directive.
-  // Example usage: <af-form>... <af-will-be-model af-name="myModel" type="Individual" /> ...</af-form>
-  angular.module('af').directive('afWillBeModel', function() {
+  // "afModel" is a basic skeletal directive.
+  // Example usage: <af-form>... <af-model af-name="myModel" type="Individual" /> ...</af-form>
+  angular.module('af').directive('afModel', 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('afWillBeModel', function(newValue){$scope.myOptions = newValue;});
+        // $scope.$watch('afModel', function(newValue){$scope.myOptions = newValue;});
       }
     };
   });
index 6c4b66b87fad8315dea12247d9481647021934db..ea72e2ae0d8082c881652c0431c1f59f0724e37f 100644 (file)
 
 ```html
 <af-form ctrl="modelListCtrl">
-  <af-will-be-model
+  <af-model
     af-type="Individual"
     af-name="parent"
     af-label="Parent"
     af-api4-params="{where: ['id','=', routeParams.cid]}"
   />
-  <af-will-be-model
+  <af-model
     af-type="Individual"
     af-name="spouse"
     af-label="Spouse"
 <!-- input: options.parent.id -->
 <!-- Decision: These blocks are written in straight AngularJS rather than Afform -->
 <!--<af-form>-->
-  <!--<af-will-be-model -->
+  <!--<af-model -->
     <!--af-type="Email"-->
     <!--af-name="email"-->
     <!--af-label="Emails"-->
 
 ```html
 <af-form ctrl="modelListCtrl">
-  <af-will-be-model
+  <af-model
     af-type="Individual"
     af-name="parent"
     af-label="Parent"
     af-api4-params="{where: ['id','=', routeParams.cid]}"
   />
-  <af-will-be-model
+  <af-model
     af-type="Individual"
     af-name="spouse"
     af-label="Spouse"
index 4cf1bdc80cb8957d41511cc95628705d61b7bcc2..58736e8ccdc4e358ecc615b362f84c9f9ee06189 100644 (file)
@@ -4,10 +4,10 @@
 
 The following naming conventions apply to directives defined within `afform.git`:
 
-* Standalone directives (e.g. `afWillBeModel` or `afField`), including forms (e.g. `afHtmlEditor`)
+* Standalone directives (e.g. `afModel` or `afField`), including forms (e.g. `afHtmlEditor`)
     * The directive name must begin with the `af` prefix.
     * Supplemental attributes SHOULD NOT begin with the `af` prefix.
-    * Example: `<af-will-be-model type="Activity" name="myPhoneCall">`
+    * Example: `<af-model type="Activity" name="myPhoneCall">`
 
 * 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 `<af-will-be-model>` is implicitly about `af-will-be-model`.)
+      (*Anything passed to `<af-model>` is implicitly about `af-model`.)
     * Mix-in directives must share a namespace with other potential mix-ins.
       (*The *)
 * Directive arguments
index c0689336a8c02e899d618dfd4f00378886a21b2f..81e94a6bb12c8314e5614fded87017db84d9ecb2 100644 (file)
@@ -1,8 +1,8 @@
 <af-form ctrl="modelListCtrl">
   <!-- FIXME: Distinguish "Individual"s from "Household"s -->
-  <af-will-be-model type="Contact" af-name="parent" af-label="Parent" af-api4-params="{where: ['id','=', routeParams.cid]}"></af-will-be-model>
-  <af-will-be-model type="Contact" af-name="spouse" af-label="Spouse" af-contact-relationship="['Spouse of', 'parent']"></af-will-be-model>
-  <af-will-be-model type="Contact" af-name="home" af-label="Home"></af-will-be-model>
+  <af-model type="Contact" af-name="parent" af-label="Parent" af-api4-params="{where: ['id','=', routeParams.cid]}"></af-model>
+  <af-model type="Contact" af-name="spouse" af-label="Spouse" af-contact-relationship="['Spouse of', 'parent']"></af-model>
+  <af-model type="Contact" af-name="home" af-label="Home"></af-model>
 
   <!-- "parent" and "spouse" should be exported as variables in this scope -->