296b45e1f83d8dd8cf10184e1c70ee05ec0ac3e2 kate Tue Apr 17 09:59:17 2012 -0700 Limit hand poiner to clickable items (data items and labels). QA issue 28. Also make row construction clearer diff --git src/hg/js/encodeDataSummary.js src/hg/js/encodeDataSummary.js index c1de9e6..7c05961 100644 --- src/hg/js/encodeDataSummary.js +++ src/hg/js/encodeDataSummary.js @@ -104,63 +104,68 @@ }); } // add row highlight $('.summaryTable').delegate('.even, .odd', 'mouseover mouseleave', function (ev) { if (ev.type == 'mouseover') { $(this).addClass('rowHighlight'); } else { $(this).removeClass('rowHighlight'); } }); } function tableOut(table, types, exps, isChipSeq) { // Helper function to output tables to document - var total = 0, row = 0; + var total = 0, rowNum = 0; var dataType, antibodyTarget; - var description, term; + var description, term, row; $.each(exps, function (key, value) { types.push(key); total += parseInt(value, 10); }); types.sort(encodeProject.cmpNoCase); // lay out table $.each(types, function (i, value) { description = ''; term = ''; if (isChipSeq) { antibodyTarget = encodeProject.getAntibodyTarget(value); if (antibodyTarget !== undefined) { description = antibodyTarget.description; term = value; } } else { dataType = encodeProject.getDataTypeByLabel(value); if (dataType !== undefined) { description = dataType.description; term = dataType.term; } } // quote the end tags so HTML validator doesn't whine - $(table).append("<tr class='" + (row % 2 === 0 ? "even" : "odd") + "'><td title='" + description + "'>" + value + "<\/td><td id='" + term + "' class='dataItem' title='Click to search for " + value + " data'>" + exps[value] + "<\/td><\/tr>"); - row++; + row = "<tr class='dataRow " + (rowNum % 2 === 0 ? "even" : "odd") + "'>" + + "<td class='dataLabel' title='" + description + "'>" + value + "<\/td>" + + "<td id='" + term + "' class='dataItem' title='Click to search for " + value + + " data'>" + exps[value] + "<\/td>" + + "<\/tr>"; + $(table).append(row); + rowNum++; }); - $(".even, .odd").click(function () { + $(".dataRow").click(function () { var dataType, target, url, antibodyTarget; // NOTE: generating full search URL should be generalized & encapsulated url = encodeMatrix.getSearchUrl(encodeProject.getAssembly()); if ($(this).parents('table').attr('id') === 'tfbsTable') { target = $(this).children('.dataItem').attr('id'); url += '&hgt_mdbVar1=antibody'; antibodyTarget = encodeProject.getAntibodyTarget(target); $.each(antibodyTarget.antibodies, function (i, antibody) { url += '&hgt_mdbVal1=' + antibody; }); } else { dataType = $(this).children('.dataItem').attr('id'); url += '&hgt_mdbVar1=dataType&hgt_mdbVal1=' + dataType; } url += '&hgt_mdbVar2=view&hgt_mdbVal2=Any';