sightly

AEM Tag picker widget on a page

心已入冬 提交于 2019-12-13 03:47:27
问题 I am working on a functionality where the user selects a Tag from a namespace and clicks a button. Currently, we have a text box where user needs to enter the tag ID. But its not convenient for them to know the tagID. Is there any way to create a Tags Widget (or a Path Browser ) on a component HTML, similar to how it works in the dialog ? I know Coral UI dependencies may be an issue, but just curious if we can achieve that. I've never done something like this. 回答1: I hadwritten a similar

AEM Sightly - Is it possible to create custom data-sly attributes?

北城余情 提交于 2019-12-12 13:23:53
问题 I was wondering if there is a way to create custom attributes, e.g.: <div data-sly-myAttribute="${whatever}"></div> Just like custom JSP tags. EDIT : As of May 4, 2014, it was not possible, according to this blog. Is there any news on this? 回答1: No, it's not possible to create your own block elements since that implementation will not conform to the specification [0]. There are more subtleties involved than just adding a new plugin, one of them being block elements priority when multiple

How to create instance of WCMUsePojo in my Prosper spec?

孤人 提交于 2019-12-12 01:57:37
问题 I have a functioning WCMUsePojo Groovy class which is called from a sightly html component. I am trying to create an instance of my WCMUsePojo class for testing based on the content from the Prosper setup method. It's basically the same type of question as How can I create an instance of WCMUsePojo in a servlet for a specific page? But I don't see it answered and this is specifically about how to unit test methods in WCMUsePojo classes within the Prosper framework. Is there a Java or Groovy

navigation component using sightly

允我心安 提交于 2019-12-11 06:16:54
问题 I am trying to make use of Navigation api for making a global header component @http://docs.adobe.com/docs/en/cq/5-6-1/javadoc/com/day/cq/wcm/foundation/Navigation.html I have a sightly html that is able to get me the reference to the "item" <div data-sly-unwrap data-sly-use.navitems="${'Helper'}"></div> <ul data-sly-list="${navitems.navigationIterator}"> <li> ${itemList.count} :: ${item.page.properties.jcr:primaryType} :: ${item.title} ${item.navigation.element.properties.Type} </li> Helper

AEM 6.3 - Multifield using Sling Model

三世轮回 提交于 2019-12-11 06:09:57
问题 I am trying to create a Coral UI 3 multifield and use Sling Models. Here is how the dialog looks like: Here is the code : package com.aem.sites.models; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import javax.annotation.PostConstruct; import javax.inject.Inject; import javax.inject.Named; import org.apache.sling.api.resource.Resource; import org.apache.sling.models.annotations.Model; import org.apache.log4j.Logger; import com.aem.sites.models.Header; @Model

Access to a property in a specific resource via sightly

谁都会走 提交于 2019-12-11 04:07:27
问题 I want to access to a specific property in resource. The main resource hat two children and the app is in the first one. I want to get a property from the second child. Can i find something like : ${resource.parent.child[1].valueMap.title} Thanks! 回答1: To start - note that the order of the children may not be guaranteed , unless you're using sling:OrderedFolder or some other ordered type. So trying to get the "second" child may not even make sense. Having said that, there may some valid use

AEM 6.0 Sightly Child Nodes

China☆狼群 提交于 2019-12-09 06:57:15
问题 I have a question around using Sightly to access child nodes of a component. I have a template which pulls in a basic image component using data-sly-resource, like so. <div class="${wcmmode.edit ? 'image-edit image' : 'image'}" data-sly-resource="${ 'heroImage' @ resourceType='/libs/foundation/components/image', appendPath='image', selectors='fileReference' }"> </div> What I would like to do is change the css class based on whether or not that image component actually has an image set. For

How do I access the properties of a data-sly-list item in Sightly?

牧云@^-^@ 提交于 2019-12-08 09:19:24
I am using Sightly with Sling 8 ( not AEM ). I have the following template: <div data-sly-list.child="${resource.listChildren}"> ${child.name} | ${child.path} | ${child.properties['jcr:title'] || 'no title'} </div> The output ( for a single child ) is hello_world | /content/blog/posts/hello_world | no title I know there is a jcr:title property on the child resource as I have confirmed it using an HTTP call. How can I access the properties on the child object? Alexander Klimetschek The child is a Resource which does not have getProperties() but has getValueMap() , so you should use: ${child

How to check if child component resource exist or not using Sightly in AEM?

久未见 提交于 2019-12-08 05:42:21
问题 my component has an embedded image component inside of it, i need to show image only if image component is authored, Component Code: <div class="rightSideTile tile-img col-xs-5 col-md-4"> <sly data-sly-resource="${'image' @ resourceType='test/components/content/image'}"></sly> </div> So i need to check resource of embedded image component authored or not i know we can do this in Java, but how to do this in Sightly? 回答1: This can be doable ,using ${resource['image/jcr:primaryType']} , here

How do I access the properties of a data-sly-list item in Sightly?

流过昼夜 提交于 2019-12-08 04:26:23
问题 I am using Sightly with Sling 8 ( not AEM ). I have the following template: <div data-sly-list.child="${resource.listChildren}"> ${child.name} | ${child.path} | ${child.properties['jcr:title'] || 'no title'} </div> The output ( for a single child ) is hello_world | /content/blog/posts/hello_world | no title I know there is a jcr:title property on the child resource as I have confirmed it using an HTTP call. How can I access the properties on the child object? 回答1: The child is a Resource