* 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.
'*' => [
'*' => 'text',
],
- 'af-will-be-model' => [
+ 'af-model' => [
'af-name' => 'text',
'af-entity' => 'text',
'af-data' => 'js',
* 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
* @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
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'),
];
(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 = {
entity.id = null;
entity.fields = [];
afFormCtrl.registerEntity(entity);
- // $scope.$watch('afWillBeModel', function(newValue){$scope.myOptions = newValue;});
+ // $scope.$watch('afModel', function(newValue){$scope.myOptions = newValue;});
}
};
});
```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"
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.
* 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
<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 -->