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@oxideinteractive.com.au,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.\r\n\r\nYou could use jQuery (or possibly more stream-filters?) to rewrite the table on the fly_ in order to remove the extra white-space.\r\n\r\nThe current way I'm doing this is:\r\n\r\n{{{blackmagic.py}}}\r\n{{{\r\ndef remove_field(stream _ field):\r\n    """ Removes a field from the form area"""\r\n    stream = stream | Transformer('//label[@for="field-%s"]' % field).replace(tag.span(class_='empty'))\r\n    stream = stream | Transformer('//*[@id="field-%s"]' % field).replace(tag.span(class_='empty'))\r\n    return remove_changelog(remove_header(stream _ field)_ field)\r\n}}}\r\n\r\n{{{jquery}}}\r\n{{{\r\n/*  \r\n*   Function attempts to rewrite a table to remove fields that have\r\n*   been removed during stream filtering.\r\n*   Only works for <table>_ <thead>_ <tbody> and <tfoot> tags.\r\n*   Code by Josh Godsiff_ for www.oxideinteractive.com.au\r\n*   Email: josh@oxideinteractive.com.au\r\n*/\r\n$.prototype.cleanupTable = function() {\r\n    if($(this).is('table')) {\r\n        var body = $(this).children('thead_ tbody_ tfoot');\r\n    } else if($(this).is('thead_ tbody_ tfoot')) {\r\n        var body = $(this);\r\n    } else {\r\n        return 0;\r\n    }\r\n    \r\n    var full = $(body).children('tr').filter(function() {\r\n        return $(this).children('td.fullrow').length > 0;\r\n    });\r\n    $(full).detach();\r\n    \r\n    var data = $(body).find('tr').children().filter(function() {\r\n        return ($(this).find('span.empty').length == 0 && $(this).is(':not(:empty)'));\r\n    });\r\n    \r\n    $(body).children('tr').detach();\r\n    $(body).append($(full));\r\n\r\n    $(data).each(function(ind_ val) {\r\n        if(ind % 4 == 0) {\r\n            $(body).append('<tr class="current"></tr>');\r\n        }\r\n        \r\n        var col = (ind % 4 <= 1 ? 1 : 2);\r\n        if($(this).children('span.empty').length <= 0) {\r\n            $(this).attr('class'_ 'col' + col);\r\n            $(body).find('tr.current').append($(this));\r\n        }\r\n\r\n        if(ind % 4 == 3) {\r\n            $(body).find('tr.current').removeClass('current');\r\n        }\r\n    });\r\n}\r\n\r\n$(document).ready(function() {\r\n    $('#properties table').cleanupTable();\r\n    $('table.properties').cleanupTable();\r\n});,enhancement,closed,normal,TimingAndEstimationPlugin,normal,fixed,,,0.11
