From fb13a338e9a1bc869726b9538d865bd618ba287c Mon Sep 17 00:00:00 2001
From: Marco Clemencic <marco.clemencic@cern.ch>
Date: Mon, 14 Nov 2011 13:06:51 +0100
Subject: [PATCH] allow to flag fields in the HTML test output for auto
 expansion

Added the possibility of flagging some fields in the HTML test result
to be automatically expanded if the test is expanded. Currently it
happens only for "output_diff", but should be enabled for other cases
depending on the causes.
---
 GaudiPolicy/doc/release.notes                     |  4 ++++
 GaudiPolicy/qmtest_classes/html_report/scripts.js | 13 ++++++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/GaudiPolicy/doc/release.notes b/GaudiPolicy/doc/release.notes
index 6dbff401c4..872e6c1083 100644
--- a/GaudiPolicy/doc/release.notes
+++ b/GaudiPolicy/doc/release.notes
@@ -8,6 +8,10 @@ package manager: Marco Clemencic
 ! 2011-12-13 - Marco Clemencic
  - Removed POOL from the list of *VERS variables (old Doxygen settings).
  - Moved the genConf directories of the packages inside the binary directory.
+ - Added the possibility of flagging some fields in the HTML test result to be
+   automatically expanded if the test is expanded. Currently it happens only
+   for "output_diff", but should be enabled for other cases depending on the
+   causes.
 
 ! 2011-12-07 - Marco Clemencic
  - Enforce the use of Boost Filesystem Version 3 also with Boost 1.44, for
diff --git a/GaudiPolicy/qmtest_classes/html_report/scripts.js b/GaudiPolicy/qmtest_classes/html_report/scripts.js
index 7e862b7d40..f3a3254bfa 100644
--- a/GaudiPolicy/qmtest_classes/html_report/scripts.js
+++ b/GaudiPolicy/qmtest_classes/html_report/scripts.js
@@ -109,6 +109,8 @@ function foldingAction() {
     if (me.hasClass('folded')) {
  	   me.next().slideDown();
  	   me.find('img').attr('src', 'minus.png');
+ 	   // show all the sub elements that are folded and flagged as auto_show
+ 	   $(".auto_show > span.folded", me.next()).click();
     } else {
  	   me.next().slideUp();
  	   me.find('img').attr('src', 'plus.png');
@@ -141,7 +143,7 @@ jQuery.fn.loader = function() {
       if (me.data("url")) { // modify the element only if it does have a data "url"
 	  me.addClass("foldable").prepend('<img src="plus.png"/>&nbsp;')
 	      // wrap the "text" of the element with a clickable span that loads the url
-	      .wrapInner($("<span class='clickable'/>")
+	      .wrapInner($("<span class='clickable folded'/>")
 			 .click(function(){ // trigger the loading on click
 				 var me = $(this);
 				 me.after($("<div/>").hide().load(me.parent().data("url"),
@@ -151,6 +153,7 @@ jQuery.fn.loader = function() {
 					   .prev()
 					   .unbind("click") // replace the click handler
 					   .click(foldingAction)
+					   .toggleClass("folded") // flag it as unfolded
 					   .find('img').attr('src', 'minus.png');
 				 	}));
 				 return false; // avoid bubbling of the event
@@ -226,8 +229,12 @@ jQuery.fn.results = function(tests, ignore_fields, fields_order) {
 
 		var fields = $("<ul class='fieldid'/>");
 		$.each(field_ids, function(index, field) {
-			fields.append($("<li/>").data("url", test.id + "/" + field)
-					.text(field));
+			var f = $("<li/>").data("url", test.id + "/" + field)
+				.text(field);
+			if (field == "GaudiTest.output_diff") {
+				f.addClass("auto_show");
+			}
+			fields.append(f);
 		});
 		entry.append(fields);
 		ul.append(entry);
-- 
GitLab