Allow 'show/hide' feature from collapsiblock, but for regions..

ilo - October 10, 2007 - 21:44
Project:Javascript Tools
Version:HEAD
Component:Proposed new addition
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

It would be great to hide the complete region instead of opening/closing each block. For some site configurations the left or right regions are only helpers for the site navigation, and sometimes disabling them should give more space for the content reading.

I'm not sure about the implications, as the configuration should allow to enable or disable the hide/show option for each region, but the option would give a usability helper for the users.

Thanks in advance!

#1

surajhs - April 22, 2009 - 11:30

This code is to expand/collapse submenu in left panel in My Projects section.

Book.module from line 655

function book_tree_recurse($nid, $depth, $children, $unfold = array()) {
global $divheight;
$output = '';
if ($depth > 0) {
if (isset($children[$nid])) {
foreach ($children[$nid] as $foo => $node) {
$divheight = $divheight + 1;
$linktitle = array();
$showhide = array("onClick" => "showHideCat(expand'.$node->nid.')");
if (in_array($node->nid, $unfold)) {
if ($tree = book_tree_recurse($node->nid, $depth - 1, $children, $unfold)) {
$linktitle['title'] = '?q=node/'. $node->nid;
$output .= '

  • '; // function showHideCat(el) { if (el != null) { el.style.display=(el.style.display=="none")?"":"none"; } }
    $output .= l($node->title, 'node/'. $node->nid, $linktitle);
    $output .= 'nid . '\');" > nid.' style="display:block">

    ';
    $output .= '

  • ';

    }
    else {
    $linktitle['title'] = '?q=node/'. $node->nid;
    $output .= '

  • '. l($node->title, 'node/'. $node->nid, $linktitle) .'
  • ';
    }
    }
    else {
    if ($tree = book_tree_recurse($node->nid, 1, $children)) {
    $linktitle['title'] = '?q=node/'. $node->nid;
    $output .= '

    ';
    }
    else {
    $linktitle['title'] = '?q=node/'. $node->nid;
    $output .= '

  • '.l($node->title, 'node/'. $node->nid, $linktitle).'
  • ';
    }
    }
    }
    }
    }

    return $output;
    }

    ----------------------------------------------------------------------

    Add expand.js in modules/jquery_update/expand.js

    function showHideCat(el)
    {
    if (el != null)
    {
    el.style.display=(el.style.display=='none')?'':'none'
    }
    }

    Hope this helps

     
     

    Drupal is a registered trademark of Dries Buytaert.