Jahia Dev Forum > Add switch mode...

0 (0 Good)
0 (0 Bad)

Add switch mode button in Live mode

by  nabil.benabdallah@outlook.com »  2016/04/06 15:39

Hi,

Is it possible to add a switch button to permit users who have contributor rights to switch from live to contribute interface in live mode ?

Thanks

  (nabil.benabdallah@outlook.com)

Number of messages  9
Registration date
0 (0 Good)
0 (0 Bad)

Re : Add switch mode button in Live mode

by  nabil.benabdallah@outlook.com »  2016/04/07 07:50

I have added a link shown only in live mode but how can I hide it for users others than contributors ?

<c:if test="${renderContext.liveMode}">
    <div class="row edit-mode-add-button-row">
        <c:url var="url" value="/cms/contribute/default/{lang}${jcr:getParentOfType(currentNode.parent,'jnt:page').path}.html"/>        
        <a href="${url}">Contribute Mode</a>
    </div>
</c:if>

  (nabil.benabdallah@outlook.com)

Number of messages  9
Registration date
0 (0 Good)
0 (0 Bad)

Re : Re : Add switch mode button in Live mode

by  jordannroussel »  2016/04/07 08:48

We have example components, used in our demo site, which provides such links.

Have a look at the source https://github.com/Jahia/bootstrap-components/blob/master/src/main/resources/jnt_bootstrapMenuLoginForm/html/bootstrapMenuLoginForm.menu.jsp , especially from line125 to 156

You have to test the permission of the user, just like this :

<c:if test="${! renderContext.editMode && jcr:hasPermission(renderContext.mainResource.node, 'editModeAccess')}">

  • Re : Re : Add switch mode button in Live mode
    2016/04/07 08:48

    jordannroussel <p>We have example components, used in our demo site, which provides such links.</p> <p>Have a look at the source&nbsp;https://github.com/Jahia/bootstrap-components/blob/master/src/main/resources/jnt_bootstrapMenuLoginForm/html/bootstrapMenuLoginForm.menu.jsp , especially from line125 to 156</p> <p>You have to test the permission of the user, just like this :</p> <p><span style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 16.8px; white-space: pre;">&lt;</span><span class="pl-ent" style="box-sizing: border-box; color: rgb(99, 163, 92); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 16.8px; white-space: pre;">c:if</span><span style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 16.8px; white-space: pre;"> </span><span class="pl-e" style="box-sizing: border-box; color: rgb(121, 93, 163); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 16.8px; white-space: pre;">test</span><span style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 16.8px; white-space: pre;">=</span><span class="pl-s" style="box-sizing: border-box; color: rgb(24, 54, 145); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 16.8px; white-space: pre;"><span class="pl-pds" style="box-sizing: border-box;">&quot;</span><span class="pl-pse" style="box-sizing: border-box;">${</span><span class="pl-s1" style="box-sizing: border-box; color: rgb(51, 51, 51);"><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">!</span> renderContext<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>editMode <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">&amp;&amp;</span> jcr<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">:</span>hasPermission(renderContext<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>mainResource<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>node, <span class="pl-s" style="box-sizing: border-box; color: rgb(24, 54, 145);"><span class="pl-pds" style="box-sizing: border-box;">&#39;</span>editModeAccess<span class="pl-pds" style="box-sizing: border-box;">&#39;</span></span>)</span><span class="pl-pse" style="box-sizing: border-box;"><span class="pl-s1" style="box-sizing: border-box;">}</span></span><span class="pl-pds" style="box-sizing: border-box;">&quot;</span></span><span style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 16.8px; white-space: pre;">&gt;</span></p>

  • Number of messages  13
    Registration date Apr 7, 2016
    0 (0 Good)
    0 (0 Bad)

    Re : Re : Re : Add switch mode button in Live mode

    by  nabil.benabdallah@outlook.com »  2016/04/07 09:38

    Thank you, this is helpful !

      (nabil.benabdallah@outlook.com)

    Number of messages  9
    Registration date
    Contact
    Share
    Feedback

    Get in touch

    Whether you are a current user or if you are just evaluating Jahia, we are here to help.

    Contact us

    Share this page