7 Replies Latest reply on May 31, 2013 12:47 PM by gnew1

    parsys and cq:noDecoration

    gnew1

      I have a page that has:

      <cq:include path="./par" resourceType="foundation/components/parsys" />

       

      Some of the components under ./par  has  cq:noDecoration=true set.

      Those components, don't get component control  (no blue border when mouse over).

       

      How can I force render automatically generated <div> around the components that have cq:noDecoration set?

      Thses component need cq:noDecoration because  they are included in when rendering <head>.

       

      Components are managed in a page with parsys. And, then each component paths are included in <head>.

      For example, 

      <!doctype html>

      <html>

      <head>

          <sling:include path="/content/example/page/jcr:content/par/component1.foobar" />

      ....

       

      And in the management page  (/content/example/page), I render parsys.

        • 1. Re: parsys and cq:noDecoration
          rush_pawan Level 4

          Hello,

           

          If i understood correctly the problem you are facing is same component are getting called in Head and Parsys of same page and because it also get called on Head of course you dont want it to be editable there (not sure why this use case)

           

          So my suggestion would be to do the reverse. Means if the idea behind setting cq:noDecoration as true only because they have called in <Head> then better remove that property from your componet and in header make WCMMode disabled before adding those components call in header and again enable it after call so that on header those components will work as you expected and in parsys area you dont have to worry about handling editable condition.

           

          <%

              

          WCMMode modeBefore = WCMMode.fromRequest(request);

                  WCMMode.DISABLED.toRequest(request);

           

          %>

           

          //your sling include for components

           

          <%

          modeBefore.toRequest(request);

          %>

           

          I hope it helps else plz describe the problem in detail.

           

          Thanks,

          Pawan

          • 2. Re: parsys and cq:noDecoration
            orotas Level 4

            If the reason you want to set no decortion is because you don't want the div tags in the header (as opposed to not wanting it to be editable) then what you can do is set the no decoration option when you include the component in the header. So you code would like like this in your header file:

             

            <head>

            <%

                 IncludeOptions opts = IncludeOptions.getOptions(request, true);

                 opts.setDecorationTagName("");

            %>

                <sling:include path="/content/example/page/jcr:content/par/component1.foobar" />

             

            Then you remove the cq:noDecoration setting from the components and the component is still editable everywhere.

            • 3. Re: parsys and cq:noDecoration
              gnew1 Level 1

              By default, I want to suppress component tag rendering (cq:noDecorate=true) for my components.

              But, only on this specific page that has many components under parsys, I want to render component tags, wrapping <div> to enable component dialog edits.

               

               

               

               

               

              Detailed example,

               

              /content/example/manage.html

              is management page.

              This renders  <cq:include path="./par" resourceType="foundation/components/parsys" />

               

              Frontend developers drag drop some components on that management page.

              After drag-dropping some components, you might have these component nodes:

              /content/example/manage/jcr:content/par/component1

              /content/example/manage/jcr:content/par/component2

              /content/example/manage/jcr:content/par/component3

               

              Now, devs go write jsp files in their components such as:

              <sling:include path="/content/example/manage/jcr:content/par/component1.js"/>

              <sling:include path="/content/example/manage/jcr:content/par/component2.css"/>

              ...

               

              I don't want devs to wrap around each sling:include to disable rendering of component <div> :

              <%

              slingRequest.setAttribute(ComponentContext.BYPASS_COMPONENT_HANDLING_ON_INCLUDE_ATTRIBUTE, true);

              %>

              <sling:include path="/content/example/manage/jcr:content/par/component1.js"/>

              <%

              slingRequest.setAttribute(ComponentContext.BYPASS_COMPONENT_HANDLING_ON_INCLUDE_ATTRIBUTE, null);

              %>

               

              (Or, use IncludeOptions and other ways to suppress component wrap tag rendering).

               

              Instead, I want devs to write:

              <sling:include path="/content/example/manage/jcr:content/par/component1.js"/>

               

              But on the magement page, I want devs to be able to edit component data through cq dialog.

              • 4. Re: parsys and cq:noDecoration
                orotas Level 4

                I am sort of surprised that the edit bars appear when you use sling:include.

                 

                I am not sure if there is any good way to achieve what you want, it is a fairly unusually use case. The only thing I can think of is to override the paragraph system and in parsys.jsp you would add 

                     IncludeOptions opts = IncludeOptions.getOptions(request, true);

                     opts.setDecorationTagName("div");

                 

                That might not work though because I am not sure it would print out the right class names.

                 

                The other thing you could try to do is extend sling:include with your own tag that sets the include options for the JSP developers. That should work also and is probably less messy than overriding the paragraph system.

                • 5. Re: parsys and cq:noDecoration
                  gnew1 Level 1

                  Yah, I was looking into creating custom tag.

                   

                  I'd expect parsys to always force render component div in author and wcm edit mode.

                  I can't think of a use case where you'd want to obey cq:noDecoration in parsys edit mode.

                  • 6. Re: parsys and cq:noDecoration
                    orotas Level 4

                    Well I won't speak for Adobe as to why it works as it does but unless you want to wait for a feature pack from Adobe you will either have to override the parsys (which should be easy because it uses the IncludeOptions to add the CSS classes to the decoration tag. I'd say your only choices are overriding the paragraph system (which has upgrade path implications) or writing a custom tag). 

                    • 7. Re: parsys and cq:noDecoration
                      gnew1 Level 1

                      i set  cq:noDecoration=true  and manually inserted

                              <script>

                              CQ.WCM.edit({

                                  path: "${currentNode.path}",

                                  dialog: "${component.dialogPath}"

                              });

                              </script>

                       

                      so that components can be edited in parsys.

                       

                      That's in component jsp

                       

                      frontend devs specifies different selector. So, that <script> won't be rendered

                      when they do <sling:include path="/content/example/manage/jcr:content/par/component1.js" />

                      since js.jsp will be used to render, not the component jsp.