﻿id	summary	reporter	owner	description	type	status	priority	component	severity	resolution	keywords	cc	release
7025	Rewrite ticket properties table on-the-fly to remove whitespace left from stream filtering	josh@…	bobbysmith007	"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:

{{{blackmagic.py}}}
{{{
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)
}}}

{{{jquery}}}
{{{
/*  
*   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 www.oxideinteractive.com.au
*   Email: josh@oxideinteractive.com.au
*/
$.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;
    });
    $(full).detach();
    
    var data = $(body).find('tr').children().filter(function() {
        return ($(this).find('span.empty').length == 0 && $(this).is(':not(:empty)'));
    });
    
    $(body).children('tr').detach();
    $(body).append($(full));

    $(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);
            $(body).find('tr.current').append($(this));
        }

        if(ind % 4 == 3) {
            $(body).find('tr.current').removeClass('current');
        }
    });
}

$(document).ready(function() {
    $('#properties table').cleanupTable();
    $('table.properties').cleanupTable();
});"	enhancement	closed	normal	TimingAndEstimationPlugin	normal	fixed			0.11
