From f84c7b2149abb61c5ea8099d2481877139514119 Mon Sep 17 00:00:00 2001 From: wildone Date: Mon, 21 Jun 2021 12:46:12 +1000 Subject: [PATCH 01/24] add contact links. --- .../main/java/design/aem/models/v2/details/ContactDetails.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aemdesign-aem-services/src/main/java/design/aem/models/v2/details/ContactDetails.java b/aemdesign-aem-services/src/main/java/design/aem/models/v2/details/ContactDetails.java index c786b86ea..3daa3c869 100644 --- a/aemdesign-aem-services/src/main/java/design/aem/models/v2/details/ContactDetails.java +++ b/aemdesign-aem-services/src/main/java/design/aem/models/v2/details/ContactDetails.java @@ -70,6 +70,8 @@ protected void setFields() { {"email", StringUtils.EMPTY}, {"contactNumber", StringUtils.EMPTY}, {"contactNumberMobile", StringUtils.EMPTY}, + {"linksType", new String[]{}}, + {"linksContent", new String[]{}}, {DETAILS_DATA_SCHEMA_ITEMSCOPE, DETAILS_DATA_SCHEMA_ITEMSCOPE, DETAILS_DATA_SCHEMA_ITEMSCOPE}, {DETAILS_DATA_SCHEMA_ITEMTYPE, "http://schema.org/Person", DETAILS_DATA_SCHEMA_ITEMTYPE}, }); From c1ebb772aa63b122d0fffeded359c3aabced67e4 Mon Sep 17 00:00:00 2001 From: wildone Date: Mon, 21 Jun 2021 12:46:53 +1000 Subject: [PATCH 02/24] add search criteria for all tags in known components. --- .../main/java/design/aem/models/v2/lists/List.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/aemdesign-aem-services/src/main/java/design/aem/models/v2/lists/List.java b/aemdesign-aem-services/src/main/java/design/aem/models/v2/lists/List.java index a9ab0d035..9192ddae8 100644 --- a/aemdesign-aem-services/src/main/java/design/aem/models/v2/lists/List.java +++ b/aemdesign-aem-services/src/main/java/design/aem/models/v2/lists/List.java @@ -773,11 +773,15 @@ protected void populateTagListItems() { childMap.put(groupPrefix + offset + tagIdSuffix, tag); childMap.put(groupPrefix + offset + tagIdSuffix + ".property", JcrConstants.JCR_CONTENT.concat("/cq:tags")); - // Offset the Page Details group by one so we don't conflict with the page properties query - offset++; + //add search criteria for all tags in known components. + for (String path : DEFAULT_LIST_PAGE_CONTENT) { + // Offset the any details group by one so we don't conflict with the page properties query + offset++; - childMap.put(groupPrefix + offset + tagIdSuffix, tag); - childMap.put(groupPrefix + offset + tagIdSuffix + "property", JcrConstants.JCR_CONTENT.concat("/article/par/page_details/cq:tags")); + childMap.put(groupPrefix + offset + tagIdSuffix, tag); + childMap.put(groupPrefix + offset + tagIdSuffix + ".property", JcrConstants.JCR_CONTENT.concat(path).concat("/*/cq:tags")); + + } } populateListItemsFromMap(childMap); From 7cbcde42d4b0fc5af610d8f83051236c953d926b Mon Sep 17 00:00:00 2001 From: wildone Date: Mon, 21 Jun 2021 13:10:17 +1000 Subject: [PATCH 03/24] add links to dialog. --- .../clientlibs/js/behaviour.js | 49 ++++++++++++++++- .../contact-details/_cq_dialog/.content.xml | 52 +++++++++++++++++++ 2 files changed, 100 insertions(+), 1 deletion(-) diff --git a/aemdesign-aem-common/src/main/content/jcr_root/apps/aemdesign/components/details/contact-details/clientlibs/js/behaviour.js b/aemdesign-aem-common/src/main/content/jcr_root/apps/aemdesign/components/details/contact-details/clientlibs/js/behaviour.js index 6f7bff4a2..51df3cf69 100755 --- a/aemdesign-aem-common/src/main/content/jcr_root/apps/aemdesign/components/details/contact-details/clientlibs/js/behaviour.js +++ b/aemdesign-aem-common/src/main/content/jcr_root/apps/aemdesign/components/details/contact-details/clientlibs/js/behaviour.js @@ -16,13 +16,15 @@ window.AEMDESIGN.components.authoring.contactdetails = AEMDESIGN.components.auth console.log(["dialog-"+componentName+"-behaviour","loading"]); - //load content into field + //load content into pagedetails-pagemetadata field if ($("#dialog-"+componentName+"").find(".pagedetails-pagemetadata")[0]) { + console.log(["dialog-"+componentName+"-behaviour","loading", "pagedetails-pagemetadata"]); var $form = $("#dialog-"+componentName+"").closest('form'); console.log(['$form', $form]); var formUrl = $form[0].action; $.getJSON(formUrl + '.json').done(function (data) { + console.log(["pagedetails-pagemetadata",data]); console.log(data); var fieldconfigKey = data.pageMetaProperty, @@ -61,6 +63,51 @@ window.AEMDESIGN.components.authoring.contactdetails = AEMDESIGN.components.auth console.log(["dialog-"+componentName+"-behaviour","pagedetails-pagemetadata","not found"]); } + //load content into pagedetails-sociallink field + if ($("#dialog-"+componentName+"").find(".pagedetails-sociallink")[0]) { + console.log(["dialog-"+componentName+"-behaviour","loading", "pagedetails-sociallink"]); + var $form = $("#dialog-"+componentName+"").closest('form'); + console.log(['$form', $form, $form[0].action]); + var formUrl = $form[0].action; + $.getJSON(formUrl + '.json').done(function (data) { + console.log(["pagedetails-sociallink",formUrl,data]); + var + fieldconfigKey = data.linksType, + fieldconfigValue = data.linksContent; + + + if (fieldconfigKey) { + //turn plain string into array + if (typeof fieldconfigKey === 'string') { + fieldconfigKey = [fieldconfigKey]; + } + //turn plain string into array + if (fieldconfigValue && (typeof fieldconfigValue === 'string')) { + fieldconfigValue = [fieldconfigValue]; + } + + + fieldconfigKey.forEach(function (key, index) { + console.log(['field', fieldconfigKey[index], fieldconfigValue[index]]); + var curr = $("#dialog-"+componentName+"").find(".pagedetails-sociallink")[0].items.add(); + Coral.commons.ready(curr, function (readyCurr) { + $(readyCurr).find('[name="./linksType"]')[0].value = fieldconfigKey[index]; + $(readyCurr).find('[name="./linksContent"]')[0].value = fieldconfigValue[index]; + + }); + }); + } + else { + //add empty row if needed + //$(".pagedetails-pagemetadata")[0].items.add(); + } + + + }); + + } else { + console.log(["dialog-"+componentName+"-behaviour","pagedetails-pagemetadata","not found"]); + } } }); diff --git a/aemdesign-aem-common/src/main/content/jcr_root/apps/aemdesign/components/details/contact-details/v3/contact-details/_cq_dialog/.content.xml b/aemdesign-aem-common/src/main/content/jcr_root/apps/aemdesign/components/details/contact-details/v3/contact-details/_cq_dialog/.content.xml index 5baeef5ce..a28843ea3 100644 --- a/aemdesign-aem-common/src/main/content/jcr_root/apps/aemdesign/components/details/contact-details/v3/contact-details/_cq_dialog/.content.xml +++ b/aemdesign-aem-common/src/main/content/jcr_root/apps/aemdesign/components/details/contact-details/v3/contact-details/_cq_dialog/.content.xml @@ -146,6 +146,58 @@ resourceType="granite/ui/components/foundation/form/hidden" sling:resourceType="granite/ui/components/coral/foundation/include"/> + + + + + + + + + + + + + + + + + + + From 64b439976d4ce723bbb39db712a7b3c3b91e3eb5 Mon Sep 17 00:00:00 2001 From: wildone Date: Mon, 21 Jun 2021 13:32:36 +1000 Subject: [PATCH 04/24] add field for links content output. --- .../v1/generic-details/field/links.html | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 aemdesign-aem-common/src/main/content/jcr_root/apps/aemdesign/components/details/generic-details/v1/generic-details/field/links.html diff --git a/aemdesign-aem-common/src/main/content/jcr_root/apps/aemdesign/components/details/generic-details/v1/generic-details/field/links.html b/aemdesign-aem-common/src/main/content/jcr_root/apps/aemdesign/components/details/generic-details/v1/generic-details/field/links.html new file mode 100644 index 000000000..1b9ae8062 --- /dev/null +++ b/aemdesign-aem-common/src/main/content/jcr_root/apps/aemdesign/components/details/generic-details/v1/generic-details/field/links.html @@ -0,0 +1,13 @@ + From bf5cefa2e9c012f3a4976a9b4d16e98a8afaf268 Mon Sep 17 00:00:00 2001 From: wildone Date: Mon, 21 Jun 2021 13:37:17 +1000 Subject: [PATCH 05/24] convert links tags to tag map. --- .../java/design/aem/models/v2/details/ContactDetails.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/aemdesign-aem-services/src/main/java/design/aem/models/v2/details/ContactDetails.java b/aemdesign-aem-services/src/main/java/design/aem/models/v2/details/ContactDetails.java index 3daa3c869..2ae21ceda 100644 --- a/aemdesign-aem-services/src/main/java/design/aem/models/v2/details/ContactDetails.java +++ b/aemdesign-aem-services/src/main/java/design/aem/models/v2/details/ContactDetails.java @@ -13,7 +13,7 @@ import static design.aem.utils.components.CommonUtil.getPageCreated; import static design.aem.utils.components.ComponentsUtil.*; import static design.aem.utils.components.ConstantsUtil.*; -import static design.aem.utils.components.TagUtil.getTagValueAsAdmin; +import static design.aem.utils.components.TagUtil.*; import static org.apache.commons.lang3.StringUtils.isNotEmpty; public class ContactDetails extends GenericDetails { @@ -106,6 +106,10 @@ protected Map processComponentFields() { slingScriptHelper ).trim()); + //convert links tags to tag content map + String[] tags = componentProperties.get("linksType", new String[]{}); + componentProperties.put("linksType", getTagsAsAdmin(getSlingScriptHelper(), tags, getRequest().getLocale())); + } catch (Exception ex) { LOGGER.error("Could not process component fields in {}", COMPONENT_DETAILS_NAME); } From c2bb0b2c7af75932aa96c9a6729e8c7840e312bc Mon Sep 17 00:00:00 2001 From: wildone Date: Mon, 21 Jun 2021 14:01:04 +1000 Subject: [PATCH 06/24] add dialog type hints. --- .../v3/contact-details/_cq_dialog/.content.xml | 13 ++++++++++++- .../global/dialog/touch/pageMetadata/.content.xml | 10 ++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/aemdesign-aem-common/src/main/content/jcr_root/apps/aemdesign/components/details/contact-details/v3/contact-details/_cq_dialog/.content.xml b/aemdesign-aem-common/src/main/content/jcr_root/apps/aemdesign/components/details/contact-details/v3/contact-details/_cq_dialog/.content.xml index a28843ea3..8d4df376d 100644 --- a/aemdesign-aem-common/src/main/content/jcr_root/apps/aemdesign/components/details/contact-details/v3/contact-details/_cq_dialog/.content.xml +++ b/aemdesign-aem-common/src/main/content/jcr_root/apps/aemdesign/components/details/contact-details/v3/contact-details/_cq_dialog/.content.xml @@ -167,9 +167,14 @@ + + + diff --git a/aemdesign-aem-common/src/main/content/jcr_root/apps/aemdesign/global/dialog/touch/pageMetadata/.content.xml b/aemdesign-aem-common/src/main/content/jcr_root/apps/aemdesign/global/dialog/touch/pageMetadata/.content.xml index 847dfe7c3..4d497c455 100644 --- a/aemdesign-aem-common/src/main/content/jcr_root/apps/aemdesign/global/dialog/touch/pageMetadata/.content.xml +++ b/aemdesign-aem-common/src/main/content/jcr_root/apps/aemdesign/global/dialog/touch/pageMetadata/.content.xml @@ -68,6 +68,11 @@ variant="valuelist" path="/content/cq:tags/${(empty tenant.id and empty tenantId) ? 'aemdesign' : (empty tenant.id ? tenantId : tenant.id )}/component-dialog/html/metadata/properties"/> + + From 62a046fc7aa51507cf1cf4ca32593d8367808ec4 Mon Sep 17 00:00:00 2001 From: wildone Date: Mon, 21 Jun 2021 16:06:39 +1000 Subject: [PATCH 07/24] update link field output. --- .../v1/generic-details/field/links.html | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/aemdesign-aem-common/src/main/content/jcr_root/apps/aemdesign/components/details/generic-details/v1/generic-details/field/links.html b/aemdesign-aem-common/src/main/content/jcr_root/apps/aemdesign/components/details/generic-details/v1/generic-details/field/links.html index 1b9ae8062..5cfa0e2ac 100644 --- a/aemdesign-aem-common/src/main/content/jcr_root/apps/aemdesign/components/details/generic-details/v1/generic-details/field/links.html +++ b/aemdesign-aem-common/src/main/content/jcr_root/apps/aemdesign/components/details/generic-details/v1/generic-details/field/links.html @@ -1,12 +1,11 @@