Expand my Community achievements bar.

SOLVED

Reference Component In Sightly

Avatar

Level 2

We have to implement the functionality similar to Reference Component but using sightly but with little customization. Default Foundation Component is using sling:include but I have tried using <div data-sly-resource="${item.path @ appendPath='/jcr:content/par/'}" data-sly-unwrap/> and this is returning the data but it is returning the parsys as well. I don't want to include parsys. Is there anything which I can use to achieve this.

If you could check the default reference component,it will return only what is present in the parsys

 

Thanks in advance

Mahesh Karle

1 Accepted Solution

Avatar

Correct answer by
Level 8

I just put this together and tested it out on Geometrixx Outdoors and it worked perfectly fine.

reference.html

<h3 data-sly-test="${wcmmode.edit || wcmmode.design}">Edit Using Dialog</h3> <sly data-sly-test="${properties.path}" data-sly-resource="${properties.path}"></sly>

dialog.xml

<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:primaryType="cq:Dialog" height="400" stateful="false" xtype="dialog"> <items jcr:primaryType="cq:WidgetCollection"> <tabs jcr:primaryType="cq:TabPanel"> <items jcr:primaryType="cq:WidgetCollection"> <reference jcr:primaryType="cq:Panel" title="Reference"> <items jcr:primaryType="cq:WidgetCollection"> <path jcr:primaryType="cq:Widget" fieldLabel="Reference" name="./path" xtype="paragraphreference" /> </items> </reference> </items> </tabs> </items> </jcr:root>

Component Definition

<?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" jcr:primaryType="cq:Component" jcr:title="Reference - Sightly" sling:resourceSuperType="foundation/components/parbase" componentGroup="General" />

View solution in original post

3 Replies

Avatar

Correct answer by
Level 8

I just put this together and tested it out on Geometrixx Outdoors and it worked perfectly fine.

reference.html

<h3 data-sly-test="${wcmmode.edit || wcmmode.design}">Edit Using Dialog</h3> <sly data-sly-test="${properties.path}" data-sly-resource="${properties.path}"></sly>

dialog.xml

<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:primaryType="cq:Dialog" height="400" stateful="false" xtype="dialog"> <items jcr:primaryType="cq:WidgetCollection"> <tabs jcr:primaryType="cq:TabPanel"> <items jcr:primaryType="cq:WidgetCollection"> <reference jcr:primaryType="cq:Panel" title="Reference"> <items jcr:primaryType="cq:WidgetCollection"> <path jcr:primaryType="cq:Widget" fieldLabel="Reference" name="./path" xtype="paragraphreference" /> </items> </reference> </items> </tabs> </items> </jcr:root>

Component Definition

<?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" jcr:primaryType="cq:Component" jcr:title="Reference - Sightly" sling:resourceSuperType="foundation/components/parbase" componentGroup="General" />

Avatar

Level 2

Thanks for quick reply ..Actually I had to copy the same dialog as well. It works now Thanks again