Touch UI Dialog - include part of another dialog | Community
Skip to main content
bwalsh22
Level 2
September 22, 2017
Solved

Touch UI Dialog - include part of another dialog

  • September 22, 2017
  • 4 replies
  • 10774 views

I'm currently trying to reuse some parts of existing dialogs with mixed results.  It seems depending on which level of the existing dialog I include it either works or doesn't and I'm not really sure why.  I should note that this is on Adobe 6.1, SP2, CFP11

Existing Dialog

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/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="Lede Tile"
   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/fixedcolumns"/>

   <items jcr:primaryType="nt:unstructured">

   <column
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/container">

   <items jcr:primaryType="nt:unstructured">

   <headlineGroup
   jcr:primaryType="nt:unstructured"
   jcr:title="Tile Type Headline Text"
   sling:resourceType="granite/ui/components/foundation/form/fieldset">

   <items jcr:primaryType="nt:unstructured">

   <article
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/form/textfield"
   cq-msm-lockable="./ns.headlineArticle"
   fieldLabel="Article"
   name="./ns.headlineArticle"/>

   <default
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/form/textfield"
   cq-msm-lockable="./ns.headlineGeneric"
   fieldDescription="This headline is used for generic pages that don't fit one of the other headline types"
   fieldLabel="Default"
   name="./ns.headlineGeneric"/>

   <event
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/form/textfield"
   cq-msm-lockable="./ns.headlineEvent"
   fieldLabel="Event"
   name="./ns.headlineEvent"/>

   <product
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/form/textfield"
   cq-msm-lockable="./ns.headlineProduct"
   fieldLabel="Product"
   name="./ns.headlineProduct"/>

   <recipe
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/form/textfield"
   cq-msm-lockable="./ns.headlineRecipe"
   fieldLabel="Recipe"
   name="./ns.headlineRecipe"/>

   <service
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/form/textfield"
   cq-msm-lockable="./ns.headlineService"
   fieldLabel="Service"
   name="./ns.headlineService"/>

   <serviceBanner
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/form/textfield"
   cq-msm-lockable="./ns.serviceBanner"
   fieldLabel="Service Banner"
   name="./ns.serviceBanner"/>

   <video
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/form/textfield"
   cq-msm-lockable="./ns.headlineVideo"
   fieldLabel="Video"
   name="./ns.headlineVideo"/>

   </items>

   </headlineGroup>

   </items>

   </column>

   </items>

   </content>

</jcr:root>

Then the following works:

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/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="Search Results"
   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/fixedcolumns"/>

   <items jcr:primaryType="nt:unstructured">

   <column
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/container">

   <items jcr:primaryType="nt:unstructured">

   <headlineGroup
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/include"
   path="test/components/content/lede-tile/dialogshared/content/items/column/items/headlineGroup"/>

   </items>

   </column>

   </items>

   </content>

</jcr:root>

But lastly the below dialog will not import the fields from the original and I'm not sure why.

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/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="Search Results"
   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/fixedcolumns"/>

   <items jcr:primaryType="nt:unstructured">

   <column
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/container">

   <items jcr:primaryType="nt:unstructured">

   <headlineGroup
   jcr:primaryType="nt:unstructured"
   jcr:title="Search Result Type Headline Text"
   sling:resourceType="granite/ui/components/foundation/form/fieldset">

   <items
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/include"
   path="test/components/content/lede-tile/dialogshared/content/items/column/items/headlineGroup/items"/>

   </headlineGroup>

   </items>

   </column>

   </items>

   </content>

</jcr:root>

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by VeenaVikraman

If you need to change the values of the fields which you are trying to include, you cannot take the "include" approach. You can include fields only if you are going to reuse the fields as it is. Since you need to change the properties of the fields, please create those fields and change the properties accordingly.

+ regarding the field from items node; that may not be possible . The items node is mostly to hold the collection of widgets as it was in classic UI . As far as I know we cannot set any properties in the node.

