OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
feat(styling): apply changes from feedback session
as-op23fb1825361a
diff --git a/app/models/work_package/pdf_export/style.rb b/app/models/work_package/pdf_export/style.rbindex 5d264c2593e..72d155595bf 100644--- a/app/models/work_package/pdf_export/style.rb+++ b/app/models/work_package/pdf_export/style.rb@@ -114,27 +114,29 @@ module WorkPackage::PDFExport::Styleenddef toc_margins_style- { margin_bottom: 20 }- end-- def toc_item_index_style- { size: 10, style: :bold }+ { margin_top: 10, margin_bottom: 20 }end- def toc_item_subject_font_style- { size: 10 }+ def toc_item_style(level)+ if level <= 1+ { size: 10, style: :bold }+ elsif level <= 2+ { size: 10 }+ else+ { size: 9 }+ endenddef toc_item_subject_indent_style4end- def toc_item_page_nr_font_style- { size: 10 }- end-- def toc_item_margins_style- { margin_bottom: 4 }+ def toc_item_margins_style(level)+ if level === 1+ { margin_top: 4, margin_bottom: 4 }+ else+ { margin_bottom: 4 }+ endenddef wp_headline_margins_style@@ -184,6 +186,7 @@ module WorkPackage::PDFExport::Styledef wp_attributes_table_cell_style{ size: 9,text_color: "000000",+ border_color: '4B4B4B',border_widths: [0.25, 0.25, 0.25, 0.25],padding_left: 5,padding_right: 5,diff --git a/app/models/work_package/pdf_export/table_of_contents.rb b/app/models/work_package/pdf_export/table_of_contents.rbindex 5d86b770e88..54f24d1ad5c 100644--- a/app/models/work_package/pdf_export/table_of_contents.rb+++ b/app/models/work_package/pdf_export/table_of_contents.rb@@ -45,12 +45,14 @@ module WorkPackage::PDFExport::TableOfContentsdef build_toc_data_list_entry(work_package, id_wp_meta_map)level_path = id_wp_meta_map[work_package.id][:level_path]+ level = level_path.length+ style = toc_item_style(level)level_string = "#{level_path.join('.')}. "- level_string_width = measure_part_width(level_string, toc_item_index_style)+ level_string_width = measure_part_width(level_string, style)title = get_column_value work_package, :subjectpage_nr_string = (id_wp_meta_map[work_package.id][:page_number] || '000').to_s- page_nr_string_width = measure_part_width(page_nr_string, toc_item_page_nr_font_style)- { id: work_package.id, level_string:, level_string_width:, title:, page_nr_string:, page_nr_string_width: }+ page_nr_string_width = measure_part_width(page_nr_string, style)+ { id: work_package.id, level_string:, level_string_width:, title:, page_nr_string:, page_nr_string_width:, level: }enddef measure_part_width(part, style)@@ -67,17 +69,19 @@ module WorkPackage::PDFExport::TableOfContentsdef write_toc!(toc_list)max_level_string_width = toc_list.pluck(:level_string_width).maxtoc_list.each do |toc_item|- with_margin(toc_item_margins_style) do+ with_margin(toc_item_margins_style(toc_item[:level])) dowrite_toc_item! toc_item, max_level_string_widthendendenddef write_toc_item!(toc_item, max_level_width)- write_part_float(toc_item[:id], toc_item[:level_string], toc_item_index_style)- write_part_float(toc_item[:id], toc_item[:page_nr_string], toc_item_page_nr_font_style.merge({ align: :right }))+ style = toc_item_style(toc_item[:level])+ write_part_float(toc_item[:id], toc_item[:level_string], style)+ write_part_float(toc_item[:id], toc_item[:page_nr_string], style.merge({ align: :right }))+ style[:styles] = [style[:style]] if style[:style]pdf.indent(max_level_width, toc_item[:page_nr_string_width]) do- pdf.formatted_text([toc_item_subject_font_style.merge({ text: toc_item[:title] })])+ pdf.formatted_text([style.merge({ text: toc_item[:title] })])endendend