It looks to me that the line in collapsiblock.js is not behaving quite as promised.

 if (status == 3 || $.cookie('collapsiblock-' + id) == 1) {
 $(titleElt).addClass('collapsiblockCollapsed');
 $(titleElt.target).slideUp();
 }
 else {
 $.cookie('collapsiblock-' + id, 0);
 }

Cookies are going good if the block is 'expandable by default'

But If I have it 'hidden by default' to start (status 3) , the user cannot lock it open later.

I was going to try and fix it, but wasn't sure if I was going to have to contest with the difference between status=0 and status=undefined ... I't prefer using constants there for the cookie value.

It was slightly puzzling until I spent a while in firebug.

CommentFileSizeAuthor
#3 collapsiblock_cookie_stayopen.patch870 bytesdman

Comments

nedjo’s picture

Thanks for noting the issue, a fix would be welcome, as would introducing constants for the cookie values.

xstevex’s picture

Just wondering if there was a solution found to this. I really want to have all blocks collapsed by default on my site but to remember if the person opens them, rather than change back.
Steve.

dman’s picture

StatusFileSize
new870 bytes

This is still open, so I'd better fix it...
Looking at it again, I see that I don't care about undefined vs 0, and that constants are overkill, as they would have to be declared bith serverside and clientside. So here's the fix.

-      if (status == 3 || $.cookie('collapsiblock-' + id) == 1) {
+      if ((status == 3 && (! $.cookie('collapsiblock-' + id))) || $.cookie('collapsiblock-' + id) == 1) {
dman’s picture

Status: Active » Needs review

patch!

nedjo’s picture

This looks good. I haven't tested. If you have and are confident it's working, pls apply to HEAD and DRUPAL-5.

Altogether I believe the cookie approach is wrong. I'll open a separate issue for that.

nedjo’s picture

New tangentially related issue opened: http://drupal.org/node/210958

dman’s picture

Status: Needs review » Fixed

OK.I got that (slightly modified) into HEAD and DRUPAL-5
I'd missed the earlier changes for that active menu exposer, but caught the difference on the fresh check-outs.

Works on my test...

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.