From 64e7e31dabac0e0491dffdbea2f750f9e0a54850 Mon Sep 17 00:00:00 2001 From: Stephen Tomkinson Date: Mon, 11 Nov 2024 19:55:38 +0000 Subject: [PATCH] Rolled PDF formatting and "show more" evidence feature into the main event table. --- event_tracker/static/scripts/event_table.js | 20 ++++- .../templates/event_tracker/event_list.html | 82 +++++++------------ .../event_tracker/eventstream_list.html | 1 - 3 files changed, 45 insertions(+), 58 deletions(-) diff --git a/event_tracker/static/scripts/event_table.js b/event_tracker/static/scripts/event_table.js index c407398..23aebda 100644 --- a/event_tracker/static/scripts/event_table.js +++ b/event_tracker/static/scripts/event_table.js @@ -29,9 +29,23 @@ function pdfExportCustomize(doc, config, dt) { } } - // Ensure the main text column doesn't stretch when given long content - doc.content[1].table.widths = Array(eventTableConfig.totalColumns).fill("auto") - doc.content[1].table.widths[eventTableConfig.descriptionColumn] = 400 + if (eventTableConfig.columnWidths === null) { + // Ensure the main text column doesn't stretch when given long content + doc.content[1].table.widths = Array(eventTableConfig.totalColumns).fill("auto"); + doc.content[1].table.widths[eventTableConfig.descriptionColumn] = 400; + } + else { + doc.content[1].table.widths = eventTableConfig.columnWidths; + } + + if (eventTableConfig.columnHeadings !== null) { + for (const i in eventTableConfig.columnHeadings) { + if (eventTableConfig.columnHeadings[i] !== null) { + doc.content[1].table.body[0][i].text = eventTableConfig.columnHeadings[i]; + } + } + } + // Sprinkle in some corporate branding doc.footer = function (currentPage, pageCount) { return [ diff --git a/event_tracker/templates/event_tracker/event_list.html b/event_tracker/templates/event_tracker/event_list.html index 2bba6a7..7643efb 100644 --- a/event_tracker/templates/event_tracker/event_list.html +++ b/event_tracker/templates/event_tracker/event_list.html @@ -16,6 +16,22 @@ + + + + + +