forked from Meteor-Community-Packages/meteor-autoform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautoform.html
104 lines (92 loc) · 2.68 KB
/
autoform.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<!-- Templates that render a form -->
<template name="autoForm">
<form {{atts}}>
{{#with innerContext ..}}
{{> UI.contentBlock this}}
{{/with}}
</form>
</template>
<template name="quickForm">
{{#with innerContext this}}
{{#with afTemplateName 'quickForm' ../template}}
{{> UI.dynamic template=this data=..}}
{{/with}}
{{/with}}
</template>
<template name="afDeleteButton">
{{#with innerContext this UI.contentBlock}}
{{#with afTemplateName 'afDeleteButton' ../template}}
{{> UI.dynamic template=this data=..}}
{{/with}}
{{/with}}
</template>
<!-- Templates that render fields within a form -->
<template name="afQuickField">
{{#if isGroup atts=this}}
{{> afObjectField}}
{{else}}
{{#if isFieldArray atts=this}}
{{> afArrayField}}
{{else}}
{{#with innerContext atts=this}}
{{#with afTemplateName 'afQuickField' ../template}}
{{> UI.dynamic template=this data=..}}
{{/with}}
{{/with}}
{{/if}}
{{/if}}
</template>
<template name="afQuickFields">
{{#each afFieldNames name=this.name fields=this.fields omitFields=this.omitFields}}
{{#with name=this}}
{{> afQuickField quickFieldAtts}}
{{/with}}
{{/each}}
</template>
<template name="afObjectField">
{{#with atts=this}}
{{#with afTemplateName 'afObjectField' ../template}}
{{> UI.dynamic template=this data=..}}
{{/with}}
{{/with}}
</template>
<template name="afArrayField">
{{#with innerContext atts=this}}
{{#with afTemplateName 'afArrayField' ../template}}
{{> UI.dynamic template=this data=..}}
{{/with}}
{{/with}}
</template>
<template name="afFieldInput">
{{#with innerContext atts=this}}
{{#with afTemplateName getTemplateType ../template}}
{{> UI.dynamic template=this data=..}}
{{/with}}
{{/with}}
</template>
<template name="afFieldSelect">
{{#with innerContext atts=this contentBlock=UI.contentBlock contentBlockContext=..}}
{{#with afTemplateName 'afFieldSelect' ../template}}
{{> UI.dynamic template=this data=..}}
{{/with}}
{{/with}}
</template>
<template name="afFieldLabel">
{{#with atts=this}}
{{#with afTemplateName 'afFieldLabel' ../template}}
{{> UI.dynamic template=this data=..}}
{{/with}}
{{/with}}
</template>
<template name="afEachArrayItem">
{{! This is a block component and doesn't render anything visible, so no customizable template is needed for this}}
{{#with innerContext atts=this}}
{{#each this}}
{{#if this.removed}}
<input type="hidden" name="{{this.name}}" data-schema-key="{{this.name}}" data-null-value="true" value="">
{{else}}
{{> UI.contentBlock this}}
{{/if}}
{{/each}}
{{/with}}
</template>