In a page template I have a parsys in which a header component can be dropped. Something similar to this:
<cq:include path="parsys-header" resourceType="foundation/components/iparsys"/>
How can I configure this iparsys so that when it is empty, the header component can be dropped into it but when the header component is already dropped into it, nothing else can be dropped into it?
Thanks.
Solved! Go to Solution.
Follow the below steps:
Step1: Overlay parsys under apps/urproject
Step2: create a widget called "totalcomp" under desing_dialog/items/title/ and add property maxValue =10
Step3: create a file comp.jsp under apps/urproject/components/parsys and check the total size of ParagraphSystem using
int totalComponents=parSys.paragraphs().size();
int restrictCompoNo=Integer.parseInt(currentStyle.get("totalcomp","10"));
Step 4: Overlay Sidekick.js under ur apps/
Step 5: in notifyDropDT method add the below code to check
var checkUrl=parentPath.substr(0,parentPath.lastIndexOf("/"))+".comp";
var canCreate = CQ.HTTP.eval(checkUrl);
Step 6: if canCreate is true then call editComponent.createParagraph(definition);
Here is a StackOverFlow thread (not the exact use case) - but related and points you in the right direction:
http://stackoverflow.com/questions/19051288/placing-default-components-in-an-iparsys
Views
Replies
Total Likes
Follow the below steps:
Step1: Overlay parsys under apps/urproject
Step2: create a widget called "totalcomp" under desing_dialog/items/title/ and add property maxValue =10
Step3: create a file comp.jsp under apps/urproject/components/parsys and check the total size of ParagraphSystem using
int totalComponents=parSys.paragraphs().size();
int restrictCompoNo=Integer.parseInt(currentStyle.get("totalcomp","10"));
Step 4: Overlay Sidekick.js under ur apps/
Step 5: in notifyDropDT method add the below code to check
var checkUrl=parentPath.substr(0,parentPath.lastIndexOf("/"))+".comp";
var canCreate = CQ.HTTP.eval(checkUrl);
Step 6: if canCreate is true then call editComponent.createParagraph(definition);