sightly

How can list elements be looped under <script> in sightly?

二次信任 提交于 2019-12-07 13:15:36
问题 In my html page I would like to loop through the properties returned by my Java class but do it under <script> tag. Currently my html page has this: <div id="map_wrapper"> <div data-sly-use.ev="Foo" class="mapping" id="${ev.googleClass || ''" > </div> </div> <script> .... var markers = [ ['Bondi Beach', -33.890542, 151.274856], ['Coogee Beach', -33.923036, 151.259052], ['Cronulla Beach', -34.028249, 151.157507], ['Manly Beach', -33.80010128657071, 151.28747820854187], ['Maroubra Beach', -33

AEM6 Sightly: How to pass a parameter from HTML to a method from Java-model class?

喜欢而已 提交于 2019-12-07 12:10:40
问题 I wanted to pass a parameter from html to WCMUse class. Java: public class ComponentHelper extends WCMUse { public void activate() throws Exception {} ... public String methodA(String parameter1) { ... } public String getParam() { String param = ""; ... return param; } } HTML: <componentHelper data-sly-use.componentHelper="ComponentHelper" data-sly-unwrap /> ... <div> ${componentHelper.methodA @ parameter1=componentHelper.param} <!--/* Also tried: ${componentHelper.methodA @ componentHelper

AEM Sightly to get properties of child nodes.

一笑奈何 提交于 2019-12-06 14:59:44
So it looks like sightly is great for getting properties, but I would like to work get properties of other child nodes that I have defined. Here is the start of my PictureFill Component structure: { jcr:primaryType: "nt:unstructured", jcr:createdBy: "admin", fileReference: "/content/dam/myapp/dev/hero-billboard.jpg", jcr:lastModifiedBy: "admin", jcr:created: "Wed Oct 07 2015 03:38:00 GMT+0000", jcr:lastModified: "Wed Oct 07 2015 16:54:12 GMT+0000", sling:resourceType: "myapp/components/content/image", cq:responsive: { jcr:primaryType: "nt:unstructured" }, mobile: { jcr:primaryType: "nt

AEM sightly how to reuse variables

╄→гoц情女王★ 提交于 2019-12-06 09:06:09
can I use variables in another file that I'm including? in my HTL (file1.html) I have: <sly data-sly-test.myVar="${properties.myVarFromDialog}"></sly> <sly data-sly-include="/file2.html"></sly> Can I use myVar in file2.html ? I'm not getting any value. Is there a way of getting that value from file1.html to use in file2.html You should use data-sly-template for this. You can define templates in a separate file and can pass in parameters. For an explanation on templates check the following documentation link http://docs.adobe.com/docs/en/aem/6-0/develop/sightly.html#template Firstly, for the

How can list elements be looped under <script> in sightly?

匆匆过客 提交于 2019-12-06 03:45:17
In my html page I would like to loop through the properties returned by my Java class but do it under <script> tag. Currently my html page has this: <div id="map_wrapper"> <div data-sly-use.ev="Foo" class="mapping" id="${ev.googleClass || ''" > </div> </div> <script> .... var markers = [ ['Bondi Beach', -33.890542, 151.274856], ['Coogee Beach', -33.923036, 151.259052], ['Cronulla Beach', -34.028249, 151.157507], ['Manly Beach', -33.80010128657071, 151.28747820854187], ['Maroubra Beach', -33.950198, 151.259302] ]; ..... </script> My Java Class has following getters: //returns [0] = "something,

AEM 6.1 Sightly basic form submit and redirect to same page

喜欢而已 提交于 2019-12-06 02:30:13
问题 I am trying to do the following on AEM 6.1: Develop a simple form (3 input fields) Process the submitted values, And redirect to the same page with processed values/result I am able to submit the values to a servlet, and process them (business logic), and the result to a requestparamter so i can retrieve them on the UI. But i am stuck at these: Redirecting to the same page And retrieving the request parameters and display them using Sightly. Code Snippets: Servlet @SlingServlet( methods = {

Iteration (for loop) in sightly

删除回忆录丶 提交于 2019-12-05 08:56:25
I had used <c:forEach> in jstl. Now i want to use sightly. My usecase is to print numbers from 1 to 10 then how can i iterate in sightly as for loop in java Sightly doesn't let you put any logic in it by design. What you should do is, you should customize your underlying model so that you can retrieve a prepared list of irrelevant (from Sightly's perspective) length that contains data that needs to be displayed. After that, just use data-sly-list . You'll need to google for more details, but in general, this is how you use lists in Sightly: <ul data-sly-list.myitem="${mymodel.myitems}" data

How to create a radio button in aem 6 touch dialog

夙愿已清 提交于 2019-12-04 14:07:43
I am having a touch UI component for which I am creating a dialog in AEM 6. I have a requirement to create 2 radio buttons in the touch dialog and if either one of them are selected, the corresponding value of the selected radio button should be displayed. however, I am not understanding how to create the radio button options. I have implemented the same in classic dialog where the xtype=selection and type=radiogroup is used, but I do not understand how to create it in touch dialog You can use Form Input - Radio . To create a radio button group give all radio buttons the same name . The

Expression Option Sightly

ε祈祈猫儿з 提交于 2019-12-02 23:04:35
I was looking over the expression options used in sightly. I tried the below line of code, but it seems just render the text over the page, can someone provide use of options with some good examples. ${'Assets' @ i18n, locale='fr-CH', hint='Translation Hint'} ${'Page {0} of {1}' @ format = [count,total] } I have tried and understand the below code to include the parsys <div data-sly-resource ="${@path='question_list', resourceType='wcm/foundation/components/parsys'}"></div> Also from where i can get the whole list of data-sly-[elements]. Thanks Options in Sightly expressions can have two

Rendering telephone links in HTL based on input from a Rich Text widget

故事扮演 提交于 2019-12-01 05:26:00
I have a component using the Rich Text Edit widget ( xtype="richtext" ) in my project that's used across the entire site as the default text component. The users would like to be able to insert phone links using the tel URI scheme into the text entered using this component. The dialog allows them to do so but when the contents of the Rich Text Edit are rendered in Sightly/HTL later on, the html context is used: {$text @ context='html'} Once this is done, the value of my attribute is ignored. The HTML stored in the repository is: <a href="tel:04242424242">Call us!</a> And what's actually