CQ5 opening dialog when loading a page

I have a cq page with a component enabled with <cq:include />

I would like to open the component dialog box on the page , instead of waiting for the author to double-click on the component area.

Thank you Sri

+4
source share
1 answer

this is what i did when i want to open a dialogue

<script type="text/javascript">
<% if (((String)properties.get(configuration.getInherited("connectedWhen", "username"), "")).trim().equals("")) { %>
CQ.WCM.onEditableReady("<%= resource.getPath() %>", function(editable){
    CQ.wcm.EditBase.showDialog(editable);
}, this);
<% } %>
</script>

or if you want a cleaner code try this:

CQ.WCM.onEditableReady("<%= resource.getPath() %>", function(editable){
    CQ.wcm.EditBase.showDialog(editable);
}, this);

Hope this helps .. :)

+7
source

Source: https://habr.com/ru/post/1627203/


All Articles