Skip to content

Commit

Permalink
Terms and Conditions review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
barshatr authored and ci-build committed Oct 2, 2023
1 parent 10996c1 commit 3ca93e5
Show file tree
Hide file tree
Showing 17 changed files with 127 additions and 117 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,31 @@

import org.osgi.annotation.versioning.ConsumerType;

/**
* Defines the form {@code TermsAndConditions} Sling Model used for the {@code /apps/core/fd/components/form/termsandconditions/v1/termsandconditions} component.
*
* @since com.adobe.cq.forms.core.components.models.form 4.5.0
*/
@ConsumerType
public interface TermsAndConditions extends Container, ContainerConstraint {

String FD_TERMS_AND_CONDITIONS = "fd:tnc";

/**
*
* @return {@code true} if approval checkbox should be shown, otherwise {@code false}
*/
boolean isShowApprovalOption();

/**
*
* @return {@code true} if links to external Terms & Conditions pages are to be shown, otherwise {@code false if consent text is to be shown}
*/
boolean isShowLink();

/**
*
* @return @return {@code true} if the content is to be shown as pop-up , otherwise {@code false}
*/
boolean isShowAsPopup();
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<link
jcr:primaryType="nt:unstructured"
jcr:title="\0"
sling:resourceType="core/fd/components/form/links/v1/links"
sling:resourceType="core/fd/components/form/toggleablelink/v1/toggleablelink"
orientation="vertical"
type="string[]"
enum="your-link-here"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<link
jcr:primaryType="nt:unstructured"
jcr:title="\0"
sling:resourceType="core/fd/components/form/links/v1/links"
sling:resourceType="core/fd/components/form/toggleablelink/v1/toggleablelink"
enum="your-link-here"
enumNames="[label for the link]"
fieldType="checkbox-group"
Expand Down Expand Up @@ -115,7 +115,7 @@
jcr:lastModified="{Date}2023-09-20T17:28:00.048+05:30"
jcr:lastModifiedBy="admin"
jcr:primaryType="nt:unstructured"
sling:resourceType="core/fd/components/form/links/v1/links"
sling:resourceType="core/fd/components/form/toggleablelink/v1/toggleablelink"
enabled="{Boolean}true"
enum="http://localhost"
enumNames="label for the link"
Expand Down Expand Up @@ -181,7 +181,7 @@
<link
jcr:primaryType="nt:unstructured"
jcr:title="\0"
sling:resourceType="core/fd/components/form/links/v1/links"
sling:resourceType="core/fd/components/form/toggleablelink/v1/toggleablelink"
enum="your-link-here"
enumNames="[label for the link]"
fieldType="checkbox-group"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
~ limitations under the License.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
<sly data-sly-use.renderer="${'checkboxgroup.js'}"
data-sly-use.widget="widget.html"
data-sly-use.clientlib="${'/libs/granite/sightly/templates/clientlib.html'}"
data-sly-use.label="${renderer.labelPath}"
data-sly-use.shortDescription="${renderer.shortDescriptionPath}"
Expand All @@ -37,24 +38,7 @@
<div data-sly-call="${label.label @componentId=widgetId, labelValue=checkboxgroup.label.value, labelVisible=checkboxgroup.label.visible, bemBlock='cmp-adaptiveform-checkboxgroup'}" data-sly-unwrap></div>
<div data-sly-call="${questionMark.questionMark @componentId=checkboxgroup.id, longDescription=checkboxgroup.description, bemBlock='cmp-adaptiveform-checkboxgroup'}" data-sly-unwrap></div>
</div>

<div class="cmp-adaptiveform-checkboxgroup__widget ${checkboxgroup.orientation}" id="${widgetId}">
<div data-sly-list="${checkboxgroup.enums}" data-sly-unwrap>
<div class="cmp-adaptiveform-checkboxgroup-item ${checkboxgroup.name}">
<label class="cmp-adaptiveform-checkboxgroup__option-label"
title="${checkboxgroup.tooltipVisible ? '' : checkboxgroup.tooltipText}">
<input class="cmp-adaptiveform-checkboxgroup__option__widget" type="checkbox"
name="${checkboxgroup.name}"
value="${checkboxgroup.enums[itemList.index].toString}"
checked="${checkboxgroup.enums[itemList.index] in checkboxgroup.default }"
disabled="${!checkboxgroup.enabled || checkboxgroup.readOnly}"
aria-readonly="${checkboxgroup.readOnly ? 'true' : ''}"/>
<span>${checkboxgroup.enumNames[itemList.index]}</span>
</label>
</div>
</div>
</div>

<sly data-sly-call="${widget.widget @ checkboxgroup = checkboxgroup}"></sly>
<div data-sly-call="${shortDescription.shortDescription @componentId=checkboxgroup.id, shortDescriptionVisible=checkboxgroup.tooltipVisible, shortDescription=checkboxgroup.tooltip, bemBlock='cmp-adaptiveform-checkboxgroup'}" data-sly-unwrap>
</div>
<div data-sly-call="${longDescription.longDescription @componentId=checkboxgroup.id, longDescription=checkboxgroup.description, bemBlock='cmp-adaptiveform-checkboxgroup'}" data-sly-unwrap></div>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!--/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Copyright 2023 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.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
<template data-sly-template.widget="${ @ checkboxgroup }">
<div class="cmp-adaptiveform-checkboxgroup__widget ${checkboxgroup.orientation}" id="${widgetId}">
<div data-sly-list="${checkboxgroup.enums}" data-sly-unwrap>
<div class="cmp-adaptiveform-checkboxgroup-item ${checkboxgroup.name}">
<label class="cmp-adaptiveform-checkboxgroup__option-label"
title="${checkboxgroup.tooltipVisible ? '' : checkboxgroup.tooltipText}">
<input class="cmp-adaptiveform-checkboxgroup__option__widget" type="checkbox"
name="${checkboxgroup.name}"
value="${checkboxgroup.enums[itemList.index].toString}"
checked="${checkboxgroup.enums[itemList.index] in checkboxgroup.default }"
disabled="${!checkboxgroup.enabled || checkboxgroup.readOnly}"
aria-readonly="${checkboxgroup.readOnly ? 'true' : ''}"/>
<span>${checkboxgroup.enumNames[itemList.index]}</span>
</label>
</div>
</div>
</div>
</template>

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,12 @@ BLOCK cmp-adaptiveform-termsandcondition
ELEMENT cmp-adaptiveform-termsandcondition__close-button
ELEMENT cmp-adaptiveform-termsandcondition__content
ELEMENT cmp-adaptiveform-termsandcondition__text
ELEMENT cmp-adaptiveform-termsandcondition__text .cmp-adaptiveform-text
ELEMENT cmp-adaptiveform-termsandcondition__text-intersect
ELEMENT cmp-adaptiveform-termsandcondition__link
ELEMENT cmp-adaptiveform-termsandcondition__link .cmp-adaptiveform-checkboxgroup
ELEMENT cmp-adaptiveform-termsandcondition__approvalcheckbox
ELEMENT cmp-adaptiveform-termsandcondition__approvalcheckbox .cmp-adaptiveform-checkbox
ELEMENT cmp-adaptiveform-termsandcondition__shortdescription
ELEMENT cmp-adaptiveform-termsandcondition__longdescription
ELEMENT cmp-adaptiveform-termsandcondition__errormessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<link
jcr:primaryType="nt:unstructured"
jcr:title="\0"
sling:resourceType="core/fd/components/form/links/v1/links"
sling:resourceType="core/fd/components/form/toggleablelink/v1/toggleablelink"
orientation="vertical"
type="string[]"
enum="your-link-here"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
(function($) {
"use strict";

var Utils = window.CQ.FormsCoreComponents.Utils.v1,
const Utils = window.CQ.FormsCoreComponents.Utils.v1,
EDIT_DIALOG = ".cmp-adaptiveform-termsandconditions__editdialog";

function handleToggleOfApprovalOptions(dialog) {
var approvalOption = dialog.find('.cmp-adaptiveform-termsandconditions__showapprovaloption[name="./showApprovalOption"]')[0];
var showAsPopupWidget = dialog.find('.cmp-adaptiveform-termsandconditions__showaspopup[name="./showAsPopup"]')[0];
var showAsPopup = dialog.find('.cmp-adaptiveform-termsandconditions__showaspopup[name="./showAsPopup"]')[0]['checked'];
const approvalOption = dialog.find('.cmp-adaptiveform-termsandconditions__showapprovaloption[name="./showApprovalOption"]')[0];
const showAsPopupWidget = dialog.find('.cmp-adaptiveform-termsandconditions__showaspopup[name="./showAsPopup"]')[0];
let showAsPopup = dialog.find('.cmp-adaptiveform-termsandconditions__showaspopup[name="./showAsPopup"]')[0]['checked'];
function toggleApprovalOption(show) {
if (show) {
approvalOption.readOnly=false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="nt:unstructured">
<links/>
<toggleablelink/>
</jcr:root>
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
cq:icon="panel"
cq:isContainer="{Boolean}true"
jcr:description="Links"
jcr:description="Toggleable Links"
jcr:primaryType="cq:Component"
jcr:title="Adaptive Form Links (v1)"
jcr:title="Adaptive Form Toggleable Link (v1)"
sling:resourceSuperType="core/fd/components/form/checkboxgroup/v1/checkboxgroup"
componentGroup=".core-adaptiveform"/>
componentGroup=".hidden"/>
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:granite="http://www.adobe.com/jcr/granite/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="nt:unstructured"
jcr:title="Adaptive Form Link field"
jcr:title="Adaptive Form Toggleable Link field"
sling:resourceType="cq/gui/components/authoring/dialog"
extraClientlibs="[core.forms.components.checkboxgroup.v1.editor]">
<content
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?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="Adaptive Form Links (v1)"
jcr:title="Adaptive Form Toggleable Link (v1)"
fieldType="checkbox-group"
type="string[]"
enum="[link]"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!--/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Copyright 2023 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.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
<template data-sly-template.widget="${ @ checkboxgroup }">
<div class="cmp-adaptiveform-checkboxgroup__widget ${checkboxgroup.orientation}" id="${widgetId}">
<div data-sly-list="${checkboxgroup.enums}" data-sly-unwrap>
<div class="cmp-adaptiveform-checkboxgroup-item ${checkboxgroup.name}">
<label class="cmp-adaptiveform-checkboxgroup__option-label"
title="${checkboxgroup.tooltipVisible ? '' : checkboxgroup.tooltipText}">
<input class="cmp-adaptiveform-checkboxgroup__option__widget" type="checkbox"
style="display: none;"
name="${checkboxgroup.name}"
value="${checkboxgroup.enums[itemList.index].toString}"
checked="${checkboxgroup.enums[itemList.index] in checkboxgroup.default }"
disabled="${!checkboxgroup.enabled || checkboxgroup.readOnly}"
aria-readonly="${checkboxgroup.readOnly ? 'true' : ''}"/>
<a class="cmp-adaptiveform-checkboxgroup__links" title="${checkboxgroup.enumNames[itemList.index]}" href="${checkboxgroup.enums[itemList.index].toString@context='uri'}" target="_blank">${checkboxgroup.enumNames[itemList.index]}</a>
</label>
</div>
</div>
</div>
</template>
40 changes: 20 additions & 20 deletions ui.tests/test-module/specs/termsandconditions/tnc.authoring.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,26 +69,26 @@ describe('Page - Authoring', function () {

// ***** //

// context('Open Forms Editor', function() {
// const pagePath = "/content/forms/af/core-components-it/blank",
// tncEditPath = pagePath + afConstants.FORM_EDITOR_FORM_CONTAINER_SUFFIX + "/termsandconditions",
// tncEditPathSelector = "[data-path='" + tncEditPath + "']",
// tncDrop = pagePath + afConstants.FORM_EDITOR_FORM_CONTAINER_SUFFIX + "/" + afConstants.components.forms.resourceType.termsandconditions.split("/").pop();
//
// beforeEach(function () {
// // this is done since cypress session results in 403 sometimes
// cy.openAuthoring(pagePath);
// });
//
// it('insert TnC in form container', function () {
// dropTncInContainer();
// cy.deleteComponentByPath(tncDrop);
// });
//
// it('Test TnC authoring behaviour', function() {
// testTncBehaviour(tncEditPathSelector, tncDrop, false);
// });
// })
context('Open Forms Editor', function() {
const pagePath = "/content/forms/af/core-components-it/blank",
tncEditPath = pagePath + afConstants.FORM_EDITOR_FORM_CONTAINER_SUFFIX + "/termsandconditions",
tncEditPathSelector = "[data-path='" + tncEditPath + "']",
tncDrop = pagePath + afConstants.FORM_EDITOR_FORM_CONTAINER_SUFFIX + "/" + afConstants.components.forms.resourceType.termsandconditions.split("/").pop();

beforeEach(function () {
// this is done since cypress session results in 403 sometimes
cy.openAuthoring(pagePath);
});

it('insert TnC in form container', function () {
dropTncInContainer();
cy.deleteComponentByPath(tncDrop);
});

it('Test TnC authoring behaviour', function() {
testTncBehaviour(tncEditPathSelector, tncDrop, false);
});
})

context('Open Sites Editor', function() {
const pagePath = "/content/core-components-examples/library/adaptive-form/termsandconditions",
Expand Down
Loading

0 comments on commit 3ca93e5

Please sign in to comment.