Skip to content

Commit

Permalink
@releng - sanitize teaser component for release (#242)
Browse files Browse the repository at this point in the history
- improves Teaser documentation
- fixes JSDocs for checkboxTextfieldTuple
- clientlib consistent with other components
  • Loading branch information
richardhand committed Jul 9, 2018
1 parent fea180f commit 8c8b677
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 39 deletions.
Expand Up @@ -117,7 +117,7 @@ public interface Teaser extends ComponentExporter {
String PN_TITLE_TYPE = "titleType";

/**
* Checks if teaser has Call-to-Action elements
* Checks if the teaser has Call-to-Action elements
*
* @return {@code true} if teaser has CTAs, {@code false} otherwise
* @since com.adobe.cq.wcm.core.components.models 12.4.0
Expand Down Expand Up @@ -157,7 +157,7 @@ default Resource getImageResource() {
}

/**
* Checks if link is hidden on the image.
* Checks if the link on the image is hidden.
*
* @return {@code true} if link is hidden on the image, {@code false} otherwise
* @since com.adobe.cq.wcm.core.components.models 12.4.0
Expand All @@ -177,7 +177,7 @@ default String getTitle() {
}

/**
* Checks if link is hidden on the title.
* Checks if the link on the title is hidden.
*
* @return {@code true} if link is hidden on the title, {@code false} otherwise
* @since com.adobe.cq.wcm.core.components.models 12.4.0
Expand All @@ -197,7 +197,7 @@ default String getDescription() {
}

/**
* Returns the HTML element type (h1-h6) used for the markup.
* Returns the HTML element type (h1-h6) used for the title.
*
* @return the element type
* @since com.adobe.cq.wcm.core.components.models 12.4.0
Expand Down
Expand Up @@ -27,6 +27,7 @@
* @param {HTMLElement} dialog The dialog where the two elements are found.
* @param {String} checkboxSelector The selector for the checkbox.
* @param {String} textfieldSelector The selector for the text field.
* @param {Boolean} isRichText Defines whether the text field is a rich text editor.
* @constructor
*/
var CheckboxTextfieldTuple = window.CQ.CoreComponents.CheckboxTextfieldTuple.v1 = function(dialog, checkboxSelector, textfieldSelector, isRichText) {
Expand Down Expand Up @@ -202,6 +203,7 @@
/**
* Gets the value of the text field, accounting for it being a rich-text
*
* @returns {String} The text field value
* @private
*/
CheckboxTextfieldTuple.prototype._getTextfieldValue = function() {
Expand All @@ -215,7 +217,7 @@
/**
* Sets the value of the text field, accounting for it being a rich-text
*
* @param value - The value to set
* @param {String} value The value to set
* @private
*/
CheckboxTextfieldTuple.prototype._setTextfieldValue = function(value) {
Expand All @@ -229,7 +231,7 @@
/**
* Disables the text field, accounting for it being a rich-text
*
* @param disabled - {@code true} to disable, {@code false} to enable the field
* @param {Boolean} disabled {@code true} to disable, {@code false} to enable the field
* @private
*/
CheckboxTextfieldTuple.prototype._disableTextfield = function(disabled) {
Expand Down
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-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="image"
jcr:description="Displays an image together with a link that can act as a teaser for a site section."
cq:icon="imageText"
jcr:description="Teaser block allowing a combination of an image, title, rich text description and actions/links"
jcr:primaryType="cq:Component"
jcr:title="Teaser (v1)"
sling:resourceSuperType="core/wcm/components/image"
Expand Down
@@ -1,5 +1,5 @@
<!--
Copyright 2017 Adobe Systems Incorporated
Copyright 2018 Adobe Systems Incorporated
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -15,33 +15,33 @@ limitations under the License.
-->
Teaser (v1)
====
Teaser component written in HTL, showing an image, a title, a rich-text and possibly some actions/links. Variations can include
only parts of the teaser.
Teaser component written in HTL, allowing definition of an image, title, rich text description and actions/links.
Teaser variations can include some or all of these elements.

## Features

* Combines image, title, text and links/actions.
* Allows disabling sections through policy configuration.
* Can control if title and text should be inherited from a linked page.
* Combines image, title, rich text description and actions/links.
* Allows disabling of teaser elements through policy configuration.
* Allows control over whether title and description should be inherited from a linked page.

### Use Object
The Teaser component uses the `com.adobe.cq.wcm.core.components.models.Teaser` Sling model as its Use-object.

### Component Policy Configuration Properties
The teaser component has the following configuration properties:
1. `actionsDisabled` - defines whether or not Call-to-Actions are disabled
2. `titleHidden` - defines whether or not the title is hidden
3. `descriptionHidden` - defines whether or not the description is hidden
4. `imageLinkHidden` - defines whether or not the image link is hidden
5. `titleLinkHidden` - defines whether or not the title link is hidden
6. `titleType` - stores the value for this title's HTML element type
The following configuration properties are used:

1. `./actionsDisabled` - defines whether or not Call-to-Actions are disabled
2. `./titleHidden` - defines whether or not the title is hidden
3. `./descriptionHidden` - defines whether or not the description is hidden
4. `./imageLinkHidden` - defines whether or not the image link is hidden
5. `./titleLinkHidden` - defines whether or not the title link is hidden
6. `./titleType` - stores the value for this title's HTML element type

The following configuration properties are inherited from the image component:

1. `./allowedWidths` - defines the allowed renditions (as an integer array) that will be generated for the images rendered by this
component; the actual size will be requested by the client device;
2. `./disableLazyLoading` - allows to disable lazy loading for images (loading the image only when the image is visible on the client
device)
1. `./allowedRenditionWidths` - defines the allowed renditions (as an integer array) that will be generated for the images rendered by this
component; the actual size will be requested by the client device
2. `./disableLazyLoading` - if `true`, the lazy loading of images (loading only when the image is visible on the client
device) is disabled

### Edit Dialog Properties
The following properties are written to JCR for this Teaser component and are expected to be available as `Resource` properties:
Expand All @@ -51,14 +51,14 @@ The following properties are written to JCR for this Teaser component and are ex
1. `link` - property that stores the Call-to-Action link
2. `text` - property that stores the Call-to-Action text
3. `./fileReference` - property or `file` child node - will store either a reference to the image file, or the image file
4. `./linkURL` - required URL to which the teaser will link to
4. `./linkURL` - link applied to teaser elements. URL or path to a content page
5. `./jcr:title` - defines the value of the teaser title and HTML `title` attribute of the teaser image
6. `./titleFromPage` - defines whether or not the title value is taken from the linked page
7. `./jcr:description` - defines the value of the teaser description
7. `./jcr:description` - defines the value of the teaser description
8. `./descriptionFromPage` - defines whether or not the description value is taken from the linked page

### Extending the Teaser Component
When extending the Teaser component by using `sling:resourceSuperType`, developers need to define the `imageDelegate` property for
When extending the Teaser component by using `sling:resourceSuperType`, developers need to define the `imageDelegate` property for
the proxy component and point it to the designated Image component.

For example:
Expand All @@ -83,4 +83,3 @@ BLOCK cmp-teaser
* **Compatibility**: AEM 6.3
* **Status**: preview
* **Documentation**: [https://www.adobe.com/go/aem\_cmp\_teaser\_v1](https://www.adobe.com/go/aem_cmp_teaser_v1)

Expand Up @@ -13,7 +13,6 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->

<sly data-sly-template.action="${@ action}">
<a class="cmp-teaser__action-link" href="${action.URL}">${action.title}</a>
</sly>
Expand Up @@ -13,7 +13,6 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->

<sly data-sly-template.actions="${@ teaser}">
<div class="cmp-teaser__action-container" data-sly-test="${teaser.actionsEnabled}" data-sly-list="${teaser.actions}" data-sly-use.actionTemplate="action.html">
<sly data-sly-call="${actionTemplate.action @ action=item}"></sly>
Expand Down
Expand Up @@ -14,4 +14,6 @@
# limitations under the License.
###############################################################################

js/teaser.js
#base=js

teaser.js
@@ -1,5 +1,5 @@
###############################################################################
# Copyright 2016 Adobe Systems Incorporated
# Copyright 2018 Adobe Systems Incorporated
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -14,4 +14,6 @@
# limitations under the License.
###############################################################################

less/teaser.less
#base=css

teaser.less
Expand Up @@ -14,4 +14,6 @@
# limitations under the License.
###############################################################################

js/teaser.js
#base=js

teaser.js
Expand Up @@ -13,7 +13,6 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->

<sly data-sly-template.description="${@ teaser}">
<div class="cmp-teaser__description" data-sly-test.description="${teaser.description}">${description @ context="html"}</div>
</sly>
Expand Up @@ -13,7 +13,6 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->

<sly data-sly-template.image="${@ teaser}">
<div class="cmp-teaser__image" data-sly-test="${teaser.imageResource}" data-sly-resource="${teaser.imageResource}"></div>
</sly>
Expand Up @@ -13,7 +13,6 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->

<sly data-sly-template.title="${@ teaser}">
<h2 class="cmp-teaser__title" data-sly-test.title="${teaser.title}" data-sly-element="${teaser.titleType}">
<a class="cmp-teaser__title-link" href="${teaser.linkURL}" data-sly-unwrap="${!teaser.linkURL || teaser.titleLinkHidden}">${title}</a>
Expand Down

0 comments on commit 8c8b677

Please sign in to comment.