-
Notifications
You must be signed in to change notification settings - Fork 732
/
options.html
47 lines (47 loc) · 3.01 KB
/
options.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
<!--/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Copyright 2016 Adobe
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
<sly data-sly-use.options="com.adobe.cq.wcm.core.components.models.form.Options"
data-sly-use.template="core/wcm/components/commons/v1/templates.html"
data-sly-test.isNotEmpty="${options.items.size}">
<fieldset class="cmp-form-options cmp-form-options--${options.type.value}">
<sly data-sly-test="${options.type.value == 'checkbox' || options.type.value == 'radio'}">
<legend class="cmp-form-options__legend">${options.title}</legend>
<label class="cmp-form-options__field-label" data-sly-repeat.optionItem="${options.items}">
<input class="cmp-form-options__field cmp-form-options__field--${options.type.value}"
name="${options.name}"
value="${optionItem.value}" checked="${optionItem.selected}" disabled="${optionItem.disabled}"
type="${options.type.value}"
data-sly-attribute.aria-describedby="${options.helpMessage ? [options.id, 'helpMessage'] : '' @ join = '-'}"/>
<span class="cmp-form-options__field-description">${optionItem.text}</span>
</label>
</sly>
<sly data-sly-test="${options.type.value == 'drop-down' || options.type.value == 'multi-drop-down'}">
<label class="cmp-form-options__label" for="${options.id}">${options.title}</label>
<select class="cmp-form-options__field cmp-form-options__field--${options.type.value}"
name="${options.name}" id="${options.id}"
data-sly-list.optionItem="${options.items}"
data-sly-attribute.multiple="${options.type.value == 'multi-drop-down'}">
<option value="${optionItem.value}" selected="${optionItem.selected}" disabled="${optionItem.disabled}"
data-sly-attribute.aria-describedby="${options.helpMessage ? [options.id, 'helpMessage'] : '' @ join = '-'}">
${optionItem.text}
</option>
</select>
</sly>
<p id="${options.id}-helpMessage" class="cmp-form-options__help-message" data-sly-test="${options.helpMessage}">
${options.helpMessage}</p>
</fieldset>
</sly>
<sly data-sly-call="${template.placeholder @ isEmpty=!isNotEmpty, classAppend='cmp-form-options'}"></sly>