Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions core/src/main/java/ca/yukon/aem/core/models/LikertScale.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package ca.yukon.aem.core.models;

import com.adobe.aemds.guide.common.GuideRadioButton;

public class LikertScale extends GuideRadioButton {

public LikertScale() {
}

public String getLowEndLabel() {
return this.resourceProps.get("lowEndLabel", String.class);
}

public String getHighEndLabel() {
return this.resourceProps.get("highEndLabel", String.class);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@
</accordion>
</items>
</content>
</jcr:root>
</jcr:root>
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@
<button class="button-default button-medium guide-fu-attach-button" type="button" style="${guide:encodeForHtmlAttr(guideField.widgetInlineStyles,xssAPI)}"
aria-labelledby="${guide:encodeForHtmlAttr(guideField.labelForId,xssAPI)}_desc">${guide:encodeForHtmlAttr(guideField.buttonText,xssAPI)}</button>
<ul class="guide-fu-fileItemList"></ul>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Likert Scale component.

Extends the out-of-the-box AEM Forms Foundation radio button component and
adds two configurable dialog properties:

lowEndLabel — description of lowest value on the scale.
e.g. "Not at all satisfied"

highEndLabel — description of the highest value on the scale.
e.g. "Very satisfied"

Deploy to:
ui.apps/src/main/content/jcr_root/apps/<yourproject>/components/form/likertscale/
-->
<jcr:root
xmlns:jcr="http://www.jcp.org/jcr/1.0"
xmlns:cq="http://www.day.com/jcr/cq/1.0"
xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
jcr:primaryType="cq:Component"
jcr:title="Likert Scale"
jcr:description="Likert Scale component."
sling:resourceSuperType="fd/af/components/guideradiobutton"
componentGroup="Adaptive Form" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:granite="http://www.adobe.com/jcr/granite/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0"
xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
jcr:primaryType="nt:unstructured"
jcr:title="\0"
sling:resourceType="cq/gui/components/authoring/dialog">
<content
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<accordion
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/accordion">
<items jcr:primaryType="nt:unstructured">
<basic
jcr:primaryType="nt:unstructured"
jcr:title="Basic"
sling:resourceType="granite/ui/components/coral/foundation/container"/>
<help
jcr:primaryType="nt:unstructured"
jcr:title="Help Content"
sling:resourceType="granite/ui/components/coral/foundation/container"/>
<accessibility jcr:primaryType="nt:unstructured"/>
<patterns
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container"/>
<scaleProperties
jcr:primaryType="nt:unstructured"
jcr:title="Scale properties"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<highEndLabel jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldLabel="High End Label"
name="./highEndLabel"
placeholder="e.g., Strongly Agree"/>

<lowEndLabel jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldLabel="Low End Label"
name="./lowEndLabel"
placeholder="e.g., Strongly Disagree"/>
</items>
</scaleProperties>
</items>
</accordion>
</items>
</content>
</jcr:root>
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0"
xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
xmlns:cq="http://www.day.com/jcr/cq/1.0"
jcr:primaryType="nt:unstructured"
jcr:title="Likert Scale"
guideNodeClass="guideLikertScale"
inputType="radio">

<!-- Propriétés par défaut pour le composant -->
<items jcr:primaryType="nt:unstructured">
<!-- Éléments de l'échelle de Likert -->
<highEndLabel jcr:primaryType="nt:unstructured"
guideNodeClass="guideLikertScaleItem"
name="highEndLabel"
value="Strongly Agree"/>

<lowEndLabel jcr:primaryType="nt:unstructured"
guideNodeClass="guideLikertScaleItem"
name="lowEndLabel"
value="Strongly Disagree"/>

<!-- Options par défaut (ex: 1 à 5) -->
<options jcr:primaryType="nt:unstructured">
<option1 jcr:primaryType="nt:unstructured"
guideNodeClass="guideLikertScaleOption"
name="option1"
value="1"
label="1"/>
<option2 jcr:primaryType="nt:unstructured"
guideNodeClass="guideLikertScaleOption"
name="option2"
value="2"
label="2"/>
<option3 jcr:primaryType="nt:unstructured"
guideNodeClass="guideLikertScaleOption"
name="option3"
value="3"
label="3"/>
<option4 jcr:primaryType="nt:unstructured"
guideNodeClass="guideLikertScaleOption"
name="option4"
value="4"
label="4"/>
<option5 jcr:primaryType="nt:unstructured"
guideNodeClass="guideLikertScaleOption"
name="option5"
value="5"
label="5"/>
</options>
<comment
jcr:primaryType="nt:unstructured"
guideNodeClass="guideCompositeFieldItem"
name="comment"/>
</items>
</jcr:root>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0"
jcr:primaryType="cq:ClientLibraryFolder"
categories="[yukon-forms.components.likert-scale,yukon-forms.components.all]"
allowProxy="{Boolean}true" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

###############################################################################
# Copyright 2021 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.
###############################################################################

#base=css
likertscale.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
.afLikertScale {
display: flex;
flex-direction: row;
justify-content: space-between;
}

.afLikertScale::before {
display: none;
}

.afLikertScale .likert-high-end-label {
position: absolute;
bottom: 0;
right: 0;
font-size: 0.9rem;
color: #737373;
}

.afLikertScale .likert-low-end-label {
position: absolute;
bottom: 0;
left: 0;
font-size: 0.9rem;
color: #737373;
}

.afLikertScale input[type="radio"] {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;

-webkit-appearance: none;
-moz-appearance: none;
appearance: none;

border-radius: 5px;
width: 40px;
height: 40px;
border-color: #cdcdcd;

cursor: pointer;
}

.afLikertScale .likertWidgetLabel {
position: absolute;
top: 0;
bottom: 0;
right: 0;
left: 0;
margin: auto;
width: fit-content;
height: fit-content;
}

.afLikertScale .likertWidgetLabel label {
margin: 0;
font-size: 1rem;
font-weight: bold;
cursor: pointer;
}

.afLikertScale .likertScaleContainer {
position: relative;
}

.afLikertScale .likertWidgetLabel label::after {
display: none;
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<%------------------------------------------------------------------------
~
~ ADOBE CONFIDENTIAL
~ __________________
~
~ Copyright 2014 Adobe Systems Incorporated
~ All Rights Reserved.
~
~ NOTICE: All information contained herein is, and remains
~ the property of Adobe Systems Incorporated and its suppliers,
~ if any. The intellectual and technical concepts contained
~ herein are proprietary to Adobe Systems Incorporated and its
~ suppliers and may be covered by U.S. and Foreign Patents,
~ patents in process, and are protected by trade secret or copyright law.
~ Dissemination of this information or reproduction of this material
~ is strictly forbidden unless prior written permission is obtained
~ from Adobe Systems Incorporated.
--------------------------------------------------------------------------%>
<%@include file="/libs/fd/af/components/guidesglobal.jsp"%>
<guide:initializeBean name="guideField" className="ca.yukon.aem.core.models.LikertScale"/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<%--
Likert Scale Component
--%>
<%@include file="/libs/fd/af/components/guidesglobal.jsp"%>
<cq:includeClientLib categories="yukon-forms.components.likert-scale"/>
<%@ page import="com.adobe.granite.toggle.api.ToggleRouter,
com.adobe.aemds.guide.fdfl.utils.FeatureToggleConstants" %>

<%
ToggleRouter toggleRouter = sling.getService(ToggleRouter.class);
boolean isDoubleExtFTEnabled = toggleRouter != null && toggleRouter.isEnabled(FeatureToggleConstants.FT_DISABLE_DOUBLE_EXTENSION_FILES);
pageContext.setAttribute("isDoubleExtFTEnabled", isDoubleExtFTEnabled);
%>

<cq:includeClientLib categories="yukon-forms.components.likert-scale"/>
<div class="afLikertScale" style="${guide:encodeForHtmlAttr(guideField.styles,xssAPI)};${guide:encodeForHtmlAttr(guideField.widgetInlineStyles,xssAPI)}">
<span class="likert-high-end-label">
${guide:encodeForHtml(guideField.highEndLabel, xssAPI)}
</span>
<c:forEach items="${guideField.options}" var="option" varStatus="loopCounter">
<div class="likertScaleContainer ${guide:encodeForHtmlAttr(guideField.alignment,xssAPI)} ${guide:encodeForHtmlAttr(guideField.name,xssAPI)} ${guide:encodeForHtmlAttr(guideField.cssClassName,xssAPI)}">
<div class="<%= GuideConstants.GUIDE_FIELD_WIDGET%> left" data-id="${loopCounter.count}">
<input type="radio" id="${guideField.id}${'-'}${loopCounter.count}${"_widget"}"
name="${guide:encodeForHtmlAttr(guideField.name,xssAPI)}" value="${guide:encodeForHtmlAttr(option.key,xssAPI)}" ${option.key == guideField.value ? "checked" : ""}
aria-describedby="${guide:encodeForHtmlAttr(guideField.labelForId,xssAPI)}_input_label_${loopCounter.count} ${guide:encodeForHtmlAttr(guideField.labelForId,xssAPI)}_desc" />
</div>
<div class="likertWidgetLabel right" >
<label id="${guide:encodeForHtmlAttr(guideField.labelForId,xssAPI)}_input_label_${loopCounter.count}"><c:if test="${guideField.areOptionsRichText eq false}">${guide:encodeForHtml(option.value,xssAPI)}</c:if><c:if test="${guideField.areOptionsRichText}">${guide:filterHtml(option.value,xssAPI)}</c:if></label>
</div>
</div>
</c:forEach>
<span class="likert-low-end-label">
${guide:encodeForHtml(guideField.lowEndLabel, xssAPI)}
</span>
</div>