From: Coleman Watts Date: Sat, 22 Mar 2014 23:48:28 +0000 (-0400) Subject: CaseView - Keep the state of accordions when refreshing X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=ca0de7b521c5de49acfceb18feda439a3ba27b48;p=civicrm-core.git CaseView - Keep the state of accordions when refreshing --- diff --git a/templates/CRM/Case/Form/CaseView.js b/templates/CRM/Case/Form/CaseView.js index 6a9e8ea66d..3d98231295 100644 --- a/templates/CRM/Case/Form/CaseView.js +++ b/templates/CRM/Case/Form/CaseView.js @@ -215,6 +215,27 @@ }); return false; }); + $().crmAccordions(); + + // Keep the state of accordions when refreshing + var accordionStates = []; + $('#crm-main-content-wrapper') + .on('crmBeforeLoad', function(e) { + if ($(e.target).is(this)) { + accordionStates = []; + $('.crm-accordion-wrapper', this).each(function() { + accordionStates.push($(this).hasClass('collapsed')); + }); + } + }) + .on('crmLoad', function(e) { + if ($(e.target).is(this)) { + var $targets = $('.crm-accordion-wrapper', this); + $.each(accordionStates, function(i, isCollapsed) { + $targets.eq(i).toggleClass('collapsed', isCollapsed); + }); + } + }); }); }(cj, CRM))