Ticket #7055: hide_annotation_columns-r6692.2.diff
| File hide_annotation_columns-r6692.2.diff, 4.6 KB (added by cboos, 10 months ago) |
|---|
-
trac/htdocs/css/code.css
# HG changeset patch # User Christian Boos <cboos@neuf.fr> # Date 1206710774 -3600 # Node ID 200f6429e7db6a8c9df028bf061b5b593fae3b0d # 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: #f7f7f7; 43 border-left: 1px solid; 44 border-right: 1px solid; 45 cursor: pointer; 46 margin: 0 1em 0 0; 47 padding: 0 .5em; 37 48 } 38 49 table.code tbody th { 39 50 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] | <- c_h_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 // column headers 37 var c_h_row = $('thead tr', this); 38 var column_headers = $('th', c_h_row).not(recovery_area); 39 var k = column_headers.length; 40 // row headers 41 var tbody = $('tbody', this); 42 var row_headers = $('th', tbody); 43 var rows = $('tr', tbody); 44 var n = row_headers.length / k; 45 46 // add a 'hide' callback to each column header 47 column_headers.each(function(j) { 48 function hide() { 49 // remove and save column j 50 var th = $(this); 51 var ths = Array(n); 52 th.remove(); 53 for ( var i = 0; i < n; i++ ) 54 ths[i] = row_headers.eq(i*k+j).remove(); 55 // create a recovery button and its "show" callback 56 recovery_area.prepend($("<span></span>").addClass("recover") 57 .text("Show " + th.text()) 58 .click(function() { 59 $(this).remove(); 60 c_h_row.prepend(th.click(hide)); 61 $(ths).each(function(i){rows.eq(i).prepend(this);}); 62 }) 63 ); 64 }; 65 $(this).click(hide) 66 .css('cursor', 'pointer') 67 .attr('title', $(this).attr('title') + " (click to hide column)"); 68 }); 69 } 70 71 })(jQuery); -
trac/templates/attachment.html
diff --git a/trac/templates/attachment.html b/trac/templates/attachment.html
a b 8 8 <xi:include href="macros.html" /> 9 9 <head> 10 10 <title>Attachment</title> 11 <py:if test="preview"> 12 <script type="text/javascript" src="${chrome.htdocs_location}js/folding.js"></script> 13 <script type="text/javascript"> 14 jQuery(document).ready(function($) { 15 $('#preview table.code').enableCollapsibleColumns($('#preview table.code thead th.content')); 16 }); 17 </script> 18 </py:if> 11 19 </head> 12 20 13 21 <body py:with="parent = attachments and attachments.parent or -
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>
