-
Notifications
You must be signed in to change notification settings - Fork 0
/
form-field-multi.html
164 lines (158 loc) · 8.97 KB
/
form-field-multi.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<!-- <pat-form-field-multi> -->
<fieldset
class="
{% include patterns/form-field-auto-save-classes %}
group
layout-{{item.layout}}
{% if item.depends %}pat-depends{% endif %}
{% if item.subform %}pat-subform{% endif %}
{% if item.auto-submit %}pat-autosubmit{% endif %}
{% if item.inject %}pat-inject{% endif %}"
{% if item.action %}data-pat-inject="{{ item.inject }}"{% endif %}
{% if item.depends %}data-pat-depends="{{ item.depends }}; transition: slide"{% endif %}>
<legend>{% include patterns/i18n id=item.label %}</legend>
<span
class="field-cluster layout-{{item.layout}}">
<!-- <slot name="fields"> -->
{% for subitem in item.items %}
{% if subitem.type == 'text' %}
{% include patterns/form-field-text.html
name=subitem.name
value=subitem.value
chars=subitem.chars
placeholder=subitem.placeholder
size=subitem.size
depends=subitem.depends
required=subitem.required
state=subitem.state
maxlength=subitem.maxlength
autofocus=subitem.autofocus
%}
{% endif %}
{% if subitem.type == "email" %}
<label>
{% include patterns/i18n id=subitem.label %}{% include patterns/form-required.html %}
<input
type="email"
name="{{ subitem.name }}"
size="{{ subitem.chars }}"
value="{{ subitem.value }}" />
</label>
{% endif %}
{% if subitem.type == "checkbox" %}
<label
class="pat-checklist">
<input
type="checkbox"
name="{{ subitem.name }}"
size="{{ subitem.chars }}"
value="{{ subitem.value }}" />
{% include patterns/i18n id=subitem.label %}{% include patterns/form-required.html %}
</label>
{% endif %}
{% if subitem.type == 'date' %}
{% include patterns/form-field-date.html
name=subitem.name
value=subitem.value
chars=subitem.chars
placeholder=subitem.placeholder
size=subitem.size
depends=subitem.depends
%}
{% endif %}
{% if subitem.type == 'number' %}
<label
class="{% if subitem.depends %}pat-depends {% endif %} {{ subitem.class }}"
{% if subitem.depends %}data-pat-depends="{{ subitem.depends }}"{% endif %}>
{{ site.data[ui_data_path].ui[subitem.label][site.data.config.lang] }}
<input
{% if subitem.required == true %}required="required"{% endif %}
{% if subitem.state == 'disabled' %}disabled{% endif %}
class="{% if subitem.autofocus %}pat-autofocus{% endif %}"
{% if subitem.step %}step="{{ subitem.step }}"{% endif %}
{% if subitem.min %}min="{{ subitem.min }}"{% endif %}
{% if subitem.max %}max="{{ subitem.max }}"{% endif %}
type="number"
size="{{ subitem.chars }}"
name="{{ subitem.name }}"
id="{{ subitem.id }}"
placeholder="{% include patterns/i18n
id=subitem.placeholder %}"
value="{{ subitem.value }}" />
</label>
{% endif %}
{% if subitem.type == 'currency' %}
<label
class="{% if subitem.depends %}pat-depends{% endif %} {{ subitem.class }}"
{% if subitem.id %}id="{{ subitem.id }}"{% endif %}
{% if subitem.depends %}data-pat-depends="{{ subitem.depends }}"{% endif %}>
{{ site.data[ui_data_path].ui[subitem.label][site.data.config.lang] }}
<span
class="composed currency-field">
<abbr
title="Euro"
class="currency">{{subitem.symbol}}</abbr>
<input
{% if subitem.required == true %}required="required"{% endif %}
{% if subitem.state == 'disabled' %}disabled{% endif %}
{% if subitem.step %}step="{{ subitem.step }}"{% endif %}
{% if subitem.min %}min="{{ subitem.min }}"{% endif %}
{% if subitem.max %}max="{{ subitem.max }}"{% endif %}
type="number"
size="{{ subitem.chars }}"
name="{{ subitem.name }}"
id="{{ subitem.id }}"
placeholder="{{ site.data[ui_data_path].ui[subitem.placeholder][site.data.config.lang] }}"
value="{{ subitem.value }}" />
</span>
</label>
{% endif %}
<!-- <pat-form-field-select> -->
{% if subitem.type == "select" %}
<label
class="{% if subitem.depends %}pat-depends"{% endif %} {{ subitem.class }}"
{% if subitem.depends %}data-pat-depends="{{ subitem.depends }}"{% endif %}>
{{ site.data[ui_data_path].ui[subitem.label][site.data.config.lang] }}{% include patterns/form-required.html %}
{% if subitem.help %}{% include patterns/help-icon.html id="this" %}{% endif %}
<select
name="{{ subitem.name }}">
{% for option in subitem.items %}
<option
{% if option.value %}
value="{{ option.value }}"
{% else %}
value="{{ option.label | remove: 'label_' | slugify }}"
{% endif %}
{% if option.selected %}selected{% endif %} >
{% if option.label contains 'label_' %}
{% include patterns/i18n
id=option.label %}
{% else %}
{{ option.label }}
{% endif %}
</option>
{% endfor %}
</select>
</label>
{% endif %}
<!-- </pat-select> -->
{% if subitem.type == 'label' %}
{{ site.data[ui_data_path].ui[subitem.label][site.data.config.lang] }}
{% endif %}
{% if subitem.type == 'hidden' %}
<input
type="hidden"
name="{{ subitem.name }}"
id="{{ subitem.id }}"
value="{{ subitem.value }}">
{% endif %}
{% endfor %}
<!-- </slot> -->
</span>
{% if item.help %}
{% include patterns/form-help.html
content=item.help more=item.help_more %}
{% endif %}
{% include patterns/form-has-changes.html %}
</fieldset>
<!-- </pat-form-field-multi> -->