cancel
Showing results for 
Search instead for 
Did you mean: 

closing twister by default in documentlibrary section

ayubalfresco
Champ in-the-making
Champ in-the-making
I am using share 4.2 enterprise. I am trying to accomplish same thing listed in the below forum post:

https://forums.alfresco.com/forum/end-user-discussions/alfresco-share/how-make-sections-displayed-co...

The clue suggested in that post does not work. I also tried to extend document-versions.get.html.ftl using the extensions option, however not able to set the style element to none for the section below the arrow (twister) which displays "Last Version" section.



<@markup id="my-widgets" target= "widgets" action= "replace" scope= "global">
      <#if allowNewVersionUpload??>
         <@createWidgets group="document-details"/>
         <@inlineScript group="document-details">
            YAHOO.util.Event.onContentReady("${args.htmlid?js_string}-heading", function() {
               Alfresco.util.createTwister("${args.htmlid?js_string}-heading", "DocumentVersions");
               YUIDom.addClass("${args.htmlid?js_string}-heading",  "alfresco-twister-closed");
               var doc = document.getElementById("${args.htmlid?js_string}-body");
            var panelBodyDiv = null;
            for (var i = 0; i < doc.childNodes.length; i++) {
                if (doc.childNodes.className == "panel-body") {
                  panelBodyDiv = doc.childNodes;
                  panelBodyDiv.style.display="none";                  
                  break;
                }       
            }
            });
         </@>
      </#if>
   </@>


From the above code YUIDom.addClass("${args.htmlid?js_string}-heading",  "alfresco-twister-closed"); does work and shows the arrow (twister) in closed position. The rest of the code does not hide the text below it.

The behaviour I have seen is that my custom script is inserted before the default inline script present in the out of the box ftl
1 REPLY 1

ayubalfresco
Champ in-the-making
Champ in-the-making
Thank you AFaust for the tip.

Basically I wrote a subcomponent for footer. This subcomponent has an <@inlineScript> which will fetch each html element change the twister css to close

YUIDom.replaceClass(idoftwisterelement, "alfresco-twister-open", "alfresco-twister-closed");

Also hide the div below the twister which renders the text. element.sytle.display="none"