Hello,
I finalized my "ShowHide only right panel" extension.
I use only one JS function and 1 cookie.
Here the code and instruction if you want (like you show me your xar :-) )
---------------------------
To use it:
- you must add this html code in a page (in footer by example)
{{html}}
<label id="BtnSHPanel" class="btn"
onclick="ShowHidePanel('#rightPanels',90)" title="Replier/Déplier
le panel de droite">⇄</label>
{{/html}}
- add JS Cookie function (Cookie.xar)
- and replace this line in template (or use xwiki object):
./templates/rightpanels.vm
<$bodyTagName id="body" class="skin-flamingo
wiki-${xcontext.database} space-${escapetool.xml($doc.space.replaceAll(' ',
'_'))} ${bodyAction}body #if($showLeftPanels == "0" ||
$!request.getCookie('CkPanelhidden'))hideleft#end#if($showRightPanels ==
"0" ||
$!request.getCookie("CkPanelhidden"))hideright#end#if($hidecolumns &&
($!hidecolumns == 1))hidelefthideright#end #if($showLeftPanels != "0" &&
$showRightPanels != "0" && $!hidecolumns != 1)content#end
panel-left-width-${leftPanelsWidth} panel-right-width-${rightPanelsWidth}">
./skins/flamingo/htmlheader.vm
#if($showRightPanels == "1" ||
$request.getParameter("forceRightPanels") ||
$!request.getCookie("CkPanelhidden"))
<div id="rightPanels" class="panels right
panel-width-$!{rightPanelsWidth}"#if(($showRightPanels != "1" &&
$request.getParameter("forceRightPanels")) ||
$!request.getCookie("CkPanelhidden"))) style="display: none;"#end>
#set($panelUixs =
$services.uix.getExtensions('platform.panels.rightPanels'))
---------------------------
My JS function:
----------
function ShowHidePanel(VarPanelId, day) {
//Show or Hide panel depend of cookie
var PHidden = readCookie('CkPanelhidden');
require(['jquery'], function ($) {
if (!PHidden) {
//Hide the panel and save state in a cookie
$('#xwikicontent').append("<p>Debug Hide Panel:VarPanelId
"+VarPanelId+"</p>");
createCookie('CkPanelhidden',true,day);
$(VarPanelId).slideUp(0);
}
$('#body').toggleClass('hideleft hidelefthideright');
$('#contentcontainer').toggleClass('hideleft hidelefthideright');
if (PHidden) {
//Show the panel and delete the cookie
eraseCookie('CkPanelhidden');
$(VarPanelId).slideDown(0);
}
});
}----------
(xwiki users list in copy if interested)
Pascal BASTIEN
________________________________
De : Paul-Catalin Cojan <paul.cojan(a)xwiki.com>
À : Pascal BASTIEN <pbasnews-xwiki(a)yahoo.fr>
Envoyé le : Mardi 4 novembre 2014 17h21
Objet : Re: [xwiki-devs] [Contrib] Hide-Show Panels extension
Hello,
I attached the xar.
On Tue, Nov 4, 2014 at 5:59 PM, Pascal BASTIEN <pbasnews-xwiki(a)yahoo.fr> wrote:
Hello,
Could you send me your xar, plz?
I'm interested with it (I'm started to work on a similar panel in CSS but I
hadn't time to add some JS to make it persistent with cookie + JS) and worked on
another job priority before to continue...
I will send you eventually bugs if I encountered some before you publish on e.x.o.
Thanks by advance.
Pascal B
________________________________
De : Paul-Catalin Cojan <paul.cojan(a)xwiki.com>
À : devs(a)xwiki.org
Envoyé le : Mardi 4 novembre 2014 16h18
Objet : [xwiki-devs] [Contrib] Hide-Show Panels extension
Hello devs! I created an extension that allows to hide and show the left
and the right panel column. It have only one document XWiki.PanelsShowHide
with one jsx and one ssx object. I need a repository on
github. The name
can be : panels-showhide-extension or
application-showhide-panels or if
you have any suggestion. Thank you!
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs