diff --git a/lib/open_project/pdf_export/export_card/card_element.rb b/lib/open_project/pdf_export/export_card/card_element.rb index adc9d02c9e..df937e62a7 100644 --- a/lib/open_project/pdf_export/export_card/card_element.rb +++ b/lib/open_project/pdf_export/export_card/card_element.rb @@ -30,6 +30,7 @@ module OpenProject::PdfExport::ExportCard heights = assign_row_heights(rows) text_padding = @orientation[:text_padding] + group_padding = @orientation[:group_padding] current_row = 0 current_y_offset = text_padding @@ -44,7 +45,8 @@ module OpenProject::PdfExport::ExportCard width: @orientation[:width], height: group_height, row_heights: row_heights, - text_padding: text_padding + text_padding: text_padding, + group_padding: group_padding } @group_elements << GroupElement.new(@pdf, group_orientation, g_value, @work_package) @@ -74,9 +76,8 @@ module OpenProject::PdfExport::ExportCard def reduce_low_priority_rows(rows, assigned_heights, diffs, conflicted_i) # Get an array of row indexes sorted by inverse priority - # TODO RS: The priority should be on the row, not the column priorities = *(0..rows.count - 1) - .zip(rows.map { |k, v| first_column_property(v, "priority") or 10 }) + .zip(rows.map { |k, v| v["priority"] or 10 }) .sort {|x,y| y[1] <=> x[1]} .map {|x| x[0]} diff --git a/lib/open_project/pdf_export/export_card/document_generator.rb b/lib/open_project/pdf_export/export_card/document_generator.rb index 4a68fd4a30..c304d1174a 100644 --- a/lib/open_project/pdf_export/export_card/document_generator.rb +++ b/lib/open_project/pdf_export/export_card/document_generator.rb @@ -38,6 +38,7 @@ module OpenProject::PdfExport::ExportCard def render_pages card_padding = 10 + group_padding = 5 text_padding = 5 card_width = pdf.bounds.width - (card_padding * 2) card_height = ((pdf.bounds.height - (card_padding * config.per_page )) / config.per_page) - (card_padding / config.per_page) @@ -50,6 +51,7 @@ module OpenProject::PdfExport::ExportCard width: card_width, height: card_height, card_padding: card_padding, + group_padding: group_padding, text_padding: text_padding } diff --git a/lib/open_project/pdf_export/export_card/group_element.rb b/lib/open_project/pdf_export/export_card/group_element.rb index 4bccbea163..4688d12be6 100644 --- a/lib/open_project/pdf_export/export_card/group_element.rb +++ b/lib/open_project/pdf_export/export_card/group_element.rb @@ -11,7 +11,7 @@ module OpenProject::PdfExport::ExportCard @work_package = work_package @row_elements = [] - current_y_offset = 0 # OR text padding? + current_y_offset = 0 row_heights = @orientation[:row_heights] @rows_config.each_with_index do |(r_key, r_value), i| @@ -19,7 +19,7 @@ module OpenProject::PdfExport::ExportCard row_orientation = { y_offset: @orientation[:height] - current_y_offset, x_offset: 0, - width: @orientation[:width], + width: @orientation[:width] - (@orientation[:group_padding] * 2), height: row_heights[i], text_padding: @orientation[:text_padding] } @@ -29,8 +29,10 @@ module OpenProject::PdfExport::ExportCard end def draw - top_left = [@orientation[:x_offset], @orientation[:y_offset]] + padding = @orientation[:group_padding] + top_left = [@orientation[:x_offset] + padding, @orientation[:y_offset]] bounds = @orientation.slice(:width, :height) + bounds[:width] -= padding * 2 @pdf.bounding_box(top_left, bounds) do @pdf.stroke_color '000000' @@ -40,7 +42,9 @@ module OpenProject::PdfExport::ExportCard row.draw end - @pdf.stroke_bounds + if (@config["has_border"] or false) + @pdf.stroke_bounds + end end end