$(function() {
  $('body').on('click', 'div.cell.foldable > div > h2:first-child', function() {
    var this_folded = $(this).parents('div.foldable').hasClass('folded');
    $('.foldable').addClass('folded');  // fold everything
    if (!this_folded) {
      $(this).parents('div.foldable').removeClass('folded');
    }
    return true;
  });
});
