show/hide this revision's text 2 Updated CSS to work with the new UI in FogBugz 8.7.18

Based on Michel de Ruiter's Collapse Code Blocks customization I have created a script that will collapse Email Blocks. I have a handful of cases that have accumulated a large number of lengthy emails over time. I find the ability to collapse them all facilitates reviewing the updates without the pollution of long email conversations. Any individual email block can be expanded by double-clicking the collapsed header.

By default emails display as usual, but any page that contains one or more emails will include a link at the top of the Bug Event panel to collapse them down. Once a user has collapsed emails for a case the emails will appear collapsed on the next page visit. This collapsed-state recall is on a per-case basis, and only works for the current user on the current browser (due to it's implementation using cookies).

No collapse/expand option will be displayed if the case does not contain email events.

here's a [blurry, sorry] screenshot: alt text

I'm sure that there's plenty of room for improvement. I hope you find it useful.

name:          Collapse Email Blocks
description:   Collapse/expand an email block by double-clicking it
author:        Dave Cross
version:       1.0.0.2

1.0.0.3

js:

/*
Based on Collapse Code Blocks by Michel de Ruiter
http://fogbugz.stackexchange.com/questions/6395
History:
1.0.0.3 - Dave: Updated CSS to work with the new UI in FogBugz 8.7.18
                Changed bg colour of collapsed email blocks to better indicate that some text is hidden
1.0.0.2 - DaveCross: Do not collapse by default, but remember individual users' collapse settings on a per-bug basis
1.0.0.1 - DaveCross: Added an expand/collapse all option at the top of the bug history panel
*/
var ixBug = $('div.ixBug div a').text();
var sCookie = "emgfb-" + ixBug + "-collapseEmailBlocks";
// determine if user has previously specified to collapse email blocks for this case
var bCollapseEmail = $.cookie(sCookie) || false;
var sEmailBlockCollapseText = "Collapse All Email Blocks";
function CollapseEmailBlocks(bCollapse)
{
    if (bCollapse) {
        $("div.email").addClass("collapsed");
    ("div.bugevent.detailed.email").addClass("collapsed");
        $("div.bugevent.detailed.email").find(".emailHeader").addClass("collapsed");
    }
    else {
        $("div.email").removeClass("collapsed");
    ("div.bugevent.detailed.email").removeClass("collapsed");
        $("div.bugevent.detailed.email").find(".emailHeader").removeClass("collapsed");
    }
    sEmailBlockCollapseText = (bCollapse ? 'Expand All Email Blocks' : 'Collapse All Email Blocks');
}
CollapseEmailBlocks(bCollapseEmail);
$("div.email").attr("title", ("div.bugevent.detailed.email").attr("title", "Double-click to collapse/expand")
.dblclick(function() {
  $(this).toggleClass("collapsed");
  $(this).find(".emailHeader").toggleClass("collapsed");
});
/* Add a link at the top of the case history to expand/collapse all email blocks */
if ( $("div.email").length > 0 ) {
    $("span#BugEvents").prepend('<p><a id="toggleEmailBlocks" class="dotted" href="javascript:;">' + sEmailBlockCollapseText + '</a></p>');
    $("#toggleEmailBlocks").click(function() {
        bCollapseEmail = !bCollapseEmail
        CollapseEmailBlocks(bCollapseEmail);
        $(this).text(sEmailBlockCollapseText);
    if (bCollapseEmail) {
        $.cookie(sCookie, true);
    }
    else {
        // Don't set the cookie false, delete it instead - to avoid cookie proliferation
        $.cookie(sCookie, null);;
    }
    });
}


css:

div.email.collapsed {
  height: 80px66px;
  background-color: #BBB;
  overflow: hidden !important;
  cursor: default;
}
div.emailHeader.collapsed {
  background-color: #AC9C98;
}
#toggleEmailBlocks {
  font-size: 11px;
}
show/hide this revision's text 1 [made Community Wiki]

Based on Michel de Ruiter's Collapse Code Blocks customization I have created a script that will collapse Email Blocks. I have a handful of cases that have accumulated a large number of lengthy emails over time. I find the ability to collapse them all facilitates reviewing the updates without the pollution of long email conversations. Any individual email block can be expanded by double-clicking the collapsed header.

By default emails display as usual, but any page that contains one or more emails will include a link at the top of the Bug Event panel to collapse them down. Once a user has collapsed emails for a case the emails will appear collapsed on the next page visit. This collapsed-state recall is on a per-case basis, and only works for the current user on the current browser (due to it's implementation using cookies).

No collapse/expand option will be displayed if the case does not contain email events.

here's a [blurry, sorry] screenshot: alt text

I'm sure that there's plenty of room for improvement. I hope you find it useful.

name:          Collapse Email Blocks
description:   Collapse/expand an email block by double-clicking it
author:        Dave Cross
version:       1.0.0.2

js:

/*
Based on Collapse Code Blocks by Michel de Ruiter
http://fogbugz.stackexchange.com/questions/6395
History:
1.0.0.2 - Dave Cross: Do not collapse by default, but remember individual users' collapse settings on a per-bug basis
1.0.0.1 - Dave Cross: Added an expand/collapse all option at the top of the bug history panel
*/
var ixBug = $('div.ixBug div a').text();
var sCookie = "emgfb-" + ixBug + "-collapseEmailBlocks";
// determine if user has previously specified to collapse email blocks for this case
var bCollapseEmail = $.cookie(sCookie) || false;
var sEmailBlockCollapseText = "Collapse All Email Blocks";
function CollapseEmailBlocks(bCollapse)
{
    if (bCollapse) {
    $("div.email").addClass("collapsed");
    }
    else {
    $("div.email").removeClass("collapsed");
    }
    sEmailBlockCollapseText = (bCollapse ? 'Expand All Email Blocks' : 'Collapse All Email Blocks');
}
CollapseEmailBlocks(bCollapseEmail);
$("div.email").attr("title", "Double-click to collapse/expand")
.dblclick(function() {
  $(this).toggleClass("collapsed");
});
/* Add a link at the top of the case history to expand/collapse all email blocks */
if ( $("div.email").length > 0 ) {
    $("span#BugEvents").prepend('<p><a id="toggleEmailBlocks" class="dotted" href="javascript:;">' + sEmailBlockCollapseText + '</a></p>');
    $("#toggleEmailBlocks").click(function() {
    bCollapseEmail = !bCollapseEmail
    CollapseEmailBlocks(bCollapseEmail);
    $(this).text(sEmailBlockCollapseText);
    if (bCollapseEmail) {
    $.cookie(sCookie, true);
    }
    else {
    // Don't set the cookie false, delete it instead - to avoid cookie proliferation
    $.cookie(sCookie, null);;
    }
    });
}


css:

div.email.collapsed {
  height: 80px;
  background-color: #BBB;
  overflow: hidden !important;
  cursor: default;
}
#toggleEmailBlocks {
  font-size: 11px;
}