I am designing a dialog in which i want the radio buttons displayed horizontally and not vertically, so that appear in a single line. Any ideas how to achieve this.
Below is my dialog.xml.
<items
jcr:primaryType="cq:Widget"
xtype="tabpanel">
<items jcr:primaryType="cq:WidgetCollection">
<tab1
jcr:primaryType="cq:Panel"
title="Slider">
<items jcr:primaryType="cq:WidgetCollection">
<typeconfigs
jcr:primaryType="cq:Widget"
fieldLabel="Select Videos"
name="./options"
xtype="customconfigmultifield">
<fieldConfigs jcr:primaryType="cq:WidgetCollection">
<gridlayout
jcr:primaryType="cq:Widget"
itemId="dispotions"
name="selcttab"
type="radio"
xtype="selection">
<options jcr:primaryType="cq:WidgetCollection">
<grid1
jcr:primaryType="nt:unstructured"
text="grid1"
value="grid1"/>
<grid2
jcr:primaryType="nt:unstructured"
text="grid2"
value="grid2"/>
<grid3
jcr:primaryType="nt:unstructured"
text="grid3"
value="grid3"/>
<grid4
jcr:primaryType="nt:unstructured"
text="grid4"
value="grid4"/>
</options>
</gridlayout>
</fieldConfigs>
<limit
jcr:primaryType="nt:unstructured"
maxVal="{Long}6"/>
</typeconfigs>
</items>
</tab1>
</items>
Thanks
You can try using ExtJS Layouts for the same. There are various ways of configuring the same, one of which could be using an hbox layout as shown below.
Use the layout config available for Selection Widget and set its value to hbox. Then use the optionsConfig to set the width that applies to each radio box. Since the optionsConfig accepts an object, create it is a child node of your selection and then set the required styles.
Sample Dialog Structure shown below.
<gridlayout
jcr:primaryType="cq:Widget"
itemId="dispotions"
name="selcttab"
type="radio"
xtype="selection"
layout="hbox">
<options jcr:primaryType="cq:WidgetCollection">
<grid1
jcr:primaryType="nt:unstructured"
text="grid1"
value="grid1"/>
<grid2
jcr:primaryType="nt:unstructured"
text="grid2"
value="grid2"/>
<grid3
jcr:primaryType="nt:unstructured"
text="grid3"
value="grid3"/>
<grid4
jcr:primaryType="nt:unstructured"
text="grid4"
value="grid4"/>
</options>
<optionsConfig
jcr:primaryType="nt:unstructured"
width="60" />
</gridlayout>
This solution works in general, however, i notice that there is a custom widget customconfigmultifield defined under which you are configuring a selection field. So you might need to tweak your styles accordingly.
Related
I am setting up a dialog that has the following fields -
1. A field to accept image as an input
2. A field to accept a title
3. A field that will accept richtext.
Please note that I do not want to enable inplace editing. I just want to add a richtext field (with all features enabled) in my dialog and use the data entered in this field in my component.
I am able to implement 1. and 2. but dont know how to go about 3.
Here is my code -
<?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" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="nt:unstructured"
jcr:title="Section Container"
sling:resourceType="cq/gui/components/authoring/dialog">
<content
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/layouts/tabs"
type="nav"/>
<items jcr:primaryType="nt:unstructured">
<Styling
jcr:primaryType="nt:unstructured"
jcr:title="Styling"
sling:resourceType="granite/ui/components/foundation/section">
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"/>
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<items jcr:primaryType="nt:unstructured">
<question_single
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/textfield"
fieldDescription="Please enter the Question"
fieldLabel="Question for Single"
name="./question_single"/>
<question_couple
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/textfield"
fieldDescription="Please enter the Question"
fieldLabel="Question for Couple Applicants"
name="./question_couple"/>
<page_header
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/textfield"
fieldDescription="Please enter page header"
fieldLabel="Page Header"
name="./page_header"/>
</items>
</column>
</items>
</Styling>
<image
jcr:primaryType="nt:unstructured"
jcr:title="Image Properties"
sling:resourceType="granite/ui/components/foundation/section">
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"
margin="{Boolean}false"/>
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<items jcr:primaryType="nt:unstructured">
<file
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/fileupload"
autoStart="{Boolean}false"
class="cq-droptarget"
fieldLabel="Image asset"
fileNameParameter="./image/fileName"
fileReferenceParameter="./image/fileReference"
mimeTypes="[image]"
multiple="{Boolean}false"
name="./image/file"
title="Upload Image Asset"
uploadUrl="${suffix.path}"
useHTML5="{Boolean}true"/>
<title
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/textfield"
fieldLabel="Title"
name="./image/jcr:title"/>
</items>
</column>
</items>
</image>
</items>
</content>
</jcr:root>
Please ignore the fields in the first tab. richtext field needs to be added to the second tab.
Please help!
Thanks in Advance!
Adobe recommends to use the richtext field using the InPlaceEditing/Full Screen Editing instead of adding the fields in the dialog as the complete functionality is covered by In-place/Full-screen editing.
Click Here for the reference from Adobe Docs.
However, if you really wish to use the RTE field inside your dialog, you can make use of the sling:resourceType="cq/gui/components/authoring/dialog/richtext" property to do the same.
See sample code below (the code refers to a richtext field in the touch UI dialog, simply put this piece of code in your touch UI dialog xml at the relevant place to make the dialog work).
<description
jcr:primaryType="nt:unstructured"
sling:resourceType="cq/gui/components/authoring/dialog/richtext"
name="./rteTextPropertyName"
useFixedInlineToolbar="{Boolean}true">
<rtePlugins jcr:primaryType="nt:unstructured">
<subsuperscript
jcr:primaryType="nt:unstructured"
features="*"/>
<format
jcr:primaryType="nt:unstructured"
features="*"/>
<justify
jcr:primaryType="nt:unstructured"
features="*"/>
<spellcheck
jcr:primaryType="nt:unstructured"
features="*"/>
<misctools
jcr:primaryType="nt:unstructured"
features="[specialchars]">
<specialCharsConfig jcr:primaryType="nt:unstructured">
<chars jcr:primaryType="nt:unstructured">
<copyright
jcr:primaryType="nt:unstructured"
entity="©"/>
<trademark
jcr:primaryType="nt:unstructured"
entity="™"/>
<registered
jcr:primaryType="nt:unstructured"
entity="®"/>
<emDash
jcr:primaryType="nt:unstructured"
entity="—"/>
<pound
jcr:primaryType="nt:unstructured"
entity="£"/>
<nbsp
jcr:primaryType="nt:unstructured"
entity=" "/>
</chars>
</specialCharsConfig>
</misctools>
</rtePlugins>
<uiSettings jcr:primaryType="nt:unstructured">
<cui jcr:primaryType="nt:unstructured">
<inline
jcr:primaryType="nt:unstructured"
toolbar="[format#bold,format#italic,format#underline,#paraformat,image#imageProps,#justify,#lists,links#modifylink,links#unlink,findreplace#find,findreplace#replace,subsuperscript#subscript,subsuperscript#superscript,spellcheck#checktext,misctools#specialchars]">
<popovers jcr:primaryType="nt:unstructured">
<justify
jcr:primaryType="nt:unstructured"
items="[justify#justifyleft]"
ref="justify"/>
<lists
jcr:primaryType="nt:unstructured"
items="[lists#unordered,lists#ordered,lists#outdent,lists#indent]"
ref="lists"/>
<paraformat
jcr:primaryType="nt:unstructured"
items="paraformat:getFormats:paraformat-pulldown"
ref="paraformat"/>
</popovers>
</inline>
</cui>
</uiSettings>
</description>
P.S.: I have added only a few RTE plugins keeping the length of the sample code in mind. You can add other plugins as needed.
Make sure to provide the correct context if reading the property in sightly (in here html), see below:
${properties.rteTextPropertyName #context = 'html'}
I was developing touch UI component. Below is what i tried and worked at some extent. Below is dialog.xml
<content
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/layouts/tabs"
type="nav"/>
<items jcr:primaryType="nt:unstructured">
<herotext
jcr:primaryType="nt:unstructured"
jcr:title="Hero Text Properties"
sling:resourceType="granite/ui/components/foundation/section">
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"/>
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<items jcr:primaryType="nt:unstructured">
<myradiogroup
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/radiogroup"
fieldLabel="Select Fruit"
name="./fruit">
<items jcr:primaryType="nt:unstructured">
<option1
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/radio"
cq-msm-lockable="fruit"
renderReadOnly="{Boolean}true"
text="Apple"
value="apple"/>
<option2
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/radio"
cq-msm-lockable="fruit"
renderReadOnly="{Boolean}true"
text="Pear"
value="pear"/>
</items>
</myradiogroup>
</items>
</column>
</items>
</herotext>
</items>
</content>
After this I am able to render the radio selected value on the page. But having below issue.
1) Radio options are coming in vertical direction, but i want them in horizontal.
2) Radio Group Name not display, I want same like as fieldLabel & want to hide hide the border line.
3) When i reopen the dialog, radiobutton is not selected even if the selected value stored in JCR during last submit.
Thanks
For getting the Radio Buttons in horizontal direction use following class as property with coral-RadioGroup--horizontal value. This is the OOTB class provided by AEM, you can also have your custom class to control layout and alignment
For displaying the Radio Button Group label use text property.
On opening the dialog, properties are populating fine. See if you have any other radiobuttongroup in same dialog with same name.
I need to create a component (say componentA) whose aim is to allow a user to add a variable number of components (choosing from componentB and componentC). So componentA is like a parsys which contains others components.
I'm using a multifieldpanel to create a component's dialog with a user controlled number of field. Something like this:
The problem is when I try to eliminate one of the elements added directly from the dialog of componentA: the element is effectively eliminated from the dialog but it actually remains inside the CRX.
My CRX is something like:
componentA
componentASon_0
componentASon_1
If I remove the component (componentASon_0 or componentASon_1) with a "right-click and delete" it works properly.
Any advice?
Here a snippet of the dialog relative to the componentA:
<tabMain
jcr:primaryType="cq:Widget"
title="myPanelTitle"
xtype="panel">
<items jcr:primaryType="cq:WidgetCollection">
<settings jcr:primaryType="cq:Widget"
fieldLabel="Payment Settings"
fieldDescription="Click the '+' to add a new block"
name="./settings"
xtype="multifield">
<fieldConfig
jcr:primaryType="cq:Widget"
xtype="multifieldpanel">
<items jcr:primaryType="cq:WidgetCollection">
<component
jcr:primaryType="nt:unstructured"
defaultValue="Choose a component"
fieldLabel="Component"
type="select"
value=""
key="componentType"
xtype="selection">
<options jcr:primaryType="cq:WidgetCollection">
<componentB
jcr:primaryType="nt:unstructured"
text="ComponentB"
value="/apps/project/components/commons/componentB"/>
<componentC
jcr:primaryType="nt:unstructured"
text="ComponentC"
value="/apps/project/components/commons/componentC"/>
</options>
</component>
</items>
</fieldConfig>
</settings>
</items>
</tabMain>
I need an identifier in tabs such that author can specify which tab will open at page load Below is my dialog.xml.
<items jcr:primaryType="cq:WidgetCollection">
<typeconfigs
jcr:primaryType="cq:Widget"
fieldLabel="Accordion"
name="./options"
xtype="customconfigmultifield">
<fieldConfigs jcr:primaryType="cq:WidgetCollection">
<option
jcr:primaryType="cq:Widget"
hidden="{Boolean}true"
name="option_name"
xtype="textfield"/>
<optionval
jcr:primaryType="cq:Widget"
allowBlank="{Boolean}false"
fieldLabel="Title"
maxLength="{Long}60"
name="optionval"
xtype="textfield"/>
<openaccordion
jcr:primaryType="cq:Widget"
name="selectaccordion"
type="radio"
xtype="selection">
<options jcr:primaryType="cq:WidgetCollection">
<one
jcr:primaryType="nt:unstructured"
text="Open at Page Load"
value="in"/>
</options>
</openaccordion>
</fieldConfigs>
<limit
jcr:primaryType="nt:unstructured"
maxVal="{Long}15"/>
</typeconfigs>
</items>
But now i am not getting the behavior of radio button, means i can tick all radio buttons inside each tab that i add via dialog. Any idea how can i make that switch possible. Thanks
The radio button, as defined in your current structure needs two options, and the value of the field will toggle between the two options.In case you just want to show one option, I'd recommend using a checkbox.
I've tried to answer your question by assuming you decide to go ahead with a checkbox (which has two states, true and false). In case you decide to add a second radio button, you can change the values of true and false to the values that you have defined; (one of which is in)
What you are looking for is a set of custom listeners that
i) iterate through each multifield item, checking the value of <openAccordion> of the currently clicked multifield item.
ii) Set it to true for the current multifield item
iii) Set the value of <openAccordion> to false for all other multifield items.
The event that you'd require is selectionchanged.
Once you verify that the properties are getting set correctly, all you need is another listener that triggers on the loadcontent event, that looks for the multifield item with the value of <openAccordion> as true and displays that tab, hiding the rest.
As an aside, in my opinion, you might want to restructure your dialog, something similiar to what #Mathew posted in his comment.
<items jcr:primaryType="nt:unstructured">
<tabs
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/multifield"
composite="{Boolean}true">
<field
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container"
name="./options">
<items jcr:primaryType="nt:unstructured">
<wrapper
jcr:primaryType="nt:unstructured"
jcr:title="eon-feh-service-po.components.siteadmin.question.v1.dialog.tab.general.answeroptions.multifieldexpand"
sling:resourceType="granite/ui/components/foundation/container">
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/layouts/collapsible"/>
<items jcr:primaryType="nt:unstructured">
<isDropoutOpt
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/radiogroup"
name="./isDropoutOpt"
renderReadOnly="{Boolean}true"
text="Option selection leads to dropdown?">
<items jcr:primaryType="nt:unstructured">
<radioYes
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/radio"
text="YES"
value="yes"/>
<radioNo
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/radio"
text="NO"
value="no"/>
</items>
</isDropoutOpt>
I am using 5.4. I'm attempting to add a style to the drop down style box on the rte. I followed the instructions found on http://docs.adobe.com/docs/en/cq/5-4/administering/configuring_rich_text_editor.html. After adding the node under text/rtePlugins/styles/styles, all of the options for the plugin are disabled. The buttons (such as the bold, italics, underline, etc...) are no longer clickable. While I can still select styles from the paraformat and style drop downs, they do not change the appearance of my text. Moreover, although I can change the text in the rte, the changes are not reflected in the page after I click ok.
I have attached a snapshot of my node hierarchy for the dialog node. Please let me know if I should include any other information.
Thanks!
Did you create this whole structure by yourself or copy it from somewhere?
What you need to be sure is to enable some features per type (or all by using *):
Here an example for the styles node:
<styles
jcr:primaryType="nt:unstructured"
features="*">
<styles jcr:primaryType="cq:WidgetCollection">
[...]
</styles>
</styles>
This has to be true for all the other nodes, but if you do not copy them at all you should have all features active again as well.
For having your custom style available in the RTE you also need to provide a CSS file on the text node with the following property.
externalStyleSheets="[{path_to_your_stylesheet}]"
I recommend to create one just for the RTE with just the styles you add in the styles list.
I followed the instructions here, and it worked for me:
http://docs.adobe.com/docs/en/cq/5-4/administering/configuring_rich_text_editor.html#Styles (Text)
The resulting dialog looked like this:
<?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" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="cq:Dialog"
externalStyleSheets="[/etc/designs/myDesign/css/my_colors.css]"
height="500"
width="700"
xtype="dialog">
<items
jcr:primaryType="nt:unstructured"
helpPath="en/cq/current/wcm/default_components.html#Text"
title="Text"
xtype="tabpanel">
<items jcr:primaryType="cq:WidgetCollection">
<tab1
jcr:primaryType="cq:Widget"
anchor="100%"
height="350"
title="Text"
xtype="panel">
<items jcr:primaryType="cq:WidgetCollection">
<text
jcr:primaryType="cq:Widget"
allowBlank="false"
blankText=""
disabled="false"
emptyText=""
fieldDescription=""
fieldLabel=""
fieldSubLabel=""
grow="false"
height="{Long}350"
hideLabel="true"
hideMode=""
inputType=""
maxLength=""
maxLengthText=""
minLength=""
minLengthText=""
msgTarget=""
name="./text"
readOnly="false"
regex=""
regexText=""
selectOnFocus="false"
validateOnBlur="true"
validationDelay=""
validationEvent=""
validator=""
vtype=""
vtypeText=""
xtype="richtext">
<rtePlugins jcr:primaryType="nt:unstructured">
<links jcr:primaryType="nt:unstructured">
<linkDialogConfig
jcr:primaryType="nt:unstructured"
height="316">
<linkAttributes jcr:primaryType="cq:WidgetCollection">
<linkAdvanced
jcr:primaryType="cq:Widget"
collapsed="true"
collapsible="true"
inputValue="advanced"
name="./linkdialog/cq:adhocLinkTrackingTab"
title="Link tracking"
xtype="dialogfieldset">
<items jcr:primaryType="cq:WidgetCollection">
<enable
jcr:primaryType="nt:unstructured"
attribute="enabletracking"
fieldDescription="override analytics framework settings"
fieldLabel="Custom link tracking"
name="./linkdialog/cq:adhocLinkTrackingEnableTracking"
xtype="checkbox">
<listeners
jcr:primaryType="nt:unstructured"
check="function(component){var dlg=component.findParentByType('rtelinkdialog');dlg.enableSCFields(component.checked);}"/>
</enable>
<events
jcr:primaryType="nt:unstructured"
attribute="adhocevents"
fieldDescription="e.g.: event2, event7"
fieldLabel="Include SiteCatalyst events"
name="./linkdialog/cq:adhocLinkTrackingEvents"
xtype="textfield"/>
<evars
jcr:primaryType="nt:unstructured"
attribute="adhocevars"
fieldDescription="e.g.: eVar1: pagedata.url, prop4: 'const'"
fieldLabel="Include SiteCatalyst variables"
name="./linkdialog/cq:adhocLinkTrackingEvars"
xtype="textfield"/>
</items>
</linkAdvanced>
</linkAttributes>
</linkDialogConfig>
</links>
<misctools
jcr:primaryType="nt:unstructured"
features="*"/>
<edit
jcr:primaryType="nt:unstructured"
features="*"/>
<findreplace
jcr:primaryType="nt:unstructured"
features="*"/>
<format
jcr:primaryType="nt:unstructured"
features="*"/>
<image
jcr:primaryType="nt:unstructured"
features="*"/>
<keys
jcr:primaryType="nt:unstructured"
features="*"/>
<justify
jcr:primaryType="nt:unstructured"
features="*"/>
<lists
jcr:primaryType="nt:unstructured"
features="*"/>
<paraformat
jcr:primaryType="nt:unstructured"
features="*"/>
<spellcheck
jcr:primaryType="nt:unstructured"
features="*"/>
<styles
jcr:primaryType="nt:unstructured"
features="*">
<styles jcr:primaryType="cq:WidgetCollection">
<Aqua
jcr:primaryType="nt:unstructured"
cssName="Aqua"
text="Aqua"/>
</styles>
</styles>
<subsuperscript
jcr:primaryType="nt:unstructured"
features="*"/>
<table
jcr:primaryType="nt:unstructured"
features="*"/>
<undo
jcr:primaryType="nt:unstructured"
features="*"/>
</rtePlugins>
</text>
<isRichTextFlag
jcr:primaryType="cq:Widget"
ignoreData="true"
name="./textIsRich"
value="true"
xtype="hidden"/>
</items>
</tab1>
<tab2
jcr:primaryType="cq:Widget"
xtype="componentstyles"/>
</items>
</items>
</jcr:root>
The only items added to the original dialog, was the "externalStyleSheets" attribute on the "jcr:root" node (you should map this to your style sheet):
externalStyleSheets="[/etc/designs/myDesign/css/my_colors.css]"
And the node:
<styles
jcr:primaryType="nt:unstructured"
features="*">
<styles jcr:primaryType="cq:WidgetCollection">
<Aqua
jcr:primaryType="nt:unstructured"
cssName="Aqua"
text="Aqua"/>
</styles>
</styles>
The "cssName" attribute must match your css style name (and NOT be preceeded by a "."), the "text" attribute can be anything you want, it will be what appears in the drop-down.
my_colors.css looks like this:
.Aqua { color: Aqua; }
Hope this helps,
-- Joel.