8 Replies Latest reply on May 14, 2013 5:47 AM by ronald.ploeger

    Drag and Drop on Page Component

    ronald.ploeger Level 1

      Hi,

       

      I have an edit configuration which looks 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:EditConfig">
              <cq:dropTargets jcr:primaryType="nt:unstructured">
                  <title-data-reference
                      jcr:primaryType="cq:DropTargetConfig"
                      accept="[.*]"
                      groups="[title]"
                      propertyName="./title" />
              </cq:dropTargets>
              <cq:listeners
                  jcr:primaryType="cq:EditListenersConfig"
                  afteredit="REFRESH_PAGE" />   
          </jcr:root>

       

      The drop taget in the JSP is defined like this:

       

          <div class="<%=DropTarget.CSS_CLASS_PREFIX%>title-data-reference">
              <b>Drop it here</b>
          </div>

       

      When I use this in a "normal" component drag and drop from the content finder works fine. When I *** the same edit configuration and the same drop target code to my page component, which has sling:resourceSuperType="foundation/components/page" specified, the drop area is not recognisable as a drop area.

       

      Both component and the page component dialog have a pathfield widget defined:

       

          <?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:Widget"
              fieldLabel="Titel"
              name="./title"
              rootTitle="Titel"
              xtype="pathfield"
              rootPath="/etc/xxx/titles">
          </jcr:root>

       

      Is a page component different from a "normal" component so that it does not accept a drop? Am I missing something else?

       

      Thanks in advance,

      Ronald

        • 1. Re: Drag and Drop on Page Component
          Ryan Lunka Level 3

          A page component shouldn't be any different from a content component. However, I wonder if your problem is that CQ is trying to set up the drop target with JS before the JS is included on the page. Just a guess. Do you see any JS errors in the console?

          • 2. Re: Drag and Drop on Page Component
            ronald.ploeger Level 1

            Hi Ryan,

             

            thanks for your reply - no there are not JS errors.

             

            I have seen that the JS method "buildSubDropTargets" is responsible for, well, building the drop targets. It is called for every 'normal' component on my page but not for the page component. Thus I guess CQ5 does not intend page components to have drop targets.

             

            Best,

            Ronald

            • 3. Re: Drag and Drop on Page Component
              Jörg Hoh Adobe Employee

              Ronald,

               

              normally you should leverage the parsys to drop components on; that's much more flexible than dropping them directly to the page.

               

              Jörg

              • 4. Re: Drag and Drop on Page Component
                ronald.ploeger Level 1

                Hi Jörg,

                 

                good to hear from you.

                 

                This would not really do what I want. I want to be able to associate a title (in my case a book title) with a page by dropping it on it. Then I have multiple parsyses (e.g. center, east) on my page and can drop components onto these which will display content from the title associated with the page.

                 

                Currently I can only drag titles onto each individual component. If I followed your advise I would still have to drag the title onto multiple parsyses. Therefore it would really be helpful if CQ allowed you to drop stuff onto a page.

                 

                In my opinion this would also be helpful for the geometrix outdoors example where one drops products onto a product-component. As soon as you want add another component to the page displaying different data from or based the same product you would need to drag the same product onto that new component.

                 

                Best,

                Ronald

                • 5. Re: Drag and Drop on Page Component
                  Jörg Hoh Adobe Employee

                  Hi Ronald,

                   

                  What is then the origin of your drag operation? The contentfinder? In that case I would hardcode a title component on the template and let the user drag a title from the contentfinder to that title element, just like you can do it with the image component.

                   

                  Jörg

                  • 6. Re: Drag and Drop on Page Component
                    ronald.ploeger Level 1

                    Hi Jörg,

                     

                    yes, I created a new tab in the content finder for book titles, similar to the product tab.

                     

                    I also though about having a "title component" to hold the information which title is associated with the page. Then the other component on the page could take a look at that "title component" to determine the current title associated with the page. This is certainly feasible - but the fact remains that it is only a workaround because one can not drag and drop onto a page component.

                     

                    Best,

                    Ronald

                    • 7. Re: Drag and Drop on Page Component
                      Jörg Hoh Adobe Employee

                      Ronald,

                       

                      Of course you can consider it as a workaround. Feel free to raise a Daycare ticket to ask for a change of that behaviour.

                       

                      But think of case, where you have multiple drop zones on a page; in that case you require that you can drop something to the page itself, and not to the component layered on top of it. Or that you miss such a parsys drag zone and drop it by accident on the page itself. How do you remove it from there?

                       

                      Jörg

                      • 8. Re: Drag and Drop on Page Component
                        ronald.ploeger Level 1

                        Hi Jörg,

                         

                        I am sorry, but do not completely understand what you mean.

                         

                        If you dropped something onto the page and want to remove it you can do it from the page properties. I configured a new tab in the page properties which holds a pathfield-widget.

                         

                        Best,

                        Ronald