Ticket #7055: hide_annotation_columns-r6692.diff
| File hide_annotation_columns-r6692.diff, 3.7 KB (added by cboos, 10 months ago) |
|---|
-
trac/htdocs/css/code.css
# HG changeset patch # User Christian Boos <cboos@neuf.fr> # Date 1206708016 -3600 # Node ID 496e861169de079fc5e4fd723ecf1bb3f10d6b8e # Parent fa5a3be904424e558dd86a3d9ecb4b6dc233e9ac Clicking on any annotation header column hides that column. Implements #7055 diff --git a/trac/htdocs/css/code.css b/trac/htdocs/css/code.css
a b 34 34 padding: 0 .25em; 35 35 text-align: center; 36 36 white-space: nowrap; 37 } 38 table.code thead th.content { 39 text-align: left; 40 } 41 table.code thead th.content span.recover { 42 background: #f0f0f0; 43 margin: 0 1em; 44 padding: 0 .5em; 37 45 } 38 46 table.code tbody th { 39 47 background: #eed; -
trac/htdocs/js/folding.js
diff --git a/trac/htdocs/js/folding.js b/trac/htdocs/js/folding.js
a b 23 23 }).css("cursor", "pointer"); 24 24 } 25 25 26 })(jQuery); 27 No newline at end of file 26 /** Enable columns of a table to be hidden by clicking on the column header. 27 * 28 * +------------------+------+---- ... ---+---------------------+ 29 * |column_headers[0] | ... | | column_headers[k-1] | <- ch_row 30 * +==================+======+==== ... ===+=====================+ 31 * | row_headers[0] | row_headers[1] | row_headers[1*k-1] | <- rows[0] 32 * | row_headers[k] | row_headers[k+1] | row_headers[2*k-1] | <- rows[1] 33 * ... 34 */ 35 $.fn.enableCollapsibleColumns = function(recovery_area) { 36 var ch_row = $('thead tr', this); 37 var column_headers = $('thead th', this).not(recovery_area); 38 var row_headers = $('tbody th', this); 39 var rows = $('tbody tr', this); 40 var k = column_headers.length; 41 var n = row_headers.length / k; 42 $(column_headers).each(function(j) { 43 function hide() { 44 // remove and save column 45 var th = $(this); 46 var jj = j; // th.data('j'); 47 var ths = Array(n); 48 th.remove(); 49 for ( var i = 0; i < n; i++ ) 50 ths[i] = $(row_headers[i*k+jj]).remove(); 51 // create a recovery button and its "show" callback 52 recovery_area.append($("<span></span>").addClass("recover") 53 .text("Show " + th.text() + " Info") 54 .click(function() { 55 $(this).remove(); 56 ch_row.prepend(th.click(hide)); 57 $(ths).each(function(i){rows.eq(i).prepend(this);}); 58 }) 59 ); 60 }; 61 $(this).click(hide) 62 .attr('title', $(this).attr('title') + " (click to hide column)"); 63 }); 64 } 65 66 })(jQuery); -
trac/versioncontrol/templates/browser.html
diff --git a/trac/versioncontrol/templates/browser.html b/trac/versioncontrol/templates/browser.html
a b 10 10 <title>$path</title> 11 11 <meta py:if="file and file.annotate" name="ROBOTS" content="NOINDEX, NOFOLLOW" /> 12 12 <meta py:if="dir" name="ROBOTS" content="NOINDEX" /> 13 <script type="text/javascript" src="${chrome.htdocs_location}js/folding.js"></script> 13 14 <script type="text/javascript"> 14 15 jQuery(document).ready(function($) { 15 16 $("#jumploc input").hide(); … … 27 28 range_max_secs: '$dir.range_max_secs' 28 29 }); 29 30 </py:if> 30 <py:if test="file and file.annotate"> 31 enableBlame("${href.changeset()}/", "${path}"); 31 <py:if test="file"> 32 <py:if test="file.annotate"> 33 enableBlame("${href.changeset()}/", "${path}"); 34 </py:if> 35 $('#preview table.code').enableCollapsibleColumns($('#preview table.code thead th.content')); 32 36 </py:if> 33 37 }); 34 38 </script>
