diff --git a/admin-dev/themes/template/list_action_details.tpl b/admin-dev/themes/template/list_action_details.tpl index 86801f5d8..089837598 100644 --- a/admin-dev/themes/template/list_action_details.tpl +++ b/admin-dev/themes/template/list_action_details.tpl @@ -41,27 +41,58 @@ $(document).ready(function() { context: this, async: false, success: function(data) { - if(typeof(data.use_parent_structure) == 'undefined' || (data.use_parent_structure == true)) + if (typeof(data.use_parent_structure) == 'undefined' || (data.use_parent_structure == true)) + { + if ($('#details_{$id}').parent().parent().hasClass('alt_row')) + var alt_row = true; + else + var alt_row = false; + $('#details_{$id}').parent().parent().after($('') + .append($('') + .attr('colspan', $('#details_{$id}').parent().parent().find('td').length))); $.each(data.data, function(it, row) { - if($('#details_{$id}').parent().parent().hasClass('alt_row')) - var content = $(''); - else - var content = $(''); - content.append($('')); + var content = $(''); + content.append($('')); + var first = true; + var count = 0; // Number of non-empty collum + $.each(row, function(it) + { + count++; + }); $.each(data.fields_display, function(it, line) { + console.log(it); if (typeof(row[it]) == 'undefined') - content.append($('')); + { + if (first || count == 0) + content.append($('')); + else + content.append($('')); + } else - content.append($(''+row[it]+'')); + { + console.log(first); + console.log(count); + count--; + if (first) + { + first = false; + content.append($(''+row[it]+'')); + } + else if (count == 0) + content.append($(''+row[it]+'')); + else + content.append($(''+row[it]+'')); + } }); - content.append($('')); + content.append($('')); $('#details_{$id}').parent().parent().after(content); }); + } else { - if($('#details_{$id}').parent().parent().hasClass('alt_row')) + if ($('#details_{$id}').parent().parent().hasClass('alt_row')) var content = $(''); else var content = $(''); @@ -74,7 +105,7 @@ $(document).ready(function() { }); } - if(this.opened) + if (this.opened) { $(this).find('img').attr('src', '../img/admin/more.png'); $(this).parent().parent().parent().find('.details_{$id}').hide();