4 replies

Techaspect_Solu
Level 7
September 25, 2017

Hi,

In your new dialog, cq:dialog is missing in the path attribute which might be the reason behind your issue. Try adding it as shown below -

path="test/components/content/lede-tile/dialogshared/cq:dialog/content/items/column/items/headlineGroup"

If it doesn't work, please find the below working sample code which might help you in understanding what is missing in your new dialog:

Original dialog:

<?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="Footer Section Links"

    sling:resourceType="cq/gui/components/authoring/dialog">

    <content

        jcr:primaryType="nt:unstructured"

        sling:resourceType="granite/ui/components/foundation/container"

        class="dialog_width">

        <layout

            jcr:primaryType="nt:unstructured"

            sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"

            type="nav"/>

        <items jcr:primaryType="nt:unstructured">

            <section

                jcr:primaryType="nt:unstructured"

                jcr:title="section"

                sling:resourceType="granite/ui/components/foundation/container">

                <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">

                            <field

                                jcr:primaryType="nt:unstructured"

                                sling:resourceType="granite/ui/components/foundation/form/fieldset"

                                eaem-nested=""

                                name="./items">

                                <items jcr:primaryType="nt:unstructured">

                                    <page

                                        jcr:primaryType="nt:unstructured"

                                        sling:resourceType="granite/ui/components/foundation/form/textfield"

                                        fieldDescription="Enter Page Name"

                                        fieldLabel="Page Name"

                                        name="./text"/>

                                    <path

                                        jcr:primaryType="nt:unstructured"

                                        sling:resourceType="granite/ui/components/foundation/form/pathbrowser"

                                        fieldDescription="Select Path"

                                        fieldLabel="Landing Path"

                                        name="./url"

                                        rootPath="/content"/>

                                    <imagepath

                                        jcr:primaryType="nt:unstructured"

                                        sling:resourceType="granite/ui/components/foundation/form/pathbrowser"

                                        fieldDescription="Select Image Path"

                                        fieldLabel="Image Path"

                                        name="./imagePath"

                                        rootPath="/content"/>

                                </items>

                            </field>

                        </items>

                    </column>

                </items>

            </section>

        </items>

    </content>

</jcr:root>

New dialog:

<?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="Properties"

    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/fixedcolumns"/>

        <items jcr:primaryType="nt:unstructured">

            <section

                jcr:primaryType="nt:unstructured"

                jcr:title="section"

                sling:resourceType="granite/ui/components/foundation/container">

                <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">

                            <field

                                jcr:primaryType="nt:unstructured"

                                sling:resourceType="granite/ui/components/foundation/include"

                                name="./items"

                                path="tasks/components/helloworld/cq:dialog/content/items/section/items/column/items/field"/>

                        </items>

                    </column>

                </items>

            </section>

        </items>

    </content>

</jcr:root>

Regards,

TechAspect Solutions

kautuk_sahni
Community Manager
Community Manager
September 25, 2017

Can you please share package and errors that you are getting?

~kautuk

Kautuk Sahni
bwalsh22
bwalsh22Author
Level 2
September 26, 2017

I see what you're saying but that is because my components were actually using the acs commons shared properties dialogs.  I was able to get an example working similar to the one provided.  That being said I actually want to include one level deeper ("items" underneath "field") so that I could change properties related to "field" in the dialog that is doing the including.

VeenaVikraman
Community Advisor
VeenaVikramanCommunity AdvisorAccepted solution
Community Advisor
September 26, 2017

If you need to change the values of the fields which you are trying to include, you cannot take the "include" approach. You can include fields only if you are going to reuse the fields as it is. Since you need to change the properties of the fields, please create those fields and change the properties accordingly.

+ regarding the field from items node; that may not be possible . The items node is mostly to hold the collection of widgets as it was in classic UI . As far as I know we cannot set any properties in the node.