Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#7025 closed enhancement (fixed)

Rewrite ticket properties table on-the-fly to remove whitespace left from stream filtering

Reported by: josh@… Owned by: bobbysmith007
Priority: normal Component: TimingAndEstimationPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11


Currently, when you remove fields using stream-filters and permissions, the empty table-cell gets left behind, leaving a lot of ugly white-space.

You could use jQuery (or possibly more stream-filters?) to rewrite the table on the fly, in order to remove the extra white-space.

The current way I'm doing this is:

def remove_field(stream , field):
    """ Removes a field from the form area"""
    stream = stream | Transformer('//label[@for="field-%s"]' % field).replace(tag.span(class_='empty'))
    stream = stream | Transformer('//*[@id="field-%s"]' % field).replace(tag.span(class_='empty'))
    return remove_changelog(remove_header(stream , field), field)


*   Function attempts to rewrite a table to remove fields that have
*   been removed during stream filtering.
*   Only works for <table>, <thead>, <tbody> and <tfoot> tags.
*   Code by Josh Godsiff, for
*   Email:
$.prototype.cleanupTable = function() {
    if($(this).is('table')) {
        var body = $(this).children('thead, tbody, tfoot');
    } else if($(this).is('thead, tbody, tfoot')) {
        var body = $(this);
    } else {
        return 0;
    var full = $(body).children('tr').filter(function() {
        return $(this).children('td.fullrow').length > 0;
    var data = $(body).find('tr').children().filter(function() {
        return ($(this).find('span.empty').length == 0 && $(this).is(':not(:empty)'));

    $(data).each(function(ind, val) {
        if(ind % 4 == 0) {
            $(body).append('<tr class="current"></tr>');
        var col = (ind % 4 <= 1 ? 1 : 2);
        if($(this).children('span.empty').length <= 0) {
            $(this).attr('class', 'col' + col);

        if(ind % 4 == 3) {

$(document).ready(function() {
    $('#properties table').cleanupTable();

Attachments (0)

Change History (3)

comment:1 Changed 4 years ago by bobbysmith007

I will try to incorporate this into the plugin soon, thanks for your input

comment:2 Changed 4 years ago by bobbysmith007

  • Resolution set to fixed
  • Status changed from new to closed

(In [8262]) Added a whitespace cleaner (from Josh Godsiff - thanks!) to the ticket page to remove extra whitespace, and fixed csv exports in permissions branch. ver 1.0.5 - fix #7354 and #7025

comment:3 Changed 4 years ago by bobbysmith007

Sorry it took me a while to get to this. I added you to the authors list in Thanks much for the patch!

Add Comment

Modify Ticket

as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from bobbysmith007. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.