Commit | Line | Data |
---|---|---|
797aca93 TO |
1 | # Code Style |
2 | ||
3 | ## Naming | |
4 | ||
5 | The following naming conventions apply to directives defined within `afform.git`: | |
6 | ||
c37151d2 | 7 | * Standalone directives (e.g. `afEntity` or `afField`), including forms (e.g. `afHtmlEditor`) |
797aca93 TO |
8 | * The directive name must begin with the `af` prefix. |
9 | * Supplemental attributes SHOULD NOT begin with the `af` prefix. | |
c37151d2 | 10 | * Example: `<af-entity type="Activity" name="myPhoneCall">` |
797aca93 TO |
11 | |
12 | * Mix-in directives (e.g. `afMonaco` or `afApi4Action`) | |
13 | * The directive name must begin with the `af` prefix. | |
14 | * Supplemental attributes SHOULD begin with a prefix that matches the directive. | |
15 | * Example: `<button af-api4-action="['Job', 'process_mailings', {}]` af-api4-success-msg="ts('Processed pending mailings')"> | |
16 | ||
17 | __Discussion__: These differ in two ways: | |
18 | ||
19 | * Namespacing | |
20 | * Standalone directives form an implicit namespace. | |
c37151d2 | 21 | (*Anything passed to `<af-entity>` is implicitly about `af-entity`.) |
797aca93 TO |
22 | * Mix-in directives must share a namespace with other potential mix-ins. |
23 | (*The *) | |
24 | * Directive arguments | |
25 | * Standalone directives only take input on the supplemental attributes (`type="..."`). | |
26 | * Mix-ins take inputs via the directive's attribute (`af-api4-action="..."`) and the supplemental attributes (`af-api4-success-msg="..."`). |