Allow Blockbar to be expanded by default.
cosmicdreams - February 23, 2006 - 23:37
| Project: | Block Bar |
| Version: | 4.7.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | reviewed & tested by the community |
Description
Thank you for this space saving module. Is there a way to make individual panels within the blockbar expanded by default? If not I'd like to request that feature.

#1
I am also looking for such feature. Make some block bar entries expanded by default would be a great thing.
#2
Here's a patch to:
- Allow for open by default option (note that using this with "Open one panel at a time" will act strangley, not surprisingly)
- Work with js disabled (and be a little closer to the new js methods of 4.7)
Needs some work, but seems to work OK (for me at least)
#3
Tried this, it does seem to work for me.
Many thanks.
However, the arrow icon is always shown as "expanded" when viewed with Javascript enabled (the toggling open/closed works).
Haven't quite put my finger on why, will investigate further when get a chance.
#4
Update : tried it again (no change from before...); this time it went haywire, icons were changing (but showing the wrong state), blockbars were fully open even though the option wasn't selected... maybe its my bad manual patching - gone back to normal version for now!
#5
Thanks for the patch kiz_0987. Would it be possible to break the patch up into two parts (one for the open by defatul and one for handling the disabled JS)? This would make it easier to review the code and test it.
#6
I couldn't get the patch to work. Does anyone have a working patched module they'd be willing to share? Better yet, could this fix be put into the official version? :)
This is something I really need. Having the site start out with all the menus closed is really confusing to my not-computer-geek users. :(
Thanks,
Michelle
#7
I am also looking for this fix.
the patch above, i tried and i didnt really notice any changes.
thanks.
www.americanlocalnews.com
#8
Same here. I pathced the files (the 2d hunk failed for blockbar.modules, i had to patch manually) but i notice no change at all.
I dont have time to look in this for now, but this feature is a 'must have', since we cant block acces to blocks to user not having javascript.
Thanks
Charly
#9
To force all blockbars to default to open (will not remember state from page to page):
Change line 69 in blockbar.module:
$output .= '<div class="blockbar-content blockbar-'. $blockbar_num .'-content" id="' . $panel_id . '" style="display:none;">';to:
$output .= '<div class="blockbar-content blockbar-'. $blockbar_num .'-content" id="' . $panel_id . '" style="display:block;">';The "Sticky Panels" and "Open one panel at a time" options also won't work if you do this (but they won't cause errors either, regardless of how they are set).
This is just a butt-brutal hack for if you want all block bars to default to open on every page, but allow users to collapse them (again, the state isn't remembered from page to page either).
#10
I second (or third, or fourth?) this. This would be a vitally important patch for some of my sites too.
Willing to help with debugging if someone wants to work on the patch.
Regards
Patrick
#11
Patrick, the patch I provided above is still approximately valid. You cannot use the patch on the latest CVS, but the differences are not that large. I have attached my version here for you to try.
You will notice that some people seem to have had issues with it. I still suggest that you try it -- in at least one case above the error was actually due to not setting the parameters (there is a new parameter in the block settings) rather than a problem with the module.
I do not have time to patch to the latest CVS version at the moment unfortunately. Any help you can provide is appreciated.
#12
Kiz,
Thanks for clarifying that - I certainly will try it - I'm not currently using Drupal-CVS anyway, I'm on 4.7.2 on the site that I intend to try this on. Do you want feedback after I've tried it?
Regards
Patrick
#13
Thanks Patrick -- yes, please provide feedback.
Note that I was refering to the CVS (and maybe 4.7) version of blockbar.module that the patch will fail with, not the CVS version of Drupal.
#14
Kiz,
Sorry for the long delay there - got wrapped up in other things.
I can confirm that this patch does work with Drupal 4.7.2.
Unfortunately (for me!), it's not quite what I wanted to achieve. I wanted only one panel within a blockbar to be open by default, not all of them. Any help with achieving this would be appreciated.
Regards
Patrick
#15
I can also confirm that this patch does work with Drupal 4.7.4.
#16
I have a much simpler solution. Fully tested and working - with minimum footprint of changes.
The only change is to blockbar_save_state function in blockbar.js, that saves cookie only if the state is changed compared to default. Default state is indicated in overridden theming function by adding an extra attribute to blockbar content div: default="expand"
Attached is the modified JS file (sorry not sure how to make a patch).
#17
Thanks for the "patch"
I tried updating the blockbar.js but I am not sure what you mean by
Can you please elaborate
Cheers
#18
When you override your blockbar theming function drop
default="expand"code inside the block content DIV. That is wherestyle="display:none;"is now. Try and experiment, I do not have time to support this right now...#19
I simply added this
$output .= '<noscript><div class="blockbar-content blockbar-'. $blockbar_num .'-content" id="' . $panel_id . '" style="display:block;">';$output .= $block->content;
$output .= '</div></noscript>';
to theme_blockbar_build_panels() in blockbar.module right before returnung $output. This will display all blocks open if javascript is disabled. The source of the page will contain the block content twice, though, once in a hidden div and once in a display:block div. On the other hand, it's an easy fix.