Skip to content

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

use dedicated yml styles for export instead one for all

as-op32a7fb47a130
diff --git a/app/models/work_package/pdf_export/common/common.rb b/app/models/work_package/pdf_export/common/common.rb
index 5d2ccd6cd78..ec2ec4efb73 100644
--- a/app/models/work_package/pdf_export/common/common.rb
+++ b/app/models/work_package/pdf_export/common/common.rb
@@ -237,6 +237,18 @@ module WorkPackage::PDFExport::Common::Common
false
end
+ def get_column_value(work_package, column_name)
+ formatter = formatter_for(column_name, :pdf)
+ formatter.format(work_package)
+ end
+
+ def get_formatted_value(value, column_name)
+ return "" if value.nil?
+
+ formatter = formatter_for(column_name, :pdf)
+ formatter.format_value(value, {})
+ end
+
def hyphenation_enabled
ActiveModel::Type::Boolean.new.cast(options[:hyphenation])
end
@@ -274,4 +286,24 @@ module WorkPackage::PDFExport::Common::Common
is_first_on_page = pdf.bounds.absolute_top - pdf.y < 10
pdf.start_new_page unless is_first_on_page
end
+
+ def write_optional_page_break
+ space_from_bottom = pdf.y - pdf.bounds.bottom
+ if space_from_bottom < styles.page_break_threshold
+ pdf.start_new_page
+ end
+ end
+
+ def make_link_href_cell(href, caption)
+ "<color rgb='#{styles.link_color}'><link href='#{href}'>#{caption}</link></color>"
+ end
+
+ def get_id_column_cell(work_package, value)
+ href = url_helpers.work_package_url(work_package)
+ make_link_href_cell(href, value)
+ end
+
+ def get_subject_column_cell(work_package, value)
+ make_link_anchor(work_package.id, escape_tags(value))
+ end
end
diff --git a/app/models/work_package/pdf_export/common/styles.rb b/app/models/work_package/pdf_export/common/styles.rb
new file mode 100644
index 00000000000..1ea20eab8a6
--- /dev/null
+++ b/app/models/work_package/pdf_export/common/styles.rb
@@ -0,0 +1,134 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+module WorkPackage::PDFExport::Common::Styles
+ def initialize(yml)
+ @styles = yml.deep_symbolize_keys
+ end
+
+ def page_size
+ @styles[:page_size] || "A4"
+ end
+
+ def page_header_offset
+ resolve_pt(@styles.dig(:page_header, :offset), 20)
+ end
+
+ def page_footer_offset
+ resolve_pt(@styles.dig(:page_footer, :offset), -30)
+ end
+
+ def page_footer_horizontal_spacing
+ resolve_pt(@styles.dig(:page_footer, :spacing), 6)
+ end
+
+ def page_logo_height
+ resolve_pt(@styles.dig(:page_logo, :height), 20)
+ end
+
+ def page_logo_align
+ @styles.dig(:page_logo, :align) || :right
+ end
+
+ def page_margin_top
+ resolve_pt(@styles.dig(:page, :margin_top), 60)
+ end
+
+ def page_margin_left
+ resolve_pt(@styles.dig(:page, :margin_left), 50)
+ end
+
+ def page_margin_right
+ resolve_pt(@styles.dig(:page, :margin_right), 50)
+ end
+
+ def page_margin_bottom
+ resolve_pt(@styles.dig(:page, :margin_bottom), 60)
+ end
+
+ def page_heading
+ resolve_font(@styles[:page_heading])
+ end
+
+ def page_heading_margins
+ resolve_margin(@styles[:page_heading])
+ end
+
+ def page_header
+ resolve_font(@styles[:page_header])
+ end
+
+ def page_footer
+ resolve_font(@styles[:page_footer])
+ end
+
+ def page_break_threshold
+ resolve_pt(@styles.dig(:page, :page_break_threshold), 200)
+ end
+
+ def link_color
+ @styles.dig(:page, :link_color) || "000000"
+ end
+
+ protected
+
+ def resolve_pt(value, default)
+ parse_pt(value) || default
+ end
+
+ def resolve_table_cell(style)
+ # prawn.table.make_cell does use differently named options
+ # so to have them specified consistently, we map here
+ opts = opts_table_cell(style || {})
+ font_styles = opts.delete(:styles) || []
+ opts[:font_style] = font_styles[0] unless font_styles.empty?
+ color = opts.delete(:color)
+ opts[:text_color] = color unless color.nil?
+ opts
+ end
+
+ def resolve_markdown_styling(style)
+ page = style.delete(:font)
+ style[:page] = page unless page.nil?
+ style
+ end
+
+ def resolve_font(style)
+ opts_font(style || {})
+ end
+
+ def resolve_margin(style)
+ opts_margin(style || {})
+ end
+
+ def resolve_padding(style)
+ opts_padding(style || {})
+ end
+end
diff --git a/app/models/work_package/pdf_export/common/view.rb b/app/models/work_package/pdf_export/common/view.rb
index 8adc723fc04..6e6b2436dbb 100644
--- a/app/models/work_package/pdf_export/common/view.rb
+++ b/app/models/work_package/pdf_export/common/view.rb
@@ -1,3 +1,4 @@
+# frozen_string_literal: true
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
diff --git a/app/models/work_package/pdf_export/export/attributes_by_form.rb b/app/models/work_package/pdf_export/export/attributes_by_form.rb
deleted file mode 100644
index ecd00b3c36a..00000000000
--- a/app/models/work_package/pdf_export/export/attributes_by_form.rb
+++ /dev/null
@@ -1,91 +0,0 @@
-module WorkPackage::PDFExport::Export::AttributesByForm
- def write_attributes_tables!(work_package)
- rows = attribute_table_rows(work_package)
- return if rows.empty?
-
- with_margin(styles.wp_attributes_table_margins) do
- pdf.table(
- rows,
- column_widths: attributes_table_column_widths,
- cell_style: styles.wp_attributes_table_cell.merge({ inline_format: true })
- )
- end
- end
-
- private
-
- def attributes_table_column_widths
- # calculate fixed work package attribute table columns width
- widths = [1.5, 2.0, 1.5, 2.0] # label | value | label | value
- ratio = pdf.bounds.width / widths.sum
- widths.map { |w| w * ratio }
- end
-
- def attribute_table_rows(work_package)
- list = attribute_data_list(work_package)
- 0.step(list.length - 1, 2).map do |i|
- build_columns_table_cells(list[i]) +
- build_columns_table_cells(list[i + 1])
- end
- end
-
- def attribute_data_list(work_package)
- column_entries(%i[id type status])
- .concat(form_configuration_columns(work_package))
- .map { |entry| entry.merge({ value: get_column_value_cell(work_package, entry[:name]) }) }
- end
-
- def form_configuration_columns(work_package)
- work_package
- .type.attribute_groups
- .filter { |group| group.is_a?(Type::AttributeGroup) }
- .map do |group|
- group.attributes.map do |form_key|
- form_key_to_column_entries(form_key.to_sym, work_package)
- end
- end.flatten
- end
-
- def form_key_custom_field_to_column_entries(form_key, work_package)
- id = form_key.to_s.sub("custom_field_", "").to_i
- cf = CustomField.find_by(id:)
- return [] if cf.nil? || cf.formattable?
-
- return [] unless cf.is_for_all? || work_package.project.work_package_custom_field_ids.include?(cf.id)
-
- [{ label: cf.name || form_key, name: form_key.to_s.sub("custom_field_", "cf_") }]
- end
-
- def form_key_to_column_entries(form_key, work_package)
- if CustomField.custom_field_attribute? form_key
- return form_key_custom_field_to_column_entries(form_key, work_package)
- end
-
- if form_key == :date
- column_entries(%i[start_date due_date duration])
- elsif form_key == :bcf_thumbnail
- []
- else
- column_name = ::API::Utilities::PropertyNameConverter.to_ar_name(form_key, context: work_package)
- [column_entry(column_name)]
- end
- end
-
- def column_entries(column_names)
- column_names.map { |key| column_entry(key) }
- end
-
- def column_entry(column_name)
- { label: WorkPackage.human_attribute_name(column_name), name: column_name }
- end
-
- def build_columns_table_cells(attribute_data)
- return ["", ""] if attribute_data.nil?
-
- # get work package attribute table cell data: [label, value]
- [
- pdf.make_cell(attribute_data[:label].upcase, styles.wp_attributes_table_label_cell),
- attribute_data[:value]
- ]
- end
-end
diff --git a/app/models/work_package/pdf_export/export/export_common.rb b/app/models/work_package/pdf_export/export/export_common.rb
deleted file mode 100644
index 64671d55746..00000000000
--- a/app/models/work_package/pdf_export/export/export_common.rb
+++ /dev/null
@@ -1,98 +0,0 @@
-# frozen_string_literal: true
-
-#-- copyright
-# OpenProject is an open source project management software.
-# Copyright (C) the OpenProject GmbH
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License version 3.
-#
-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-# Copyright (C) 2006-2013 Jean-Philippe Lang
-# Copyright (C) 2010-2013 the ChiliProject Team
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# See COPYRIGHT and LICENSE files for more details.
-#++
-
-module WorkPackage::PDFExport::Export::ExportCommon
- def write_optional_page_break
- space_from_bottom = pdf.y - pdf.bounds.bottom
- if space_from_bottom < styles.page_break_threshold
- pdf.start_new_page
- end
- end
-
- def make_link_href_cell(href, caption)
- "<color rgb='#{styles.link_color}'><link href='#{href}'>#{caption}</link></color>"
- end
-
- def get_column_value_cell(work_package, column_name)
- value = get_column_value(work_package, column_name)
- return get_id_column_cell(work_package, value) if column_name == :id
- return get_subject_column_cell(work_package, value) if wants_report? && column_name == :subject
-
- escape_tags(value)
- end
-
- def get_id_column_cell(work_package, value)
- href = url_helpers.work_package_url(work_package)
- make_link_href_cell(href, value)
- end
-
- def get_subject_column_cell(work_package, value)
- make_link_anchor(work_package.id, escape_tags(value))
- end
-
- def get_column_value(work_package, column_name)
- formatter = formatter_for(column_name, :pdf)
- formatter.format(work_package)
- end
-
- def get_formatted_value(value, column_name)
- return "" if value.nil?
-
- formatter = formatter_for(column_name, :pdf)
- formatter.format_value(value, {})
- end
-
- def with_sums_table?
- query.display_sums?
- end
-
- def wants_report?
- options[:pdf_export_type] == "report"
- end
-
- def wants_gantt?
- options[:pdf_export_type] == "gantt"
- end
-
- def get_total_sums
- query.display_sums? ? (query.results.all_total_sums || {}) : {}
- end
-
- def get_group_sums(group)
- @group_sums ||= query.results.all_group_sums
- @group_sums[group] || {}
- end
-
- def get_groups
- query.results.work_package_count_by_group
- .select { |_, count| count > 0 }
- .map { |group, _| group }
- end
-end
diff --git a/app/models/work_package/pdf_export/export/attributes_by_columns.rb b/app/models/work_package/pdf_export/export/report/attributes.rb
similarity index 54%
rename from app/models/work_package/pdf_export/export/attributes_by_columns.rb
rename to app/models/work_package/pdf_export/export/report/attributes.rb
index b98bf31f51d..774726ef598 100644
--- a/app/models/work_package/pdf_export/export/attributes_by_columns.rb
+++ b/app/models/work_package/pdf_export/export/report/attributes.rb
@@ -1,4 +1,34 @@
-module WorkPackage::PDFExport::Export::AttributesByColumns
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+module WorkPackage::PDFExport::Export::Report::Attributes
def write_attributes_tables!(work_package)
rows = attribute_table_rows(work_package)
return if rows.empty?
diff --git a/app/models/work_package/pdf_export/export/overview_table.rb b/app/models/work_package/pdf_export/export/report/overview_table.rb
similarity index 99%
rename from app/models/work_package/pdf_export/export/overview_table.rb
rename to app/models/work_package/pdf_export/export/report/overview_table.rb
index 10405fb87c6..75f6585a6c3 100644
--- a/app/models/work_package/pdf_export/export/overview_table.rb
+++ b/app/models/work_package/pdf_export/export/report/overview_table.rb
@@ -28,7 +28,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-module WorkPackage::PDFExport::Export::OverviewTable
+module WorkPackage::PDFExport::Export::Report::OverviewTable
def write_work_packages_overview!(work_packages)
if query.grouped?
write_grouped!(work_packages)
diff --git a/app/models/work_package/pdf_export/export/schema.json b/app/models/work_package/pdf_export/export/report/schema.json
similarity index 100%
rename from app/models/work_package/pdf_export/export/schema.json
rename to app/models/work_package/pdf_export/export/report/schema.json
diff --git a/app/models/work_package/pdf_export/export/standard.yml b/app/models/work_package/pdf_export/export/report/standard.yml
similarity index 98%
rename from app/models/work_package/pdf_export/export/standard.yml
rename to app/models/work_package/pdf_export/export/report/standard.yml
index 90bb690fe34..04152364426 100644
--- a/app/models/work_package/pdf_export/export/standard.yml
+++ b/app/models/work_package/pdf_export/export/report/standard.yml
@@ -212,7 +212,10 @@ work_package:
cell:
size: 8
border_width: 0.25
- padding: 5
+ padding_right: 5
+ padding_top: 0
+ padding_left: 0
+ padding_bottom: 5
alerts:
NOTE:
border_color: '0969da'
diff --git a/app/models/work_package/pdf_export/export/style.rb b/app/models/work_package/pdf_export/export/report/styles.rb
similarity index 72%
rename from app/models/work_package/pdf_export/export/style.rb
rename to app/models/work_package/pdf_export/export/report/styles.rb
index 8e419713890..ed789a2f196 100644
--- a/app/models/work_package/pdf_export/export/style.rb
+++ b/app/models/work_package/pdf_export/export/report/styles.rb
@@ -28,80 +28,13 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-module WorkPackage::PDFExport::Export::Style
+module WorkPackage::PDFExport::Export::Report::Styles
include MarkdownToPDF::StyleValidation
class PDFStyles
include MarkdownToPDF::Common
include MarkdownToPDF::StyleHelper
-
- def initialize(yml)
- @styles = yml.deep_symbolize_keys
- end
-
- def page_size
- @styles[:page_size] || "A4"
- end
-
- def page_header_offset
- resolve_pt(@styles.dig(:page_header, :offset), 20)
- end
-
- def page_footer_offset
- resolve_pt(@styles.dig(:page_footer, :offset), -30)
- end
-
- def page_footer_horizontal_spacing
- resolve_pt(@styles.dig(:page_footer, :spacing), 6)
- end
-
- def page_logo_height
- resolve_pt(@styles.dig(:page_logo, :height), 20)
- end
-
- def page_logo_align
- @styles.dig(:page_logo, :align) || :right
- end
-
- def page_margin_top
- resolve_pt(@styles.dig(:page, :margin_top), 60)
- end
-
- def page_margin_left
- resolve_pt(@styles.dig(:page, :margin_left), 50)
- end
-
- def page_margin_right
- resolve_pt(@styles.dig(:page, :margin_right), 50)
- end
-
- def page_margin_bottom
- resolve_pt(@styles.dig(:page, :margin_bottom), 60)
- end
-
- def page_heading
- resolve_font(@styles[:page_heading])
- end
-
- def page_heading_margins
- resolve_margin(@styles[:page_heading])
- end
-
- def page_header
- resolve_font(@styles[:page_header])
- end
-
- def page_footer
- resolve_font(@styles[:page_footer])
- end
-
- def page_break_threshold
- resolve_pt(@styles.dig(:page, :page_break_threshold), 200)
- end
-
- def link_color
- @styles.dig(:page, :link_color) || "000000"
- end
+ include WorkPackage::PDFExport::Common::Styles
def overview_group_header
resolve_font(@styles.dig(:overview, :group_heading))
@@ -272,41 +205,6 @@ module WorkPackage::PDFExport::Export::Style
def cover_hero_subheading_max_height
resolve_pt(@styles.dig(:cover, :hero, :subheading, :max_height), 30)
end
-
- private
-
- def resolve_pt(value, default)
- parse_pt(value) || default
- end
-
- def resolve_table_cell(style)
- # prawn.table.make_cell does use differently named options
- # so to have them specified consistently, we map here
- opts = opts_table_cell(style || {})
- font_styles = opts.delete(:styles) || []
- opts[:font_style] = font_styles[0] unless font_styles.empty?
- color = opts.delete(:color)
- opts[:text_color] = color unless color.nil?
- opts
- end
-
- def resolve_markdown_styling(style)
- page = style.delete(:font)
- style[:page] = page unless page.nil?
- style
- end
-
- def resolve_font(style)
- opts_font(style || {})
- end
-
- def resolve_margin(style)
- opts_margin(style || {})
- end
-
- def resolve_padding(style)
- opts_padding(style || {})
- end
end
def styles
diff --git a/app/models/work_package/pdf_export/export/sums_table.rb b/app/models/work_package/pdf_export/export/report/sums_table.rb
similarity index 91%
rename from app/models/work_package/pdf_export/export/sums_table.rb
rename to app/models/work_package/pdf_export/export/report/sums_table.rb
index 59c22e467c9..595eebe3cdf 100644
--- a/app/models/work_package/pdf_export/export/sums_table.rb
+++ b/app/models/work_package/pdf_export/export/report/sums_table.rb
@@ -28,7 +28,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-module WorkPackage::PDFExport::Export::SumsTable
+module WorkPackage::PDFExport::Export::Report::SumsTable
def write_work_packages_sums!(_work_packages)
return unless has_summable_column?
@@ -97,6 +97,17 @@ module WorkPackage::PDFExport::Export::SumsTable
build_sums_row(get_group_sums(group), make_group_label(group), styles.overview_table_cell)
end
+ def get_group_sums(group)
+ @group_sums ||= query.results.all_group_sums
+ @group_sums[group] || {}
+ end
+
+ def get_groups
+ query.results.work_package_count_by_group
+ .select { |_, count| count > 0 }
+ .map { |group, _| group }
+ end
+
def build_sums_total_row
build_sums_row(get_total_sums || {}, I18n.t("js.label_sum"), styles.overview_table_sums_cell)
end
diff --git a/app/models/work_package/pdf_export/export/table_of_contents.rb b/app/models/work_package/pdf_export/export/report/table_of_contents.rb
similarity index 98%
rename from app/models/work_package/pdf_export/export/table_of_contents.rb
rename to app/models/work_package/pdf_export/export/report/table_of_contents.rb
index 2e6094626a4..e17f0e3f91d 100644
--- a/app/models/work_package/pdf_export/export/table_of_contents.rb
+++ b/app/models/work_package/pdf_export/export/report/table_of_contents.rb
@@ -28,7 +28,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-module WorkPackage::PDFExport::Export::TableOfContents
+module WorkPackage::PDFExport::Export::Report::TableOfContents
def write_work_packages_toc!(work_packages, id_wp_meta_map)
toc_list = build_toc_data_list work_packages, id_wp_meta_map
with_margin(styles.toc_margins) do
diff --git a/app/models/work_package/pdf_export/export/timesheet/schema.json b/app/models/work_package/pdf_export/export/timesheet/schema.json
new file mode 100644
index 00000000000..db8e42a305d
--- /dev/null
+++ b/app/models/work_package/pdf_export/export/timesheet/schema.json
@@ -0,0 +1,1904 @@
+{
+ "type" : "object",
+ "title" : "PDF Export Styling yml",
+ "description" : "This document describes the style settings format for the [PDF Export styling file](https://github.com/opf/openproject/blob/dev/app/models/work_package/pdf_export/standard.yml)",
+ "properties" : {
+ "page" : {
+ "$ref" : "#/$defs/page"
+ },
+ "page_logo" : {
+ "$ref" : "#/$defs/page_logo"
+ },
+ "page_header" : {
+ "$ref" : "#/$defs/page_header"
+ },
+ "page_footer" : {
+ "$ref" : "#/$defs/page_footer"
+ },
+ "page_heading" : {
+ "$ref" : "#/$defs/page_heading"
+ },
+ "work_package" : {
+ "$ref" : "#/$defs/work_package"
+ },
+ "toc" : {
+ "$ref" : "#/$defs/toc"
+ },
+ "cover" : {
+ "$ref" : "#/$defs/cover"
+ },
+ "overview" : {
+ "$ref" : "#/$defs/overview"
+ }
+ },
+ "required" : [],
+ "additionalProperties" : false,
+ "$defs" : {
+ "cover" : {
+ "title" : "Cover page",
+ "description" : "Styling for the cover page of the PDF report export",
+ "x-example" : {
+ "cover" : {
+ "header" : {},
+ "footer" : {},
+ "hero" : {}
+ }
+ },
+ "type" : "object",
+ "properties" : {
+ "header" : {
+ "title" : "Cover page header",
+ "description" : "Styling for the cover page header",
+ "$ref" : "#/$defs/cover_header"
+ },
+ "footer" : {
+ "title" : "Cover page footer",
+ "description" : "Styling for the cover page footer",
+ "$ref" : "#/$defs/cover_footer"
+ },
+ "hero" : {
+ "title" : "Cover page hero",
+ "description" : "Styling for the hero banner at the bottom at the cover page",
+ "$ref" : "#/$defs/cover_hero"
+ }
+ }
+ },
+ "cover_header" : {
+ "title" : "Cover page header",
+ "description" : "Styling for the cover page header of the PDF report export",
+ "x-example" : {
+ "header" : {
+ "logo_height" : 25,
+ "border" : {}
+ }
+ },
+ "type" : "object",
+ "properties" : {
+ "spacing" : {
+ "title" : "Minimum spacing between logo and page header text",
+ "examples" : [
+ 20
+ ],
+ "$ref" : "#/$defs/measurement"
+ },
+ "offset" : {
+ "title" : "Offset position from page top",
+ "examples" : [
+ 6.5
+ ],
+ "$ref" : "#/$defs/measurement"
+ },
+ "logo_height" : {
+ "title" : "Height of the logo in the page header",
+ "examples" : [
+ 25
+ ],
+ "$ref" : "#/$defs/measurement"
+ },
+ "border" : {
+ "title" : "Cover page header",
+ "description" : "Styling for the cover page header",
+ "$ref" : "#/$defs/cover_header_border"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ }
+ ]
+ },
+ "cover_hero" : {
+ "title" : "Cover page hero",
+ "description" : "Styling for the hero banner at the bottom at the cover page",
+ "x-example" : {
+ "header" : {
+ "padding_right" : 150,
+ "padding_top" : 120,
+ "title" : {},
+ "heading" : {},
+ "subheading" : {}
+ }
+ },
+ "type" : "object",
+ "properties" : {
+ "padding_right" : {
+ "title" : "Padding right",
+ "description" : "Padding only on the right side of the hero banner",
+ "$ref" : "#/$defs/measurement"
+ },
+ "padding_top" : {
+ "title" : "Padding top",
+ "description" : "Padding only on the top side of the hero banner",
+ "$ref" : "#/$defs/measurement"
+ },
+ "title" : {
+ "title" : "The first block in the hero",
+ "type" : "object",
+ "x-example" : {
+ "title" : {
+ "max_height" : 30,
+ "spacing" : 10,
+ "font" : "SpaceMono",
+ "size" : 10,
+ "color" : "414d5f"
+ }
+ },
+ "properties" : {
+ "spacing" : {
+ "title" : "Minimum spacing between title and heading",
+ "examples" : [
+ 10
+ ],
+ "$ref" : "#/$defs/measurement"
+ },
+ "max_height" : {
+ "title" : "Maximum height of the block",
+ "examples" : [
+ 30
+ ],
+ "$ref" : "#/$defs/measurement"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ }
+ ]
+ },
+ "heading" : {
+ "title" : "The main block in the hero",
+ "type" : "object",
+ "x-example" : {
+ "heading" : {
+ "spacing" : 10,
+ "size" : 32,
+ "color" : "414d5f",
+ "styles" : [
+ "bold"
+ ]
+ }
+ },
+ "properties" : {
+ "spacing" : {
+ "title" : "Minimum spacing between heading and subheading",
+ "examples" : [
+ 10
+ ],
+ "$ref" : "#/$defs/measurement"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ }
+ ]
+ },
+ "dates" : {
+ "title" : "The dates block in the hero",
+ "type" : "object",
+ "x-example" : {
+ "heading" : {
+ "spacing" : 10,
+ "max_height" : 20,
+ "size" : 32,
+ "color" : "414d5f",
+ "styles" : [
+ "bold"
+ ]
+ }
+ },
+ "properties" : {
+ "max_height" : {
+ "title" : "Maximum height of the block",
+ "examples" : [
+ 30
+ ],
+ "$ref" : "#/$defs/measurement"
+ },
+ "spacing" : {
+ "title" : "Minimum spacing between dates and subheading",
+ "examples" : [
+ 10
+ ],
+ "$ref" : "#/$defs/measurement"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ }
+ ]
+ },
+ "subheading" : {
+ "title" : "The last block in the hero",
+ "type" : "object",
+ "x-example" : {
+ "subheading" : {
+ "max_height" : 30,
+ "size" : 10,
+ "color" : "414d5f",
+ "styles" : [
+ "italic"
+ ]
+ }
+ },
+ "properties" : {
+ "max_height" : {
+ "title" : "Maximum height of the block",
+ "examples" : [
+ 30
+ ],
+ "$ref" : "#/$defs/measurement"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ }
+ ]
+ }
+ }
+ },
+ "cover_footer" : {
+ "title" : "Cover page footer",
+ "description" : "Styling for the cover page footer of the PDF report export",
+ "x-example" : {
+ "footer" : {
+ "offset" : 20,
+ "size" : 10,
+ "color" : "064e80"
+ }
+ },
+ "type" : "object",
+ "properties" : {
+ "offset" : {
+ "title" : "Offset position from page bottom",
+ "examples" : [
+ 30
+ ],
+ "$ref" : "#/$defs/measurement"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ }
+ ]
+ },
+ "cover_header_border" : {
+ "title" : "Cover page header border",
+ "description" : "Styling for the cover page header border of the PDF report export",
+ "x-example" : {
+ "border" : {
+ "color" : "d3dee3",
+ "height" : 1,
+ "offset" : 6
+ }
+ },
+ "type" : "object",
+ "properties" : {
+ "spacing" : {
+ "title" : "Minimum spacing between logo and page header text",
+ "examples" : [
+ 20
+ ],
+ "$ref" : "#/$defs/measurement"
+ },
+ "offset" : {
+ "title" : "Offset position from page top",
+ "examples" : [
+ 6
+ ],
+ "$ref" : "#/$defs/measurement"
+ },
+ "height" : {
+ "title" : "Line height of the border",
+ "examples" : [
+ 25
+ ],
+ "$ref" : "#/$defs/measurement"
+ },
+ "color" : {
+ "title" : "Line color of the border",
+ "$ref" : "#/$defs/color"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ }
+ ]
+ },
+ "toc" : {
+ "title" : "Table of content",
+ "description" : "Styling for the table of content of the PDF report export",
+ "x-example" : {
+ "toc" : {
+ "subject_indent" : 4,
+ "indent_mode" : "stairs",
+ "margin_top" : 10,
+ "margin_bottom" : 20,
+ "item" : {
+ "size" : 9,
+ "color" : "000000",
+ "margin_bottom" : 4
+ },
+ "item_level_1" : {
+ "size" : 10,
+ "styles" : [
+ "bold"
+ ],
+ "margin_top" : 4,
+ "margin_bottom" : 4
+ },
+ "item_level_2" : {
+ "size" : 10
+ }
+ }
+ },
+ "type" : "object",
+ "properties" : {
+ "subject_indent" : {
+ "title" : "Indention width",
+ "description" : "Indention width for TOC levels",
+ "$ref" : "#/$defs/measurement"
+ },
+ "indent_mode" : {
+ "title" : "Indention mode",
+ "description" : "`flat`= no indention, `stairs` = indent on each level, `third_level` = indent only at 3th level",
+ "type" : "string",
+ "enum" : [
+ "flat",
+ "stairs",
+ "third_level"
+ ]
+ },
+ "item" : {
+ "type" : "object",
+ "title" : "Table of content item",
+ "description" : "Default styling for TOC items on all levels.<br/>use item_level_x` as key for TOC items on level `x`.",
+ "x-example" : {
+ "item" : {
+ "size" : 9,
+ "color" : "000000",
+ "margin_bottom" : 4
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ },
+ {
+ "$ref" : "#/$defs/margin"
+ }
+ ]
+ }
+ },
+ "patternProperties" : {
+ "^item_level_\\d+" : {
+ "title" : "Table of content item level",
+ "type" : "object",
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ },
+ {
+ "$ref" : "#/$defs/margin"
+ }
+ ]
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/margin"
+ }
+ ]
+ },
+ "overview" : {
+ "title" : "Overview",
+ "description" : "Styling for the PDF table export",
+ "x-example" : {
+ "overview" : {
+ "group_heading" : {},
+ "table" : {}
+ }
+ },
+ "type" : "object",
+ "properties" : {
+ "group_heading" : {
+ "type" : "object",
+ "title" : "Overview group heading",
+ "description" : "Styling for the group label if grouping is activated",
+ "x-example" : {
+ "group_heading" : {
+ "size" : 11,
+ "styles" : [
+ "bold"
+ ],
+ "margin_bottom" : 10
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ },
+ {
+ "$ref" : "#/$defs/margin"
+ }
+ ]
+ },
+ "table" : {
+ "type" : "object",
+ "title" : "Overview table",
+ "x-example" : {
+ "table" : {
+ "subject_indent" : 0,
+ "margin_bottom" : 20,
+ "cell" : {
+ "size" : 9,
+ "color" : "000000",
+ "padding" : 5
+ },
+ "cell_header" : {
+ "size" : 9,
+ "styles" : [
+ "bold"
+ ]
+ },
+ "cell_sums" : {
+ "size" : 8,
+ "styles" : [
+ "bold"
+ ]
+ }
+ }
+ },
+ "properties" : {
+ "subject_indent" : {
+ "title" : "Indent subject",
+ "description" : "Indent by work package level in the subject cell",
+ "$ref" : "#/$defs/measurement"
+ },
+ "cell" : {
+ "title" : "Table cell",
+ "description" : "Styling for a table value cell",
+ "$ref" : "#/$defs/table_cell"
+ },
+ "cell_header" : {
+ "title" : "Table header cell",
+ "description" : "Styling for a table header cell",
+ "$ref" : "#/$defs/table_cell"
+ },
+ "cell_sums" : {
+ "title" : "Table sum cell",
+ "description" : "Styling for a table sum cell",
+ "$ref" : "#/$defs/table_cell"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/margin"
+ }
+ ]
+ }
+ }
+ },
+ "work_package" : {
+ "type" : "object",
+ "title" : "Work package",
+ "description" : "Styling for the Work package section",
+ "x-example" : {
+ "work_package" : {
+ "margin_bottom" : 20,
+ "subject" : {
+ },
+ "subject_level_1" : {
+ },
+ "subject_level_2" : {
+ },
+ "subject_level_3" : {
+ },
+ "attributes_table" : {},
+ "markdown_label" : {},
+ "markdown_margin" : {},
+ "markdown" : {}
+ }
+ },
+ "properties" : {
+ "subject" : {
+ "type" : "object",
+ "title" : "Work package subject",
+ "description" : "Styling for the Work package subject headline",
+ "x-example" : {
+ "subject" : {
+ "size" : 10,
+ "styles" : [
+ "bold"
+ ],
+ "margin_bottom" : 10
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ },
+ {
+ "$ref" : "#/$defs/margin"
+ }
+ ]
+ },
+ "attributes_table" : {
+ "type" : "object",
+ "title" : "Work package attributes",
+ "description" : "Styling for the Work package attributes table",
+ "x-example" : {
+ "attributes_table" : {
+ "margin_bottom" : 10,
+ "cell" : {
+ "size" : 9,
+ "color" : "000000",
+ "padding_left" : 5,
+ "padding_right" : 5,
+ "padding_top" : 0,
+ "padding_bottom" : 5,
+ "border_color" : "4B4B4B",
+ "border_width" : 0.25
+ },
+ "cell_label" : {
+ "styles" : [
+ "bold"
+ ]
+ }
+ }
+ },
+ "properties" : {
+ "cell" : {
+ "title" : "Attribute value table cell",
+ "description" : "Styling for a table cell with attribute value",
+ "$ref" : "#/$defs/table_cell"
+ },
+ "cell_label" : {
+ "title" : "Attribute label table cell",
+ "description" : "Styling for a table cell with attribute label",
+ "$ref" : "#/$defs/table_cell"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/margin"
+ }
+ ]
+ },
+ "markdown_label" : {
+ "type" : "object",
+ "title" : "Work package markdown label",
+ "description" : "Label headline for work package description and long text custom fields",
+ "x-example" : {
+ "markdown_label" : {
+ "size" : 12,
+ "styles" : [
+ "bold"
+ ],
+ "margin_top" : 2,
+ "margin_bottom" : 4
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ },
+ {
+ "$ref" : "#/$defs/margin"
+ }
+ ]
+ },
+ "markdown_margin" : {
+ "type" : "object",
+ "title" : "Work package markdown margins",
+ "description" : "Margins for work package description and long text custom fields",
+ "x-example" : {
+ "markdown_margin" : {
+ "margin_bottom" : 16
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/margin"
+ }
+ ]
+ },
+ "markdown" : {
+ "$ref" : "#/$defs/markdown"
+ }
+ },
+ "patternProperties" : {
+ "^subject_level_\\d+" : {
+ "type" : "object",
+ "title" : "Work package subject level",
+ "x-example" : {
+ "subject_level_1" : {
+ "size" : 14,
+ "styles" : [
+ "bold"
+ ]
+ },
+ "subject_level_2" : {
+ "size" : 13,
+ "styles" : [
+ "bold"
+ ]
+ },
+ "subject_level_3" : {
+ "size" : 12,
+ "styles" : [
+ "bold"
+ ]
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ },
+ {
+ "$ref" : "#/$defs/margin"
+ }
+ ]
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/margin"
+ }
+ ]
+ },
+ "markdown" : {
+ "type" : "object",
+ "title" : "Markdown Styling",
+ "description" : "Styling for content of work package description and long text custom fields",
+ "x-example" : {
+ "markdown" : {
+ "font" : {},
+ "header" : {},
+ "header_1" : {},
+ "header_2" : {},
+ "header_3" : {},
+ "paragraph" : {},
+ "unordered_list" : {},
+ "unordered_list_point" : {},
+ "ordered_list" : {},
+ "ordered_list_point" : {},
+ "task_list" : {},
+ "task_list_point" : {},
+ "link" : {},
+ "code" : {},
+ "blockquote" : {},
+ "codeblock" : {},
+ "table" : {}
+ }
+ },
+ "properties" : {
+ "font" : {
+ "$ref" : "#/$defs/font"
+ },
+ "paragraph" : {
+ "title" : "Markdown paragraph",
+ "description" : "A block of text",
+ "type" : "object",
+ "properties" : {
+ "align" : {
+ "type" : "string",
+ "enum" : [
+ "left",
+ "center",
+ "right",
+ "justify"
+ ]
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ },
+ {
+ "$ref" : "#/$defs/padding"
+ }
+ ],
+ "x-example" : {
+ "paragraph" : {
+ "align" : "justify",
+ "padding_bottom" : "2mm"
+ }
+ }
+ },
+ "table" : {
+ "type" : "object",
+ "title" : "Markdown table",
+ "x-example" : {
+ "table" : {
+ "auto_width" : true,
+ "header" : {
+ "background_color" : "F0F0F0",
+ "no_repeating" : true,
+ "size" : 12
+ },
+ "cell" : {
+ "background_color" : "000FFF",
+ "size" : 10
+ }
+ }
+ },
+ "properties" : {
+ "auto_width" : {
+ "title" : "Automatic column widths",
+ "description" : "Table columns should fit the content, equal spacing of columns if value is `false`",
+ "type" : "boolean"
+ },
+ "header" : {
+ "$ref" : "#/$defs/table_header"
+ },
+ "cell" : {
+ "$ref" : "#/$defs/table_cell"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/margin"
+ },
+ {
+ "$ref" : "#/$defs/border"
+ }
+ ]
+ },
+ "html_table" : {
+ "type" : "object",
+ "title" : "HTML table",
+ "x-example" : {
+ "table" : {
+ "auto_width" : true,
+ "header" : {
+ "background_color" : "F0F0F0",
+ "no_repeating" : true,
+ "size" : 12
+ },
+ "cell" : {
+ "background_color" : "000FFF",
+ "size" : 10
+ }
+ }
+ },
+ "properties" : {
+ "auto_width" : {
+ "title" : "Automatic column widths",
+ "description" : "Table columns should fit the content, equal spacing of columns if value is `false`",
+ "type" : "boolean"
+ },
+ "header" : {
+ "$ref" : "#/$defs/table_header"
+ },
+ "cell" : {
+ "$ref" : "#/$defs/table_cell"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/margin"
+ },
+ {
+ "$ref" : "#/$defs/border"
+ }
+ ]
+ },
+ "headless_table" : {
+ "type" : "object",
+ "title" : "Markdown headless table",
+ "description" : "Tables without or empty header rows can be styled differently.",
+ "x-example" : {
+ "headless_table" : {
+ "auto_width" : true,
+ "cell" : {
+ "style" : "underline",
+ "background_color" : "000FFF"
+ }
+ }
+ },
+ "properties" : {
+ "auto_width" : {
+ "title" : "Automatic column widths",
+ "description" : "Table columns should fit the content, equal spacing of columns if value is `false`",
+ "type" : "boolean"
+ },
+ "cell" : {
+ "$ref" : "#/$defs/table_cell"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/margin"
+ },
+ {
+ "$ref" : "#/$defs/border"
+ }
+ ]
+ },
+ "code" : {
+ "type" : "object",
+ "title" : "Markdown code",
+ "description" : "Styling to denote a word or phrase as code",
+ "x-example" : {
+ "code" : {
+ "font" : "Consolas",
+ "color" : "880000"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ }
+ ]
+ },
+ "codeblock" : {
+ "type" : "object",
+ "title" : "Markdown code block",
+ "description" : "Styling to denote a paragraph as code",
+ "x-example" : {
+ "codeblock" : {
+ "background_color" : "F5F5F5",
+ "font" : "Consolas",
+ "size" : 8,
+ "color" : "880000",
+ "padding" : "3mm",
+ "margin_top" : "2mm",
+ "margin_bottom" : "2mm"
+ }
+ },
+ "properties" : {
+ "background_color" : {
+ "$ref" : "#/$defs/color"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ },
+ {
+ "$ref" : "#/$defs/padding"
+ },
+ {
+ "$ref" : "#/$defs/margin"
+ }
+ ]
+ },
+ "link" : {
+ "type" : "object",
+ "title" : "Markdown Link",
+ "description" : "Styling a clickable link",
+ "x-example" : {
+ "link" : {
+ "color" : "000088"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ }
+ ]
+ },
+ "image" : {
+ "type" : "object",
+ "title" : "Markdown image",
+ "description" : "Styling of images",
+ "x-example" : {
+ "image" : {
+ "max_width" : "50mm",
+ "margin" : "2mm",
+ "margin_bottom" : "3mm",
+ "align" : "center",
+ "caption" : {
+ "align" : "center",
+ "size" : 8
+ }
+ }
+ },
+ "properties" : {
+ "max_width" : {
+ "$ref" : "#/$defs/measurement",
+ "title" : "Maximum width of the image"
+ },
+ "align" : {
+ "$ref" : "#/$defs/alignment"
+ },
+ "caption" : {
+ "title" : "Image caption",
+ "description" : "Styling for the caption below an image",
+ "type" : "object",
+ "properties" : {
+ "align" : {
+ "type" : "string",
+ "enum" : [
+ "left",
+ "center",
+ "right",
+ "justify"
+ ]
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ },
+ {
+ "$ref" : "#/$defs/padding"
+ }
+ ]
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/margin"
+ }
+ ]
+ },
+ "hrule" : {
+ "type" : "object",
+ "title" : "Markdown horizontal rule",
+ "description" : "Styling for horizontal lines",
+ "properties" : {
+ "line_width" : {
+ "title" : "Sets the stroke width of the horizontal rule",
+ "$ref" : "#/$defs/measurement"
+ }
+ },
+ "x-example" : {
+ "hrule" : {
+ "line_width" : 1
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/margin"
+ }
+ ]
+ },
+ "header" : {
+ "title" : "Markdown header",
+ "description" : "Default styling for headers on all levels.<br/>use header_`x` as key for header level `x`.",
+ "$ref" : "#/$defs/header"
+ },
+ "blockquote" : {
+ "type" : "object",
+ "title" : "Markdown blockquote",
+ "description" : "Styling to denote a paragraph as quote",
+ "x-example" : {
+ "blockquote" : {
+ "background_color" : "f4f9ff",
+ "size" : 14,
+ "styles" : [
+ "italic"
+ ],
+ "color" : "0f3b66",
+ "border_color" : "b8d6f4",
+ "border_width" : 1,
+ "no_border_right" : true,
+ "no_border_left" : false,
+ "no_border_bottom" : true,
+ "no_border_top" : true
+ }
+ },
+ "properties" : {
+ "background_color" : {
+ "$ref" : "#/$defs/color"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ },
+ {
+ "$ref" : "#/$defs/border"
+ },
+ {
+ "$ref" : "#/$defs/padding"
+ },
+ {
+ "$ref" : "#/$defs/margin"
+ }
+ ]
+ },
+ "ordered_list" : {
+ "title" : "Markdown ordered list",
+ "description" : "Default styling for ordered lists on all levels.<br/>use ordered_list_`x` as key for ordered list level `x`.",
+ "$ref" : "#/$defs/ordered_list"
+ },
+ "ordered_list_point" : {
+ "title" : "Markdown ordered list point",
+ "description" : "Default styling for ordered list points on all levels.<br/>use ordered_list_point_`x` as key for ordered list points level `x`.",
+ "$ref" : "#/$defs/ordered_list_point"
+ },
+ "unordered_list" : {
+ "title" : "Markdown unordered list",
+ "description" : "Default styling for unordered lists on all levels.<br/>use unordered_list_`x` as key for unordered list level `x`.",
+ "$ref" : "#/$defs/unordered_list"
+ },
+ "unordered_list_point" : {
+ "title" : "Markdown unordered list point",
+ "description" : "Default styling for unordered list points on all levels.<br/>use unordered_list_point_`x` as key for unordered list points level `x`.",
+ "$ref" : "#/$defs/unordered_list_point"
+ },
+ "task_list" : {
+ "title" : "Markdown task list",
+ "x-example" : {
+ "task_list" : {
+ "spacing" : "2mm"
+ }
+ },
+ "$ref" : "#/$defs/unordered_list"
+ },
+ "task_list_point" : {
+ "title" : "Markdown task list point",
+ "$ref" : "#/$defs/task_list_point"
+ },
+ "alerts": {
+ "$ref": "#/$defs/alerts"
+ }
+ },
+ "patternProperties" : {
+ "^ordered_list_point_\\d+" : {
+ "title" : "Markdown ordered list point level",
+ "$ref" : "#/$defs/ordered_list_point"
+ },
+ "^ordered_list_\\d+" : {
+ "title" : "Markdown ordered list level",
+ "$ref" : "#/$defs/ordered_list"
+ },
+ "^unordered_list_point_\\d+" : {
+ "title" : "Markdown unordered list point level",
+ "$ref" : "#/$defs/unordered_list_point"
+ },
+ "^unordered_list_\\d+" : {
+ "title" : "Markdown unordered List Level",
+ "$ref" : "#/$defs/unordered_list"
+ },
+ "^header_\\d+" : {
+ "title" : "Markdown header level",
+ "$ref" : "#/$defs/header"
+ }
+ }
+ },
+ "color" : {
+ "type" : "string",
+ "title" : "Color",
+ "description" : "A color in RRGGBB format",
+ "examples" : [
+ "F0F0F0"
+ ],
+ "x-example" : {
+ "color" : "F0F0F0"
+ },
+ "pattern" : "^(?:[0-9a-fA-F]{3}){1,2}$"
+ },
+ "font" : {
+ "title" : "Font properties",
+ "description" : "Properties to set the font style",
+ "type" : "object",
+ "x-example" : {
+ "font" : "OpenSans",
+ "size" : 10,
+ "character_spacing" : 0,
+ "styles" : [],
+ "color" : "000000",
+ "leading" : 2
+ },
+ "properties" : {
+ "font" : {
+ "type" : "string"
+ },
+ "size" : {
+ "$ref" : "#/$defs/measurement"
+ },
+ "character_spacing" : {
+ "$ref" : "#/$defs/measurement"
+ },
+ "leading" : {
+ "$ref" : "#/$defs/measurement"
+ },
+ "color" : {
+ "$ref" : "#/$defs/color"
+ },
+ "styles" : {
+ "type" : "array",
+ "items" : {
+ "$ref" : "#/$defs/font_style"
+ }
+ }
+ }
+ },
+ "font_style" : {
+ "type" : "string",
+ "title" : "Font Style",
+ "description" : "Style of the font to use",
+ "examples" : [
+ "bold"
+ ],
+ "enum" : [
+ "bold",
+ "italic",
+ "underline",
+ "strikethrough",
+ "superscript",
+ "subscript"
+ ]
+ },
+ "page" : {
+ "title" : "Page settings",
+ "description" : "Properties to set the basic page settings",
+ "type" : "object",
+ "x-example" : {
+ "page" : {
+ "page_size" : "EXECUTIVE",
+ "margin_top" : 60,
+ "margin_bottom" : 60,
+ "margin_left" : 36,
+ "margin_right" : 36,
+ "page_break_threshold" : 200,
+ "link_color" : "175A8E"
+ }
+ },
+ "properties" : {
+ "link_color" : {
+ "title" : "Link color",
+ "description" : "Set the color of clickable links",
+ "$ref" : "#/$defs/color"
+ },
+ "page_layout" : {
+ "title" : "Page layout",
+ "description" : "The layout of a page",
+ "type" : "string",
+ "examples" : [
+ "portrait"
+ ],
+ "enum" : [
+ "portrait",
+ "landscape"
+ ]
+ },
+ "page_size" : {
+ "type" : "string",
+ "title" : "Page size",
+ "description" : "The size of a page",
+ "examples" : [
+ "EXECUTIVE"
+ ],
+ "enum" : [
+ "EXECUTIVE",
+ "TABLOID",
+ "LETTER",
+ "LEGAL",
+ "FOLIO",
+ "A0",
+ "A1",
+ "A2",
+ "A3",
+ "A4",
+ "A5",
+ "A6",
+ "A7",
+ "A8",
+ "A9",
+ "A10",
+ "B0",
+ "B1",
+ "B2",
+ "B3",
+ "B4",
+ "B5",
+ "B6",
+ "B7",
+ "B8",
+ "B9",
+ "B10",
+ "C0",
+ "C1",
+ "C2",
+ "C3",
+ "C4",
+ "C5",
+ "C6",
+ "C7",
+ "C8",
+ "C9",
+ "C10",
+ "RA0",
+ "RA1",
+ "RA2",
+ "RA3",
+ "RA4",
+ "SRA0",
+ "SRA1",
+ "SRA2",
+ "SRA3",
+ "SRA4",
+ "4A0",
+ "2A0"
+ ]
+ },
+ "page_break_threshold" : {
+ "title" : "Page break threshold",
+ "description" : "If there is a new section, start a new page if space less than the threshold is available",
+ "$ref" : "#/$defs/measurement"
+ }
+ },
+ "allOf" : [
+ {
+ "title" : "Default font settings",
+ "$ref" : "#/$defs/font"
+ },
+ {
+ "title" : "Page margins",
+ "$ref" : "#/$defs/margin"
+ }
+ ]
+ },
+ "page_heading" : {
+ "title" : "Page heading",
+ "description" : "The main page title heading",
+ "x-example" : {
+ "page_heading" : {
+ "size" : 14,
+ "styles" : [
+ "bold"
+ ],
+ "margin_bottom" : 10
+ }
+ },
+ "type" : "object",
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ },
+ {
+ "$ref" : "#/$defs/margin"
+ }
+ ]
+ },
+ "page_footer" : {
+ "type" : "object",
+ "title" : "Page footers",
+ "x-example" : {
+ "page_footer" : {
+ "offset" : -30,
+ "size" : 8
+ }
+ },
+ "properties" : {
+ "offset" : {
+ "title" : "Offset position from page bottom",
+ "examples" : [
+ -30
+ ],
+ "$ref" : "#/$defs/measurement_signed"
+ },
+ "spacing" : {
+ "title" : "Minimum spacing between different page footers",
+ "examples" : [
+ 8
+ ],
+ "$ref" : "#/$defs/measurement"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ }
+ ]
+ },
+ "page_header" : {
+ "type" : "object",
+ "title" : "Page headers",
+ "x-example" : {
+ "page_header" : {
+ "align" : "left",
+ "offset" : 20,
+ "size" : 8
+ }
+ },
+ "properties" : {
+ "align" : {
+ "$ref" : "#/$defs/alignment"
+ },
+ "offset" : {
+ "title" : "Offset position from page top",
+ "examples" : [
+ -30
+ ],
+ "$ref" : "#/$defs/measurement_signed"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ }
+ ]
+ },
+ "page_logo" : {
+ "title" : "Page logo",
+ "description" : "Styling for logo image in the page header.",
+ "type" : "object",
+ "x-example" : {
+ "page_logo" : {
+ "height" : 20,
+ "align" : "right"
+ }
+ },
+ "properties" : {
+ "height" : {
+ "$ref" : "#/$defs/measurement",
+ "title" : "Height of the image"
+ },
+ "align" : {
+ "$ref" : "#/$defs/alignment"
+ },
+ "offset" : {
+ "title" : "Offset position from page top",
+ "examples" : [
+ -30
+ ],
+ "$ref" : "#/$defs/measurement_signed"
+ }
+ }
+ },
+ "margin" : {
+ "title" : "Margin properties",
+ "description" : "Properties to set margins",
+ "type" : "object",
+ "x-example" : {
+ "margin" : "10mm",
+ "margin_top" : "15mm"
+ },
+ "properties" : {
+ "margin" : {
+ "title" : "Margin",
+ "description" : "One value for margin on all sides",
+ "$ref" : "#/$defs/measurement"
+ },
+ "margin_left" : {
+ "title" : "Margin left",
+ "description" : "Margin only on the left side",
+ "$ref" : "#/$defs/measurement"
+ },
+ "margin_right" : {
+ "title" : "Margin right",
+ "description" : "Margin only on the right side",
+ "$ref" : "#/$defs/measurement"
+ },
+ "margin_top" : {
+ "title" : "Margin top",
+ "description" : "Margin only on the top side",
+ "$ref" : "#/$defs/measurement"
+ },
+ "margin_bottom" : {
+ "title" : "Margin bottom",
+ "description" : "Margin only on the bottom side",
+ "$ref" : "#/$defs/measurement"
+ }
+ }
+ },
+ "padding" : {
+ "title" : "Padding Properties",
+ "description" : "Properties to set paddings",
+ "type" : "object",
+ "x-example" : {
+ "padding" : "10mm",
+ "padding_top" : "15mm"
+ },
+ "properties" : {
+ "padding" : {
+ "title" : "Padding",
+ "description" : "One value for padding on all sides",
+ "$ref" : "#/$defs/measurement"
+ },
+ "padding_left" : {
+ "title" : "Padding left",
+ "description" : "Padding only on the left side",
+ "$ref" : "#/$defs/measurement"
+ },
+ "padding_right" : {
+ "title" : "Padding right",
+ "description" : "Padding only on the right side",
+ "$ref" : "#/$defs/measurement"
+ },
+ "padding_top" : {
+ "title" : "Padding top",
+ "description" : "Padding only on the top side",
+ "$ref" : "#/$defs/measurement"
+ },
+ "padding_bottom" : {
+ "title" : "Padding bottom",
+ "description" : "Padding only on the bottom side",
+ "$ref" : "#/$defs/measurement"
+ }
+ }
+ },
+ "measurement" : {
+ "type" : [
+ "number",
+ "string"
+ ],
+ "pattern" : "^([0-9\\.]+)(mm|cm|dm|m|in|ft|yr|pt)$",
+ "description" : "A number >= 0 and an optional unit",
+ "examples" : [
+ "10mm",
+ "10"
+ ]
+ },
+ "measurement_signed" : {
+ "type" : [
+ "number",
+ "string"
+ ],
+ "pattern" : "^-?([0-9\\.]+)(mm|cm|dm|m|in|ft|yr|pt)$",
+ "description" : "A positive or negative number and an optional unit"
+ },
+ "alignment" : {
+ "title" : "Alignment",
+ "description" : "How the element should be aligned",
+ "examples" : [
+ "center"
+ ],
+ "type" : "string",
+ "enum" : [
+ "left",
+ "center",
+ "right"
+ ]
+ },
+ "unordered_list" : {
+ "title" : "Markdown unordered list",
+ "x-example" : {
+ "unordered_list" : {
+ "spacing" : "1.5mm",
+ "padding_top" : "2mm",
+ "padding_bottom" : "2mm"
+ }
+ },
+ "type" : "object",
+ "properties" : {
+ "spacing" : {
+ "title" : "Spacing",
+ "description" : "Additional space between list items",
+ "$ref" : "#/$defs/measurement"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ },
+ {
+ "$ref" : "#/$defs/padding"
+ }
+ ]
+ },
+ "unordered_list_point" : {
+ "title" : "Markdown unordered list point",
+ "x-example" : {
+ "unordered_list_point" : {
+ "sign" : "•",
+ "spacing" : "0.75mm"
+ }
+ },
+ "type" : "object",
+ "properties" : {
+ "sign" : {
+ "title" : "Sign",
+ "description" : "The 'bullet point' character used in the list",
+ "type" : "string"
+ },
+ "spacing" : {
+ "title" : "Spacing",
+ "description" : "Space between point and list item content",
+ "$ref" : "#/$defs/measurement"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ }
+ ]
+ },
+ "task_list_point" : {
+ "type" : "object",
+ "title" : "Markdown task list point",
+ "x-example" : {
+ "task_list_point" : {
+ "checked" : "☑",
+ "unchecked" : "☐",
+ "spacing" : "0.75mm"
+ }
+ },
+ "properties" : {
+ "checked" : {
+ "title" : "Checked sign",
+ "description" : "Sign for checked state of a task list item",
+ "type" : "string"
+ },
+ "unchecked" : {
+ "title" : "Unchecked sign",
+ "description" : "Sign for unchecked state of a task list item",
+ "type" : "string"
+ },
+ "spacing" : {
+ "title" : "Spacing",
+ "description" : "Additional space between point and list item content",
+ "$ref" : "#/$defs/measurement"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ }
+ ]
+ },
+ "ordered_list" : {
+ "title" : "Markdown ordered list",
+ "x-example" : {
+ "ordered_list" : {
+ "spacing" : "2mm",
+ "point_inline" : false
+ }
+ },
+ "type" : "object",
+ "properties" : {
+ "spacing" : {
+ "title" : "Spacing",
+ "description" : "Additional space between list items",
+ "$ref" : "#/$defs/measurement"
+ },
+ "point_inline" : {
+ "title" : "Inline Point",
+ "description" : "Do not indent paragraph text, but include the point into the first paragraph",
+ "type" : "boolean"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ },
+ {
+ "$ref" : "#/$defs/padding"
+ }
+ ]
+ },
+ "ordered_list_point" : {
+ "title" : "Markdown ordered list point",
+ "type" : "object",
+ "x-example" : {
+ "ordered_list_point" : {
+ "template" : "<number>.",
+ "list_style_type" : "decimal",
+ "spacing" : "0.75mm",
+ "spanning" : true
+ }
+ },
+ "properties" : {
+ "spacing" : {
+ "$ref" : "#/$defs/measurement"
+ },
+ "alphabetical": {
+ "title": "Alphabetical bullet points",
+ "description": "(deprecated; use list_style_type) Convert the list item number into a character, eg. `a.` `b.` `c.`",
+ "type": "boolean"
+ },
+ "list_style_type": {
+ "title": "List style type",
+ "description": "The style of the list bullet points, eg. `decimal`, `lower-latin`, `upper-roman`",
+ "type": "string",
+ "enum": [
+ "decimal",
+ "lower-latin",
+ "lower-roman",
+ "upper-latin",
+ "upper-roman"
+ ]
+ },
+ "spanning" : {
+ "title" : "Spanning",
+ "description" : "Use the width of the largest bullet as indention.",
+ "type" : "boolean"
+ },
+ "template" : {
+ "title" : "Template",
+ "description" : "customize what the prefix should contain, eg. `(<number>)`",
+ "type" : "string"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ }
+ ]
+ },
+ "header" : {
+ "type" : "object",
+ "title" : "Markdown header",
+ "x-example" : {
+ "header" : {
+ "styles" : [
+ "bold"
+ ],
+ "padding_top" : "2mm",
+ "padding_bottom" : "2mm"
+ },
+ "header_1" : {
+ "size" : 14,
+ "styles" : [
+ "bold",
+ "italic"
+ ]
+ },
+ "header_2" : {
+ "size" : 12,
+ "styles" : [
+ "bold"
+ ]
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ },
+ {
+ "$ref" : "#/$defs/padding"
+ }
+ ]
+ },
+ "table_cell" : {
+ "type" : "object",
+ "title" : "Table cell",
+ "description" : "Styling for a table cell",
+ "x-example" : {
+ "table_cell" : {
+ "size" : 9,
+ "color" : "000000",
+ "padding" : 5,
+ "border_width" : 1
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ },
+ {
+ "$ref" : "#/$defs/padding"
+ },
+ {
+ "$ref" : "#/$defs/border"
+ }
+ ]
+ },
+ "table_header" : {
+ "type" : "object",
+ "title" : "Table header cell",
+ "description" : "Styling for a table header cell",
+ "x-example" : {
+ "table_header" : {
+ "size" : 9,
+ "styles" : [
+ "bold"
+ ]
+ }
+ },
+ "properties" : {
+ "background_color" : {
+ "$ref" : "#/$defs/color"
+ },
+ "no_repeating" : {
+ "type" : "boolean"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ },
+ {
+ "$ref" : "#/$defs/padding"
+ },
+ {
+ "$ref" : "#/$defs/border"
+ }
+ ]
+ },
+ "paragraph" : {
+ "type" : "object",
+ "title" : "Markdown paragraph",
+ "properties" : {
+ "align" : {
+ "type" : "string",
+ "enum" : [
+ "left",
+ "center",
+ "right",
+ "justify"
+ ]
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ },
+ {
+ "$ref" : "#/$defs/padding"
+ }
+ ]
+ },
+ "border" : {
+ "type" : "object",
+ "title" : "Border Properties",
+ "description" : "Properties to set borders",
+ "x-example" : {
+ "border_color" : "F000FF",
+ "border_color_top" : "000FFF",
+ "border_color_bottom" : "FFF000",
+ "no_border_left" : true,
+ "no_border_right" : true,
+ "border_width" : "0.25mm",
+ "border_width_left" : "0.5mm",
+ "border_width_right" : "0.5mm"
+ },
+ "properties" : {
+ "border_width" : {
+ "title" : "Border width",
+ "description" : "One value for border line width on all sides",
+ "$ref" : "#/$defs/measurement"
+ },
+ "border_width_left" : {
+ "title" : "Border width left",
+ "description" : "Border width only on the left side",
+ "$ref" : "#/$defs/measurement"
+ },
+ "border_width_top" : {
+ "title" : "Border width top",
+ "description" : "Border width only on the top side",
+ "$ref" : "#/$defs/measurement"
+ },
+ "border_width_right" : {
+ "title" : "Border width right",
+ "description" : "Border width only on the right side",
+ "$ref" : "#/$defs/measurement"
+ },
+ "border_width_bottom" : {
+ "title" : "Border width bottom",
+ "description" : "Border width only on the bottom side",
+ "$ref" : "#/$defs/measurement"
+ },
+ "border_color" : {
+ "title" : "Border color",
+ "description" : "One value for border color on all sides",
+ "$ref" : "#/$defs/color"
+ },
+ "border_color_left" : {
+ "title" : "Border color left",
+ "description" : "Border color only on the left side",
+ "$ref" : "#/$defs/color"
+ },
+ "border_color_top" : {
+ "title" : "Border color top",
+ "description" : "Border color only on the top side",
+ "$ref" : "#/$defs/color"
+ },
+ "border_color_right" : {
+ "title" : "Border color right",
+ "description" : "Border color only on the right side",
+ "$ref" : "#/$defs/color"
+ },
+ "border_color_bottom" : {
+ "title" : "Border color bottom",
+ "description" : "Border color only on the bottom side",
+ "$ref" : "#/$defs/color"
+ },
+ "no_border" : {
+ "title" : "Disable borders",
+ "description" : "Turn off borders on all sides",
+ "type" : "boolean"
+ },
+ "no_border_left" : {
+ "title" : "Disable border left",
+ "description" : "Turn off border on the left sides",
+ "type" : "boolean"
+ },
+ "no_border_top" : {
+ "title" : "Disable border top",
+ "description" : "Turn off border on the top sides",
+ "type" : "boolean"
+ },
+ "no_border_right" : {
+ "title" : "Disable border right",
+ "description" : "Turn off border on the right sides",
+ "type" : "boolean"
+ },
+ "no_border_bottom" : {
+ "title" : "Disable border bottom",
+ "description" : "Turn off border on the bottom sides",
+ "type" : "boolean"
+ }
+ }
+ },
+ "alert": {
+ "type": "object",
+ "title": "Alert",
+ "description": "Styling to denote a quote as alert box",
+ "x-example": {
+ "ALERT": {
+ "alert_color": "f4f9ff",
+ "border_color": "f4f9ff",
+ "border_width": 2,
+ "no_border_right": true,
+ "no_border_left": false,
+ "no_border_bottom": true,
+ "no_border_top": true
+ }
+ },
+ "properties": {
+ "background_color": {
+ "$ref": "#/$defs/color"
+ },
+ "alert_color": {
+ "$ref": "#/$defs/color"
+ }
+ },
+ "allOf": [
+ {
+ "$ref": "#/$defs/font"
+ },
+ {
+ "$ref": "#/$defs/border"
+ },
+ {
+ "$ref": "#/$defs/padding"
+ },
+ {
+ "$ref": "#/$defs/margin"
+ }
+ ]
+ },
+ "alerts": {
+ "type": "object",
+ "title": "alert boxes (styled blockquotes)",
+ "properties": {
+ "NOTE": {
+ "$ref": "#/$defs/alert"
+ },
+ "TIP": {
+ "$ref": "#/$defs/alert"
+ },
+ "WARNING": {
+ "$ref": "#/$defs/alert"
+ },
+ "IMPORTANT": {
+ "$ref": "#/$defs/alert"
+ },
+ "CAUTION": {
+ "$ref": "#/$defs/alert"
+ }
+ }
+ }
+ }
+}
diff --git a/app/models/work_package/pdf_export/export/timesheet/standard.yml b/app/models/work_package/pdf_export/export/timesheet/standard.yml
new file mode 100644
index 00000000000..4250ddd3238
--- /dev/null
+++ b/app/models/work_package/pdf_export/export/timesheet/standard.yml
@@ -0,0 +1,64 @@
+page:
+ page_size: "A4"
+ margin_top: 60
+ margin_bottom: 60
+ margin_left: 36
+ margin_right: 36
+ page_break_threshold: 200
+ link_color: "175A8E"
+
+page_header:
+ offset: 20
+ size: 8
+
+page_footer:
+ offset: -30
+ size: 8
+ spacing: 6
+
+page_logo:
+ height: 20
+ align: "right"
+
+page_heading:
+ size: 14
+ styles: [ "bold" ]
+ margin_bottom: 10
+
+cover:
+ header:
+ logo_height: 25
+ border:
+ color: 'd3dee3'
+ height: 1
+ offset: 6
+ footer:
+ size: 10
+ color: '414d5f'
+ offset: 30
+ hero:
+ padding_right: 144
+ padding_top: 120
+ title:
+ max_height: 30
+ spacing: 10
+ font: 'SpaceMono'
+ color: '414d5f'
+ size: 10
+ heading:
+ spacing: 14
+ color: '414d5f'
+ styles:
+ - bold
+ size: 16
+ dates:
+ spacing: 4
+ max_height: 16
+ color: '414d5f'
+ size: 10
+ styles:
+ - bold
+ subheading:
+ max_height: 30
+ color: '414d5f'
+ size: 10
diff --git a/app/models/work_package/pdf_export/export/timesheet/styles.rb b/app/models/work_package/pdf_export/export/timesheet/styles.rb
new file mode 100644
index 00000000000..5d7af13a219
--- /dev/null
+++ b/app/models/work_package/pdf_export/export/timesheet/styles.rb
@@ -0,0 +1,121 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+module WorkPackage::PDFExport::Export::Timesheet::Style
+ include MarkdownToPDF::StyleValidation
+
+ class PDFStyles
+ include MarkdownToPDF::Common
+ include MarkdownToPDF::StyleHelper
+ include WorkPackage::PDFExport::Common::Styles
+
+ def cover_header
+ resolve_font(@styles.dig(:cover, :header))
+ end
+
+ def cover_header_logo_height
+ resolve_pt(@styles.dig(:cover, :header, :logo_height), 25)
+ end
+
+ def cover_header_border
+ { color: @styles.dig(:cover, :header, :border, :color),
+ height: resolve_pt(@styles.dig(:cover, :header, :border, :height), 1),
+ offset: resolve_pt(@styles.dig(:cover, :header, :border, :offset), 0) }
+ end
+
+ def cover_footer
+ resolve_font(@styles.dig(:cover, :footer))
+ end
+
+ def cover_footer_offset
+ resolve_pt(@styles.dig(:cover, :footer, :offset), 0)
+ end
+
+ def cover_hero_padding
+ resolve_padding(@styles.dig(:cover, :hero))
+ end
+
+ def cover_hero_title
+ resolve_font(@styles.dig(:cover, :hero, :title))
+ end
+
+ def cover_hero_title_spacing
+ resolve_pt(@styles.dig(:cover, :hero, :title, :spacing), 0)
+ end
+
+ def cover_hero_title_max_height
+ resolve_pt(@styles.dig(:cover, :hero, :title, :max_height), 30)
+ end
+
+ def cover_hero_heading
+ resolve_font(@styles.dig(:cover, :hero, :heading))
+ end
+
+ def cover_hero_heading_spacing
+ resolve_pt(@styles.dig(:cover, :hero, :heading, :spacing), 0)
+ end
+
+ def cover_hero_dates
+ resolve_font(@styles.dig(:cover, :hero, :dates))
+ end
+
+ def cover_hero_dates_spacing
+ resolve_pt(@styles.dig(:cover, :hero, :dates, :spacing), 0)
+ end
+
+ def cover_hero_dates_max_height
+ resolve_pt(@styles.dig(:cover, :hero, :dates, :max_height), 0)
+ end
+
+ def cover_hero_subheading
+ resolve_font(@styles.dig(:cover, :hero, :subheading))
+ end
+
+ def cover_hero_subheading_max_height
+ resolve_pt(@styles.dig(:cover, :hero, :subheading, :max_height), 30)
+ end
+ end
+
+ def styles
+ @styles ||= PDFStyles.new(load_style)
+ end
+
+ private
+
+ def load_style
+ yml = YAML::load_file(File.join(styles_asset_path, "standard.yml"))
+ schema = JSON::load_file(File.join(styles_asset_path, "schema.json"))
+ validate_schema!(yml, schema)
+ end
+
+ def styles_asset_path
+ File.dirname(File.expand_path(__FILE__))
+ end
+end
diff --git a/app/models/work_package/pdf_export/export/wp/attributes.rb b/app/models/work_package/pdf_export/export/wp/attributes.rb
new file mode 100644
index 00000000000..78eaeadb5a7
--- /dev/null
+++ b/app/models/work_package/pdf_export/export/wp/attributes.rb
@@ -0,0 +1,140 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+module WorkPackage::PDFExport::Export::Wp::Attributes
+ def write_attributes_tables!(work_package)
+ work_package
+ .type.attribute_groups
+ .filter { |group| group.is_a?(Type::AttributeGroup) }
+ .map do |group|
+ write_attributes_group(group, work_package)
+ end
+ end
+
+ private
+
+ def get_column_value_cell(work_package, column_name)
+ value = get_column_value(work_package, column_name)
+ return get_id_column_cell(work_package, value) if column_name == :id
+ return get_subject_column_cell(work_package, value) if column_name == :subject
+
+ escape_tags(value)
+ end
+
+ def write_attributes_group(group, work_package)
+ write_attributes_group_table_title(group)
+ write_attributes_group_table(group, work_package)
+ end
+
+ def write_attributes_group_table_title(group)
+ with_margin(styles.wp_markdown_label_margins) do
+ pdf.formatted_text([styles.wp_markdown_label
+ .merge({ text: group.translated_key })])
+ end
+ end
+
+ def form_config_group_to_column_entries(group, work_package)
+ group.attributes.map do |form_key|
+ form_key_to_column_entries(form_key.to_sym, work_package)
+ end.flatten
+ end
+
+ def form_config_group_to_column_entries_rows(list)
+ 0.step(list.length - 1, 2).map do |i|
+ build_columns_table_cells(list[i]) +
+ build_columns_table_cells(list[i + 1])
+ end
+ end
+
+ def write_attributes_group_table(group, work_package)
+ list = form_config_group_to_column_entries(group, work_package)
+ .map { |entry| entry.merge({ value: get_column_value_cell(work_package, entry[:name]) }) }
+ rows = form_config_group_to_column_entries_rows(list)
+ return if rows.empty?
+
+ with_margin(styles.wp_attributes_table_margins) do
+ pdf.table(
+ rows,
+ column_widths: attributes_table_column_widths,
+ cell_style: styles.wp_attributes_table_cell.merge({ inline_format: true })
+ )
+ end
+ end
+
+ def attributes_table_column_widths
+ # calculate fixed work package attribute table columns width
+ widths = [1.5, 2.0, 1.5, 2.0] # label | value | label | value
+ ratio = pdf.bounds.width / widths.sum
+ widths.map { |w| w * ratio }
+ end
+
+ def form_key_custom_field_to_column_entries(form_key, work_package)
+ id = form_key.to_s.sub("custom_field_", "").to_i
+ cf = CustomField.find_by(id:)
+ return [] if cf.nil? || cf.formattable?
+
+ return [] unless cf.is_for_all? || work_package.project.work_package_custom_field_ids.include?(cf.id)
+
+ [{ label: cf.name || form_key, name: form_key.to_s.sub("custom_field_", "cf_") }]
+ end
+
+ def form_key_to_column_entries(form_key, work_package)
+ if CustomField.custom_field_attribute? form_key
+ return form_key_custom_field_to_column_entries(form_key, work_package)
+ end
+
+ if form_key == :date
+ column_entries(%i[start_date due_date duration])
+ elsif form_key == :bcf_thumbnail
+ []
+ else
+ column_name = ::API::Utilities::PropertyNameConverter.to_ar_name(form_key, context: work_package)
+ [column_entry(column_name)]
+ end
+ end
+
+ def column_entries(column_names)
+ column_names.map { |key| column_entry(key) }
+ end
+
+ def column_entry(column_name)
+ { label: WorkPackage.human_attribute_name(column_name), name: column_name }
+ end
+
+ def build_columns_table_cells(attribute_data)
+ return ["", ""] if attribute_data.nil?
+
+ # get work package attribute table cell data: [label, value]
+ [
+ pdf.make_cell(attribute_data[:label].upcase, styles.wp_attributes_table_label_cell),
+ attribute_data[:value]
+ ]
+ end
+end
diff --git a/app/models/work_package/pdf_export/export/wp/schema.json b/app/models/work_package/pdf_export/export/wp/schema.json
new file mode 100644
index 00000000000..e0593cde2e9
--- /dev/null
+++ b/app/models/work_package/pdf_export/export/wp/schema.json
@@ -0,0 +1,1426 @@
+{
+ "type" : "object",
+ "title" : "PDF Export Styling yml",
+ "description" : "This document describes the style settings format for the [PDF Export styling file](https://github.com/opf/openproject/blob/dev/app/models/work_package/pdf_export/standard.yml)",
+ "properties" : {
+ "page" : {
+ "$ref" : "#/$defs/page"
+ },
+ "page_logo" : {
+ "$ref" : "#/$defs/page_logo"
+ },
+ "page_header" : {
+ "$ref" : "#/$defs/page_header"
+ },
+ "page_footer" : {
+ "$ref" : "#/$defs/page_footer"
+ },
+ "page_heading" : {
+ "$ref" : "#/$defs/page_heading"
+ },
+ "work_package" : {
+ "$ref" : "#/$defs/work_package"
+ }
+ },
+ "required" : [],
+ "additionalProperties" : false,
+ "$defs" : {
+ "work_package" : {
+ "type" : "object",
+ "title" : "Work package",
+ "description" : "Styling for the Work package section",
+ "x-example" : {
+ "work_package" : {
+ "margin_bottom" : 20,
+ "subject" : {
+ },
+ "subject_level_1" : {
+ },
+ "subject_level_2" : {
+ },
+ "subject_level_3" : {
+ },
+ "attributes_table" : {},
+ "markdown_label" : {},
+ "markdown_margin" : {},
+ "markdown" : {}
+ }
+ },
+ "properties" : {
+ "subject" : {
+ "type" : "object",
+ "title" : "Work package subject",
+ "description" : "Styling for the Work package subject headline",
+ "x-example" : {
+ "subject" : {
+ "size" : 10,
+ "styles" : [
+ "bold"
+ ],
+ "margin_bottom" : 10
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ },
+ {
+ "$ref" : "#/$defs/margin"
+ }
+ ]
+ },
+ "attributes_table" : {
+ "type" : "object",
+ "title" : "Work package attributes",
+ "description" : "Styling for the Work package attributes table",
+ "x-example" : {
+ "attributes_table" : {
+ "margin_bottom" : 10,
+ "cell" : {
+ "size" : 9,
+ "color" : "000000",
+ "padding_left" : 5,
+ "padding_right" : 5,
+ "padding_top" : 0,
+ "padding_bottom" : 5,
+ "border_color" : "4B4B4B",
+ "border_width" : 0.25
+ },
+ "cell_label" : {
+ "styles" : [
+ "bold"
+ ]
+ }
+ }
+ },
+ "properties" : {
+ "cell" : {
+ "title" : "Attribute value table cell",
+ "description" : "Styling for a table cell with attribute value",
+ "$ref" : "#/$defs/table_cell"
+ },
+ "cell_label" : {
+ "title" : "Attribute label table cell",
+ "description" : "Styling for a table cell with attribute label",
+ "$ref" : "#/$defs/table_cell"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/margin"
+ }
+ ]
+ },
+ "markdown_label" : {
+ "type" : "object",
+ "title" : "Work package markdown label",
+ "description" : "Label headline for work package description and long text custom fields",
+ "x-example" : {
+ "markdown_label" : {
+ "size" : 12,
+ "styles" : [
+ "bold"
+ ],
+ "margin_top" : 2,
+ "margin_bottom" : 4
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ },
+ {
+ "$ref" : "#/$defs/margin"
+ }
+ ]
+ },
+ "markdown_margin" : {
+ "type" : "object",
+ "title" : "Work package markdown margins",
+ "description" : "Margins for work package description and long text custom fields",
+ "x-example" : {
+ "markdown_margin" : {
+ "margin_bottom" : 16
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/margin"
+ }
+ ]
+ },
+ "markdown" : {
+ "$ref" : "#/$defs/markdown"
+ }
+ },
+ "patternProperties" : {
+ "^subject_level_\\d+" : {
+ "type" : "object",
+ "title" : "Work package subject level",
+ "x-example" : {
+ "subject_level_1" : {
+ "size" : 14,
+ "styles" : [
+ "bold"
+ ]
+ },
+ "subject_level_2" : {
+ "size" : 13,
+ "styles" : [
+ "bold"
+ ]
+ },
+ "subject_level_3" : {
+ "size" : 12,
+ "styles" : [
+ "bold"
+ ]
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ },
+ {
+ "$ref" : "#/$defs/margin"
+ }
+ ]
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/margin"
+ }
+ ]
+ },
+ "markdown" : {
+ "type" : "object",
+ "title" : "Markdown Styling",
+ "description" : "Styling for content of work package description and long text custom fields",
+ "x-example" : {
+ "markdown" : {
+ "font" : {},
+ "header" : {},
+ "header_1" : {},
+ "header_2" : {},
+ "header_3" : {},
+ "paragraph" : {},
+ "unordered_list" : {},
+ "unordered_list_point" : {},
+ "ordered_list" : {},
+ "ordered_list_point" : {},
+ "task_list" : {},
+ "task_list_point" : {},
+ "link" : {},
+ "code" : {},
+ "blockquote" : {},
+ "codeblock" : {},
+ "table" : {}
+ }
+ },
+ "properties" : {
+ "font" : {
+ "$ref" : "#/$defs/font"
+ },
+ "paragraph" : {
+ "title" : "Markdown paragraph",
+ "description" : "A block of text",
+ "type" : "object",
+ "properties" : {
+ "align" : {
+ "type" : "string",
+ "enum" : [
+ "left",
+ "center",
+ "right",
+ "justify"
+ ]
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ },
+ {
+ "$ref" : "#/$defs/padding"
+ }
+ ],
+ "x-example" : {
+ "paragraph" : {
+ "align" : "justify",
+ "padding_bottom" : "2mm"
+ }
+ }
+ },
+ "table" : {
+ "type" : "object",
+ "title" : "Markdown table",
+ "x-example" : {
+ "table" : {
+ "auto_width" : true,
+ "header" : {
+ "background_color" : "F0F0F0",
+ "no_repeating" : true,
+ "size" : 12
+ },
+ "cell" : {
+ "background_color" : "000FFF",
+ "size" : 10
+ }
+ }
+ },
+ "properties" : {
+ "auto_width" : {
+ "title" : "Automatic column widths",
+ "description" : "Table columns should fit the content, equal spacing of columns if value is `false`",
+ "type" : "boolean"
+ },
+ "header" : {
+ "$ref" : "#/$defs/table_header"
+ },
+ "cell" : {
+ "$ref" : "#/$defs/table_cell"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/margin"
+ },
+ {
+ "$ref" : "#/$defs/border"
+ }
+ ]
+ },
+ "html_table" : {
+ "type" : "object",
+ "title" : "HTML table",
+ "x-example" : {
+ "table" : {
+ "auto_width" : true,
+ "header" : {
+ "background_color" : "F0F0F0",
+ "no_repeating" : true,
+ "size" : 12
+ },
+ "cell" : {
+ "background_color" : "000FFF",
+ "size" : 10
+ }
+ }
+ },
+ "properties" : {
+ "auto_width" : {
+ "title" : "Automatic column widths",
+ "description" : "Table columns should fit the content, equal spacing of columns if value is `false`",
+ "type" : "boolean"
+ },
+ "header" : {
+ "$ref" : "#/$defs/table_header"
+ },
+ "cell" : {
+ "$ref" : "#/$defs/table_cell"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/margin"
+ },
+ {
+ "$ref" : "#/$defs/border"
+ }
+ ]
+ },
+ "headless_table" : {
+ "type" : "object",
+ "title" : "Markdown headless table",
+ "description" : "Tables without or empty header rows can be styled differently.",
+ "x-example" : {
+ "headless_table" : {
+ "auto_width" : true,
+ "cell" : {
+ "style" : "underline",
+ "background_color" : "000FFF"
+ }
+ }
+ },
+ "properties" : {
+ "auto_width" : {
+ "title" : "Automatic column widths",
+ "description" : "Table columns should fit the content, equal spacing of columns if value is `false`",
+ "type" : "boolean"
+ },
+ "cell" : {
+ "$ref" : "#/$defs/table_cell"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/margin"
+ },
+ {
+ "$ref" : "#/$defs/border"
+ }
+ ]
+ },
+ "code" : {
+ "type" : "object",
+ "title" : "Markdown code",
+ "description" : "Styling to denote a word or phrase as code",
+ "x-example" : {
+ "code" : {
+ "font" : "Consolas",
+ "color" : "880000"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ }
+ ]
+ },
+ "codeblock" : {
+ "type" : "object",
+ "title" : "Markdown code block",
+ "description" : "Styling to denote a paragraph as code",
+ "x-example" : {
+ "codeblock" : {
+ "background_color" : "F5F5F5",
+ "font" : "Consolas",
+ "size" : 8,
+ "color" : "880000",
+ "padding" : "3mm",
+ "margin_top" : "2mm",
+ "margin_bottom" : "2mm"
+ }
+ },
+ "properties" : {
+ "background_color" : {
+ "$ref" : "#/$defs/color"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ },
+ {
+ "$ref" : "#/$defs/padding"
+ },
+ {
+ "$ref" : "#/$defs/margin"
+ }
+ ]
+ },
+ "link" : {
+ "type" : "object",
+ "title" : "Markdown Link",
+ "description" : "Styling a clickable link",
+ "x-example" : {
+ "link" : {
+ "color" : "000088"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ }
+ ]
+ },
+ "image" : {
+ "type" : "object",
+ "title" : "Markdown image",
+ "description" : "Styling of images",
+ "x-example" : {
+ "image" : {
+ "max_width" : "50mm",
+ "margin" : "2mm",
+ "margin_bottom" : "3mm",
+ "align" : "center",
+ "caption" : {
+ "align" : "center",
+ "size" : 8
+ }
+ }
+ },
+ "properties" : {
+ "max_width" : {
+ "$ref" : "#/$defs/measurement",
+ "title" : "Maximum width of the image"
+ },
+ "align" : {
+ "$ref" : "#/$defs/alignment"
+ },
+ "caption" : {
+ "title" : "Image caption",
+ "description" : "Styling for the caption below an image",
+ "type" : "object",
+ "properties" : {
+ "align" : {
+ "type" : "string",
+ "enum" : [
+ "left",
+ "center",
+ "right",
+ "justify"
+ ]
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ },
+ {
+ "$ref" : "#/$defs/padding"
+ }
+ ]
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/margin"
+ }
+ ]
+ },
+ "hrule" : {
+ "type" : "object",
+ "title" : "Markdown horizontal rule",
+ "description" : "Styling for horizontal lines",
+ "properties" : {
+ "line_width" : {
+ "title" : "Sets the stroke width of the horizontal rule",
+ "$ref" : "#/$defs/measurement"
+ }
+ },
+ "x-example" : {
+ "hrule" : {
+ "line_width" : 1
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/margin"
+ }
+ ]
+ },
+ "header" : {
+ "title" : "Markdown header",
+ "description" : "Default styling for headers on all levels.<br/>use header_`x` as key for header level `x`.",
+ "$ref" : "#/$defs/header"
+ },
+ "blockquote" : {
+ "type" : "object",
+ "title" : "Markdown blockquote",
+ "description" : "Styling to denote a paragraph as quote",
+ "x-example" : {
+ "blockquote" : {
+ "background_color" : "f4f9ff",
+ "size" : 14,
+ "styles" : [
+ "italic"
+ ],
+ "color" : "0f3b66",
+ "border_color" : "b8d6f4",
+ "border_width" : 1,
+ "no_border_right" : true,
+ "no_border_left" : false,
+ "no_border_bottom" : true,
+ "no_border_top" : true
+ }
+ },
+ "properties" : {
+ "background_color" : {
+ "$ref" : "#/$defs/color"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ },
+ {
+ "$ref" : "#/$defs/border"
+ },
+ {
+ "$ref" : "#/$defs/padding"
+ },
+ {
+ "$ref" : "#/$defs/margin"
+ }
+ ]
+ },
+ "ordered_list" : {
+ "title" : "Markdown ordered list",
+ "description" : "Default styling for ordered lists on all levels.<br/>use ordered_list_`x` as key for ordered list level `x`.",
+ "$ref" : "#/$defs/ordered_list"
+ },
+ "ordered_list_point" : {
+ "title" : "Markdown ordered list point",
+ "description" : "Default styling for ordered list points on all levels.<br/>use ordered_list_point_`x` as key for ordered list points level `x`.",
+ "$ref" : "#/$defs/ordered_list_point"
+ },
+ "unordered_list" : {
+ "title" : "Markdown unordered list",
+ "description" : "Default styling for unordered lists on all levels.<br/>use unordered_list_`x` as key for unordered list level `x`.",
+ "$ref" : "#/$defs/unordered_list"
+ },
+ "unordered_list_point" : {
+ "title" : "Markdown unordered list point",
+ "description" : "Default styling for unordered list points on all levels.<br/>use unordered_list_point_`x` as key for unordered list points level `x`.",
+ "$ref" : "#/$defs/unordered_list_point"
+ },
+ "task_list" : {
+ "title" : "Markdown task list",
+ "x-example" : {
+ "task_list" : {
+ "spacing" : "2mm"
+ }
+ },
+ "$ref" : "#/$defs/unordered_list"
+ },
+ "task_list_point" : {
+ "title" : "Markdown task list point",
+ "$ref" : "#/$defs/task_list_point"
+ },
+ "alerts": {
+ "$ref": "#/$defs/alerts"
+ }
+ },
+ "patternProperties" : {
+ "^ordered_list_point_\\d+" : {
+ "title" : "Markdown ordered list point level",
+ "$ref" : "#/$defs/ordered_list_point"
+ },
+ "^ordered_list_\\d+" : {
+ "title" : "Markdown ordered list level",
+ "$ref" : "#/$defs/ordered_list"
+ },
+ "^unordered_list_point_\\d+" : {
+ "title" : "Markdown unordered list point level",
+ "$ref" : "#/$defs/unordered_list_point"
+ },
+ "^unordered_list_\\d+" : {
+ "title" : "Markdown unordered List Level",
+ "$ref" : "#/$defs/unordered_list"
+ },
+ "^header_\\d+" : {
+ "title" : "Markdown header level",
+ "$ref" : "#/$defs/header"
+ }
+ }
+ },
+ "color" : {
+ "type" : "string",
+ "title" : "Color",
+ "description" : "A color in RRGGBB format",
+ "examples" : [
+ "F0F0F0"
+ ],
+ "x-example" : {
+ "color" : "F0F0F0"
+ },
+ "pattern" : "^(?:[0-9a-fA-F]{3}){1,2}$"
+ },
+ "font" : {
+ "title" : "Font properties",
+ "description" : "Properties to set the font style",
+ "type" : "object",
+ "x-example" : {
+ "font" : "OpenSans",
+ "size" : 10,
+ "character_spacing" : 0,
+ "styles" : [],
+ "color" : "000000",
+ "leading" : 2
+ },
+ "properties" : {
+ "font" : {
+ "type" : "string"
+ },
+ "size" : {
+ "$ref" : "#/$defs/measurement"
+ },
+ "character_spacing" : {
+ "$ref" : "#/$defs/measurement"
+ },
+ "leading" : {
+ "$ref" : "#/$defs/measurement"
+ },
+ "color" : {
+ "$ref" : "#/$defs/color"
+ },
+ "styles" : {
+ "type" : "array",
+ "items" : {
+ "$ref" : "#/$defs/font_style"
+ }
+ }
+ }
+ },
+ "font_style" : {
+ "type" : "string",
+ "title" : "Font Style",
+ "description" : "Style of the font to use",
+ "examples" : [
+ "bold"
+ ],
+ "enum" : [
+ "bold",
+ "italic",
+ "underline",
+ "strikethrough",
+ "superscript",
+ "subscript"
+ ]
+ },
+ "page" : {
+ "title" : "Page settings",
+ "description" : "Properties to set the basic page settings",
+ "type" : "object",
+ "x-example" : {
+ "page" : {
+ "page_size" : "EXECUTIVE",
+ "margin_top" : 60,
+ "margin_bottom" : 60,
+ "margin_left" : 36,
+ "margin_right" : 36,
+ "page_break_threshold" : 200,
+ "link_color" : "175A8E"
+ }
+ },
+ "properties" : {
+ "link_color" : {
+ "title" : "Link color",
+ "description" : "Set the color of clickable links",
+ "$ref" : "#/$defs/color"
+ },
+ "page_layout" : {
+ "title" : "Page layout",
+ "description" : "The layout of a page",
+ "type" : "string",
+ "examples" : [
+ "portrait"
+ ],
+ "enum" : [
+ "portrait",
+ "landscape"
+ ]
+ },
+ "page_size" : {
+ "type" : "string",
+ "title" : "Page size",
+ "description" : "The size of a page",
+ "examples" : [
+ "EXECUTIVE"
+ ],
+ "enum" : [
+ "EXECUTIVE",
+ "TABLOID",
+ "LETTER",
+ "LEGAL",
+ "FOLIO",
+ "A0",
+ "A1",
+ "A2",
+ "A3",
+ "A4",
+ "A5",
+ "A6",
+ "A7",
+ "A8",
+ "A9",
+ "A10",
+ "B0",
+ "B1",
+ "B2",
+ "B3",
+ "B4",
+ "B5",
+ "B6",
+ "B7",
+ "B8",
+ "B9",
+ "B10",
+ "C0",
+ "C1",
+ "C2",
+ "C3",
+ "C4",
+ "C5",
+ "C6",
+ "C7",
+ "C8",
+ "C9",
+ "C10",
+ "RA0",
+ "RA1",
+ "RA2",
+ "RA3",
+ "RA4",
+ "SRA0",
+ "SRA1",
+ "SRA2",
+ "SRA3",
+ "SRA4",
+ "4A0",
+ "2A0"
+ ]
+ },
+ "page_break_threshold" : {
+ "title" : "Page break threshold",
+ "description" : "If there is a new section, start a new page if space less than the threshold is available",
+ "$ref" : "#/$defs/measurement"
+ }
+ },
+ "allOf" : [
+ {
+ "title" : "Default font settings",
+ "$ref" : "#/$defs/font"
+ },
+ {
+ "title" : "Page margins",
+ "$ref" : "#/$defs/margin"
+ }
+ ]
+ },
+ "page_heading" : {
+ "title" : "Page heading",
+ "description" : "The main page title heading",
+ "x-example" : {
+ "page_heading" : {
+ "size" : 14,
+ "styles" : [
+ "bold"
+ ],
+ "margin_bottom" : 10
+ }
+ },
+ "type" : "object",
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ },
+ {
+ "$ref" : "#/$defs/margin"
+ }
+ ]
+ },
+ "page_footer" : {
+ "type" : "object",
+ "title" : "Page footers",
+ "x-example" : {
+ "page_footer" : {
+ "offset" : -30,
+ "size" : 8
+ }
+ },
+ "properties" : {
+ "offset" : {
+ "title" : "Offset position from page bottom",
+ "examples" : [
+ -30
+ ],
+ "$ref" : "#/$defs/measurement_signed"
+ },
+ "spacing" : {
+ "title" : "Minimum spacing between different page footers",
+ "examples" : [
+ 8
+ ],
+ "$ref" : "#/$defs/measurement"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ }
+ ]
+ },
+ "page_header" : {
+ "type" : "object",
+ "title" : "Page headers",
+ "x-example" : {
+ "page_header" : {
+ "align" : "left",
+ "offset" : 20,
+ "size" : 8
+ }
+ },
+ "properties" : {
+ "align" : {
+ "$ref" : "#/$defs/alignment"
+ },
+ "offset" : {
+ "title" : "Offset position from page top",
+ "examples" : [
+ -30
+ ],
+ "$ref" : "#/$defs/measurement_signed"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ }
+ ]
+ },
+ "page_logo" : {
+ "title" : "Page logo",
+ "description" : "Styling for logo image in the page header.",
+ "type" : "object",
+ "x-example" : {
+ "page_logo" : {
+ "height" : 20,
+ "align" : "right"
+ }
+ },
+ "properties" : {
+ "height" : {
+ "$ref" : "#/$defs/measurement",
+ "title" : "Height of the image"
+ },
+ "align" : {
+ "$ref" : "#/$defs/alignment"
+ },
+ "offset" : {
+ "title" : "Offset position from page top",
+ "examples" : [
+ -30
+ ],
+ "$ref" : "#/$defs/measurement_signed"
+ }
+ }
+ },
+ "margin" : {
+ "title" : "Margin properties",
+ "description" : "Properties to set margins",
+ "type" : "object",
+ "x-example" : {
+ "margin" : "10mm",
+ "margin_top" : "15mm"
+ },
+ "properties" : {
+ "margin" : {
+ "title" : "Margin",
+ "description" : "One value for margin on all sides",
+ "$ref" : "#/$defs/measurement"
+ },
+ "margin_left" : {
+ "title" : "Margin left",
+ "description" : "Margin only on the left side",
+ "$ref" : "#/$defs/measurement"
+ },
+ "margin_right" : {
+ "title" : "Margin right",
+ "description" : "Margin only on the right side",
+ "$ref" : "#/$defs/measurement"
+ },
+ "margin_top" : {
+ "title" : "Margin top",
+ "description" : "Margin only on the top side",
+ "$ref" : "#/$defs/measurement"
+ },
+ "margin_bottom" : {
+ "title" : "Margin bottom",
+ "description" : "Margin only on the bottom side",
+ "$ref" : "#/$defs/measurement"
+ }
+ }
+ },
+ "padding" : {
+ "title" : "Padding Properties",
+ "description" : "Properties to set paddings",
+ "type" : "object",
+ "x-example" : {
+ "padding" : "10mm",
+ "padding_top" : "15mm"
+ },
+ "properties" : {
+ "padding" : {
+ "title" : "Padding",
+ "description" : "One value for padding on all sides",
+ "$ref" : "#/$defs/measurement"
+ },
+ "padding_left" : {
+ "title" : "Padding left",
+ "description" : "Padding only on the left side",
+ "$ref" : "#/$defs/measurement"
+ },
+ "padding_right" : {
+ "title" : "Padding right",
+ "description" : "Padding only on the right side",
+ "$ref" : "#/$defs/measurement"
+ },
+ "padding_top" : {
+ "title" : "Padding top",
+ "description" : "Padding only on the top side",
+ "$ref" : "#/$defs/measurement"
+ },
+ "padding_bottom" : {
+ "title" : "Padding bottom",
+ "description" : "Padding only on the bottom side",
+ "$ref" : "#/$defs/measurement"
+ }
+ }
+ },
+ "measurement" : {
+ "type" : [
+ "number",
+ "string"
+ ],
+ "pattern" : "^([0-9\\.]+)(mm|cm|dm|m|in|ft|yr|pt)$",
+ "description" : "A number >= 0 and an optional unit",
+ "examples" : [
+ "10mm",
+ "10"
+ ]
+ },
+ "measurement_signed" : {
+ "type" : [
+ "number",
+ "string"
+ ],
+ "pattern" : "^-?([0-9\\.]+)(mm|cm|dm|m|in|ft|yr|pt)$",
+ "description" : "A positive or negative number and an optional unit"
+ },
+ "alignment" : {
+ "title" : "Alignment",
+ "description" : "How the element should be aligned",
+ "examples" : [
+ "center"
+ ],
+ "type" : "string",
+ "enum" : [
+ "left",
+ "center",
+ "right"
+ ]
+ },
+ "unordered_list" : {
+ "title" : "Markdown unordered list",
+ "x-example" : {
+ "unordered_list" : {
+ "spacing" : "1.5mm",
+ "padding_top" : "2mm",
+ "padding_bottom" : "2mm"
+ }
+ },
+ "type" : "object",
+ "properties" : {
+ "spacing" : {
+ "title" : "Spacing",
+ "description" : "Additional space between list items",
+ "$ref" : "#/$defs/measurement"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ },
+ {
+ "$ref" : "#/$defs/padding"
+ }
+ ]
+ },
+ "unordered_list_point" : {
+ "title" : "Markdown unordered list point",
+ "x-example" : {
+ "unordered_list_point" : {
+ "sign" : "•",
+ "spacing" : "0.75mm"
+ }
+ },
+ "type" : "object",
+ "properties" : {
+ "sign" : {
+ "title" : "Sign",
+ "description" : "The 'bullet point' character used in the list",
+ "type" : "string"
+ },
+ "spacing" : {
+ "title" : "Spacing",
+ "description" : "Space between point and list item content",
+ "$ref" : "#/$defs/measurement"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ }
+ ]
+ },
+ "task_list_point" : {
+ "type" : "object",
+ "title" : "Markdown task list point",
+ "x-example" : {
+ "task_list_point" : {
+ "checked" : "☑",
+ "unchecked" : "☐",
+ "spacing" : "0.75mm"
+ }
+ },
+ "properties" : {
+ "checked" : {
+ "title" : "Checked sign",
+ "description" : "Sign for checked state of a task list item",
+ "type" : "string"
+ },
+ "unchecked" : {
+ "title" : "Unchecked sign",
+ "description" : "Sign for unchecked state of a task list item",
+ "type" : "string"
+ },
+ "spacing" : {
+ "title" : "Spacing",
+ "description" : "Additional space between point and list item content",
+ "$ref" : "#/$defs/measurement"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ }
+ ]
+ },
+ "ordered_list" : {
+ "title" : "Markdown ordered list",
+ "x-example" : {
+ "ordered_list" : {
+ "spacing" : "2mm",
+ "point_inline" : false
+ }
+ },
+ "type" : "object",
+ "properties" : {
+ "spacing" : {
+ "title" : "Spacing",
+ "description" : "Additional space between list items",
+ "$ref" : "#/$defs/measurement"
+ },
+ "point_inline" : {
+ "title" : "Inline Point",
+ "description" : "Do not indent paragraph text, but include the point into the first paragraph",
+ "type" : "boolean"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ },
+ {
+ "$ref" : "#/$defs/padding"
+ }
+ ]
+ },
+ "ordered_list_point" : {
+ "title" : "Markdown ordered list point",
+ "type" : "object",
+ "x-example" : {
+ "ordered_list_point" : {
+ "template" : "<number>.",
+ "list_style_type" : "decimal",
+ "spacing" : "0.75mm",
+ "spanning" : true
+ }
+ },
+ "properties" : {
+ "spacing" : {
+ "$ref" : "#/$defs/measurement"
+ },
+ "alphabetical": {
+ "title": "Alphabetical bullet points",
+ "description": "(deprecated; use list_style_type) Convert the list item number into a character, eg. `a.` `b.` `c.`",
+ "type": "boolean"
+ },
+ "list_style_type": {
+ "title": "List style type",
+ "description": "The style of the list bullet points, eg. `decimal`, `lower-latin`, `upper-roman`",
+ "type": "string",
+ "enum": [
+ "decimal",
+ "lower-latin",
+ "lower-roman",
+ "upper-latin",
+ "upper-roman"
+ ]
+ },
+ "spanning" : {
+ "title" : "Spanning",
+ "description" : "Use the width of the largest bullet as indention.",
+ "type" : "boolean"
+ },
+ "template" : {
+ "title" : "Template",
+ "description" : "customize what the prefix should contain, eg. `(<number>)`",
+ "type" : "string"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ }
+ ]
+ },
+ "header" : {
+ "type" : "object",
+ "title" : "Markdown header",
+ "x-example" : {
+ "header" : {
+ "styles" : [
+ "bold"
+ ],
+ "padding_top" : "2mm",
+ "padding_bottom" : "2mm"
+ },
+ "header_1" : {
+ "size" : 14,
+ "styles" : [
+ "bold",
+ "italic"
+ ]
+ },
+ "header_2" : {
+ "size" : 12,
+ "styles" : [
+ "bold"
+ ]
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ },
+ {
+ "$ref" : "#/$defs/padding"
+ }
+ ]
+ },
+ "table_cell" : {
+ "type" : "object",
+ "title" : "Table cell",
+ "description" : "Styling for a table cell",
+ "x-example" : {
+ "table_cell" : {
+ "size" : 9,
+ "color" : "000000",
+ "padding" : 5,
+ "border_width" : 1
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ },
+ {
+ "$ref" : "#/$defs/padding"
+ },
+ {
+ "$ref" : "#/$defs/border"
+ }
+ ]
+ },
+ "table_header" : {
+ "type" : "object",
+ "title" : "Table header cell",
+ "description" : "Styling for a table header cell",
+ "x-example" : {
+ "table_header" : {
+ "size" : 9,
+ "styles" : [
+ "bold"
+ ]
+ }
+ },
+ "properties" : {
+ "background_color" : {
+ "$ref" : "#/$defs/color"
+ },
+ "no_repeating" : {
+ "type" : "boolean"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ },
+ {
+ "$ref" : "#/$defs/padding"
+ },
+ {
+ "$ref" : "#/$defs/border"
+ }
+ ]
+ },
+ "paragraph" : {
+ "type" : "object",
+ "title" : "Markdown paragraph",
+ "properties" : {
+ "align" : {
+ "type" : "string",
+ "enum" : [
+ "left",
+ "center",
+ "right",
+ "justify"
+ ]
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/font"
+ },
+ {
+ "$ref" : "#/$defs/padding"
+ }
+ ]
+ },
+ "border" : {
+ "type" : "object",
+ "title" : "Border Properties",
+ "description" : "Properties to set borders",
+ "x-example" : {
+ "border_color" : "F000FF",
+ "border_color_top" : "000FFF",
+ "border_color_bottom" : "FFF000",
+ "no_border_left" : true,
+ "no_border_right" : true,
+ "border_width" : "0.25mm",
+ "border_width_left" : "0.5mm",
+ "border_width_right" : "0.5mm"
+ },
+ "properties" : {
+ "border_width" : {
+ "title" : "Border width",
+ "description" : "One value for border line width on all sides",
+ "$ref" : "#/$defs/measurement"
+ },
+ "border_width_left" : {
+ "title" : "Border width left",
+ "description" : "Border width only on the left side",
+ "$ref" : "#/$defs/measurement"
+ },
+ "border_width_top" : {
+ "title" : "Border width top",
+ "description" : "Border width only on the top side",
+ "$ref" : "#/$defs/measurement"
+ },
+ "border_width_right" : {
+ "title" : "Border width right",
+ "description" : "Border width only on the right side",
+ "$ref" : "#/$defs/measurement"
+ },
+ "border_width_bottom" : {
+ "title" : "Border width bottom",
+ "description" : "Border width only on the bottom side",
+ "$ref" : "#/$defs/measurement"
+ },
+ "border_color" : {
+ "title" : "Border color",
+ "description" : "One value for border color on all sides",
+ "$ref" : "#/$defs/color"
+ },
+ "border_color_left" : {
+ "title" : "Border color left",
+ "description" : "Border color only on the left side",
+ "$ref" : "#/$defs/color"
+ },
+ "border_color_top" : {
+ "title" : "Border color top",
+ "description" : "Border color only on the top side",
+ "$ref" : "#/$defs/color"
+ },
+ "border_color_right" : {
+ "title" : "Border color right",
+ "description" : "Border color only on the right side",
+ "$ref" : "#/$defs/color"
+ },
+ "border_color_bottom" : {
+ "title" : "Border color bottom",
+ "description" : "Border color only on the bottom side",
+ "$ref" : "#/$defs/color"
+ },
+ "no_border" : {
+ "title" : "Disable borders",
+ "description" : "Turn off borders on all sides",
+ "type" : "boolean"
+ },
+ "no_border_left" : {
+ "title" : "Disable border left",
+ "description" : "Turn off border on the left sides",
+ "type" : "boolean"
+ },
+ "no_border_top" : {
+ "title" : "Disable border top",
+ "description" : "Turn off border on the top sides",
+ "type" : "boolean"
+ },
+ "no_border_right" : {
+ "title" : "Disable border right",
+ "description" : "Turn off border on the right sides",
+ "type" : "boolean"
+ },
+ "no_border_bottom" : {
+ "title" : "Disable border bottom",
+ "description" : "Turn off border on the bottom sides",
+ "type" : "boolean"
+ }
+ }
+ },
+ "alert": {
+ "type": "object",
+ "title": "Alert",
+ "description": "Styling to denote a quote as alert box",
+ "x-example": {
+ "ALERT": {
+ "alert_color": "f4f9ff",
+ "border_color": "f4f9ff",
+ "border_width": 2,
+ "no_border_right": true,
+ "no_border_left": false,
+ "no_border_bottom": true,
+ "no_border_top": true
+ }
+ },
+ "properties": {
+ "background_color": {
+ "$ref": "#/$defs/color"
+ },
+ "alert_color": {
+ "$ref": "#/$defs/color"
+ }
+ },
+ "allOf": [
+ {
+ "$ref": "#/$defs/font"
+ },
+ {
+ "$ref": "#/$defs/border"
+ },
+ {
+ "$ref": "#/$defs/padding"
+ },
+ {
+ "$ref": "#/$defs/margin"
+ }
+ ]
+ },
+ "alerts": {
+ "type": "object",
+ "title": "alert boxes (styled blockquotes)",
+ "properties": {
+ "NOTE": {
+ "$ref": "#/$defs/alert"
+ },
+ "TIP": {
+ "$ref": "#/$defs/alert"
+ },
+ "WARNING": {
+ "$ref": "#/$defs/alert"
+ },
+ "IMPORTANT": {
+ "$ref": "#/$defs/alert"
+ },
+ "CAUTION": {
+ "$ref": "#/$defs/alert"
+ }
+ }
+ }
+ }
+}
diff --git a/app/models/work_package/pdf_export/export/wp/standard.yml b/app/models/work_package/pdf_export/export/wp/standard.yml
new file mode 100644
index 00000000000..761590b573a
--- /dev/null
+++ b/app/models/work_package/pdf_export/export/wp/standard.yml
@@ -0,0 +1,233 @@
+page:
+ page_size: "A4"
+ margin_top: 60
+ margin_bottom: 60
+ margin_left: 36
+ margin_right: 36
+ page_break_threshold: 200
+ link_color: "175A8E"
+
+page_header:
+ offset: 20
+ size: 8
+
+page_footer:
+ offset: -30
+ size: 8
+ spacing: 6
+
+page_logo:
+ height: 20
+ align: "right"
+
+page_heading:
+ size: 14
+ styles: [ "bold" ]
+ margin_bottom: 10
+
+work_package:
+ margin_bottom: 14
+ subject:
+ size: 10
+ margin_bottom: 10
+ subject_level_1:
+ size: 14
+ styles: [ "bold" ]
+ subject_level_2:
+ size: 13
+ styles: [ "bold" ]
+ subject_level_3:
+ size: 12
+ styles: [ "bold" ]
+ subject_level_4:
+ size: 11
+ styles: [ "bold" ]
+ subject_level_5:
+ styles: [ "bold" ]
+ subject_level_6:
+ styles: [ "bold" ]
+ subject_level_7:
+ styles: [ "bold" ]
+ subject_level_8:
+ styles: [ "bold" ]
+ subject_level_9:
+ styles: [ "bold" ]
+ subject_level_10:
+ styles: [ "bold" ]
+ attributes_table:
+ margin_bottom: 16
+ cell:
+ size: 9
+ color: "000000"
+ padding_left: 0
+ padding_right: 5
+ padding_top: 0
+ padding_bottom: 5
+ no_border: true
+ cell_label:
+ styles: [ "bold" ]
+ markdown_label:
+ size: 12
+ styles: [ "bold" ]
+ margin_top: 0
+ margin_bottom: 4
+ markdown_margin:
+ margin_bottom: 16
+ markdown:
+ font:
+ size: 10
+ leading: 3
+ header:
+ size: 8
+ styles: [ "bold" ]
+ padding_top: 4
+ header_1:
+ size: 10
+ header_2:
+ size: 10
+ header_3:
+ size: 9
+ paragraph:
+ align: "left"
+ unordered_list:
+ spacing: 1
+ unordered_list_point:
+ spacing: 4
+ ordered_list:
+ spacing: 1
+ ordered_list_point:
+ spacing: 4
+ spanning: true
+ list_style_type: decimal
+ ordered_list_point_2:
+ list_style_type: lower-latin
+ ordered_list_point_3:
+ list_style_type: lower-roman
+ ordered_list_point_4:
+ list_style_type: upper-latin
+ ordered_list_point_5:
+ list_style_type: upper-roman
+ task_list:
+ spacing: 1
+ task_list_point:
+ spacing: 4
+ checked: "☑"
+ unchecked: "☐"
+ link:
+ color: "175A8E"
+ styles: [ ]
+ code:
+ color: "880000"
+ size: 9
+ font: "SpaceMono"
+ blockquote:
+ background_color: "f4f9ff"
+ size: 10
+ styles: [ "italic" ]
+ color: "0f3b66"
+ border_color: "b8d6f4"
+ border_width: 1
+ padding: 4
+ padding_left: 6
+ margin_top: 4
+ margin_bottom: 4
+ no_border_left: false
+ no_border_right: true
+ no_border_bottom: true
+ no_border_top: true
+ image:
+ align: "center"
+ margin_bottom: 4
+ caption:
+ size: 8
+ align: "center"
+ codeblock:
+ background_color: "F5F5F5"
+ color: "880000"
+ padding: 10
+ size: 8
+ margin_top: 10
+ margin_bottom: 10
+ font: "SpaceMono"
+ table:
+ auto_width: true
+ margin_top: 4
+ margin_bottom: 4
+ header:
+ size: 9
+ styles: [ "bold" ]
+ background_color: "F0F0F0"
+ cell:
+ size: 8
+ border_width: 0.25
+ padding: 5
+ html_table:
+ auto_width: true
+ margin_top: 4
+ margin_bottom: 4
+ header:
+ size: 9
+ styles: [ "bold" ]
+ cell:
+ size: 8
+ border_width: 0.25
+ padding_right: 5
+ padding_top: 0
+ padding_left: 0
+ padding_bottom: 5
+ alerts:
+ NOTE:
+ border_color: '0969da'
+ alert_color: '0969da'
+ padding: '4mm'
+ size: 10
+ styles: [ ]
+ border_width: 2
+ no_border_right: true
+ no_border_left: false
+ no_border_bottom: true
+ no_border_top: true
+ TIP:
+ border_color: '1a7f37'
+ alert_color: '1a7f37'
+ padding: '4mm'
+ size: 10
+ styles: [ ]
+ border_width: 2
+ no_border_right: true
+ no_border_left: false
+ no_border_bottom: true
+ no_border_top: true
+ IMPORTANT:
+ border_color: '8250df'
+ alert_color: '8250df'
+ padding: '4mm'
+ size: 10
+ styles: [ ]
+ border_width: 2
+ no_border_right: true
+ no_border_left: false
+ no_border_bottom: true
+ no_border_top: true
+ WARNING:
+ border_color: 'bf8700'
+ alert_color: 'bf8700'
+ padding: '4mm'
+ size: 10
+ styles: [ ]
+ border_width: 2
+ no_border_right: true
+ no_border_left: false
+ no_border_bottom: true
+ no_border_top: true
+ CAUTION:
+ border_color: 'd1242f'
+ alert_color: 'd1242f'
+ size: 10
+ styles: [ ]
+ padding: '4mm'
+ border_width: 2
+ no_border_right: true
+ no_border_left: false
+ no_border_bottom: true
+ no_border_top: true
diff --git a/app/models/work_package/pdf_export/export/wp/styles.rb b/app/models/work_package/pdf_export/export/wp/styles.rb
new file mode 100644
index 00000000000..6b8dcbe85eb
--- /dev/null
+++ b/app/models/work_package/pdf_export/export/wp/styles.rb
@@ -0,0 +1,99 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+module WorkPackage::PDFExport::Export::Wp::Styles
+ include MarkdownToPDF::StyleValidation
+
+ class PDFStyles
+ include MarkdownToPDF::Common
+ include MarkdownToPDF::StyleHelper
+ include WorkPackage::PDFExport::Common::Styles
+
+ def wp_margins
+ resolve_margin(@styles[:work_package])
+ end
+
+ def wp_subject(level)
+ resolve_font(@styles.dig(:work_package, :subject)).merge(
+ resolve_font(@styles.dig(:work_package, :"subject_level_#{level}"))
+ )
+ end
+
+ def wp_detail_subject_margins
+ resolve_margin(@styles.dig(:work_package, :subject))
+ end
+
+ def wp_attributes_table_margins
+ resolve_margin(@styles.dig(:work_package, :attributes_table))
+ end
+
+ def wp_attributes_table_cell
+ resolve_table_cell(@styles.dig(:work_package, :attributes_table, :cell))
+ end
+
+ def wp_attributes_table_label_cell
+ wp_attributes_table_cell.merge(
+ resolve_table_cell(@styles.dig(:work_package, :attributes_table, :cell_label))
+ )
+ end
+
+ def wp_markdown_label
+ resolve_font(@styles.dig(:work_package, :markdown_label))
+ end
+
+ def wp_markdown_label_margins
+ resolve_margin(@styles.dig(:work_package, :markdown_label))
+ end
+
+ def wp_markdown_margins
+ resolve_margin(@styles.dig(:work_package, :markdown_margin))
+ end
+
+ def wp_markdown_styling_yml
+ resolve_markdown_styling(@styles.dig(:work_package, :markdown) || {})
+ end
+ end
+
+ def styles
+ @styles ||= PDFStyles.new(load_style)
+ end
+
+ private
+
+ def load_style
+ yml = YAML::load_file(File.join(styles_asset_path, "standard.yml"))
+ schema = JSON::load_file(File.join(styles_asset_path, "schema.json"))
+ validate_schema!(yml, schema)
+ end
+
+ def styles_asset_path
+ File.dirname(File.expand_path(__FILE__))
+ end
+end
diff --git a/app/models/work_package/pdf_export/work_package_list_to_pdf.rb b/app/models/work_package/pdf_export/work_package_list_to_pdf.rb
index c9b55e65270..cb873be99ad 100644
--- a/app/models/work_package/pdf_export/work_package_list_to_pdf.rb
+++ b/app/models/work_package/pdf_export/work_package_list_to_pdf.rb
@@ -45,18 +45,16 @@ class WorkPackage::PDFExport::WorkPackageListToPdf < WorkPackage::Exports::Query
include WorkPackage::PDFExport::Common::Common
include WorkPackage::PDFExport::Common::Logo
include WorkPackage::PDFExport::Common::Attachments
- include WorkPackage::PDFExport::Export::ExportCommon
include WorkPackage::PDFExport::Export::Page
- include WorkPackage::PDFExport::Export::Style
- include WorkPackage::PDFExport::Export::OverviewTable
- include WorkPackage::PDFExport::Export::SumsTable
include WorkPackage::PDFExport::Export::MarkdownField
include WorkPackage::PDFExport::Export::WorkPackageDetail
- include WorkPackage::PDFExport::Export::TableOfContents
- include WorkPackage::PDFExport::Export::Style
+ include WorkPackage::PDFExport::Export::Report::Styles
+ include WorkPackage::PDFExport::Export::Report::OverviewTable
+ include WorkPackage::PDFExport::Export::Report::SumsTable
+ include WorkPackage::PDFExport::Export::Report::TableOfContents
+ include WorkPackage::PDFExport::Export::Report::Attributes
include WorkPackage::PDFExport::Export::Cover
include WorkPackage::PDFExport::Export::Gantt
- include WorkPackage::PDFExport::Export::AttributesByColumns
attr_accessor :pdf,
:options
@@ -110,10 +108,22 @@ class WorkPackage::PDFExport::WorkPackageListToPdf < WorkPackage::Exports::Query
file
end
+ def with_sums_table?
+ query.display_sums?
+ end
+
def wants_total_page_nrs?
true
end
+ def wants_report?
+ options[:pdf_export_type] == "report"
+ end
+
+ def wants_gantt?
+ options[:pdf_export_type] == "gantt"
+ end
+
def with_cover?
wants_report?
end
@@ -279,4 +289,16 @@ class WorkPackage::PDFExport::WorkPackageListToPdf < WorkPackage::Exports::Query
def with_images?
@with_images ||= ActiveModel::Type::Boolean.new.cast(options[:show_images])
end
+
+ def get_total_sums
+ query.display_sums? ? (query.results.all_total_sums || {}) : {}
+ end
+
+ def get_column_value_cell(work_package, column_name)
+ value = get_column_value(work_package, column_name)
+ return get_id_column_cell(work_package, value) if column_name == :id
+ return get_subject_column_cell(work_package, value) if wants_report? && column_name == :subject
+
+ escape_tags(value)
+ end
end
diff --git a/app/models/work_package/pdf_export/work_package_to_pdf.rb b/app/models/work_package/pdf_export/work_package_to_pdf.rb
index 389e586e011..892efb9251f 100644
--- a/app/models/work_package/pdf_export/work_package_to_pdf.rb
+++ b/app/models/work_package/pdf_export/work_package_to_pdf.rb
@@ -32,12 +32,11 @@ class WorkPackage::PDFExport::WorkPackageToPdf < Exports::Exporter
include WorkPackage::PDFExport::Common::Common
include WorkPackage::PDFExport::Common::Logo
include WorkPackage::PDFExport::Common::Attachments
- include WorkPackage::PDFExport::Export::ExportCommon
include WorkPackage::PDFExport::Export::MarkdownField
include WorkPackage::PDFExport::Export::WorkPackageDetail
include WorkPackage::PDFExport::Export::Page
- include WorkPackage::PDFExport::Export::Style
- include WorkPackage::PDFExport::Export::AttributesByForm
+ include WorkPackage::PDFExport::Export::Wp::Styles
+ include WorkPackage::PDFExport::Export::Wp::Attributes
attr_accessor :pdf, :columns
diff --git a/modules/reporting/app/workers/cost_query/pdf/timesheet_generator.rb b/modules/reporting/app/workers/cost_query/pdf/timesheet_generator.rb
index 9db7ae48bd5..9a8eacd6dbb 100644
--- a/modules/reporting/app/workers/cost_query/pdf/timesheet_generator.rb
+++ b/modules/reporting/app/workers/cost_query/pdf/timesheet_generator.rb
@@ -4,7 +4,7 @@ class CostQuery::PDF::TimesheetGenerator
include WorkPackage::PDFExport::Common::Logo
include WorkPackage::PDFExport::Export::Cover
include WorkPackage::PDFExport::Export::Page
- include WorkPackage::PDFExport::Export::Style
+ include WorkPackage::PDFExport::Export::Timesheet::Style
include ReportingHelper
H1_FONT_SIZE = 26
@@ -16,6 +16,7 @@ class CostQuery::PDF::TimesheetGenerator
COMMENT_FONT_COLOR = "636C76".freeze
H2_FONT_SIZE = 20
H2_MARGIN_BOTTOM = 10
+
COLUMN_DATE_WIDTH = 66
COLUMN_ACTIVITY_WIDTH = 100
COLUMN_HOURS_WIDTH = 60
diff --git a/spec/models/work_packages/pdf_export/work_package_to_pdf_spec.rb b/spec/models/work_packages/pdf_export/work_package_to_pdf_spec.rb
index e6844019e11..6d71a28c255 100644
--- a/spec/models/work_packages/pdf_export/work_package_to_pdf_spec.rb
+++ b/spec/models/work_packages/pdf_export/work_package_to_pdf_spec.rb
@@ -33,7 +33,8 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageToPdf do
include PDFExportSpecUtils
let(:type) do
create(:type_bug, custom_fields: [cf_long_text, cf_disabled_in_project, cf_global_bool]).tap do |t|
- t.attribute_groups.first.attributes.push(cf_disabled_in_project.attribute_name, cf_long_text.attribute_name)
+ t.attribute_groups = t.default_attribute_groups +
+ [["Custom Attributes Group", [cf_disabled_in_project.attribute_name, cf_long_text.attribute_name]]]
end
end
let(:parent_project) do
@@ -201,14 +202,19 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageToPdf do
end
end
let(:expected_details) do
- ["#{type.name} ##{work_package.id} - #{work_package.subject}"] +
- exporter.send(:attributes_data_by_wp, work_package)
- .flat_map do |item|
- value = get_column_value(item[:name])
- result = [item[:label].upcase]
- result << value if value.present?
- result
+ result = ["#{type.name} ##{work_package.id} - #{work_package.subject}"]
+ type.attribute_groups.each do |group|
+ result.push group.translated_key
+ group.attributes.each do |attribute|
+ columns = exporter.send(:form_key_to_column_entries, attribute.to_sym, work_package)
+ columns.each do |column|
+ result.push column[:label].upcase
+ value = get_column_value(column[:name])
+ result.push value if value.present?
+ end
end
+ end
+ result
end
def get_column_value(column_name)
@@ -219,7 +225,7 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageToPdf do
subject(:pdf) do
content = export_pdf.content
# If you want to actually see the PDF for debugging, uncomment the following line
- # File.binwrite('WorkPackageToPdf-test-preview.pdf', content)
+ # File.binwrite("WorkPackageToPdf-test-preview.pdf", content)
page_xobjects = PDF::Inspector::XObject.analyze(content).page_xobjects
images = page_xobjects.flat_map { |o| o.values.select { |v| v.hash[:Subtype] == :Image } }
logos = page_xobjects.flat_map do |o|
@@ -238,7 +244,8 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageToPdf do
let(:cf_long_text_description) { "foo" }
it "contains correct data" do
- result = pdf[:strings]
+ # Joining with space for comparison since word wrapping leads to a different array for the same content
+ result = pdf[:strings].join(" ")
expected_result = [
*expected_details,
label_title(:description),
@@ -246,12 +253,12 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageToPdf do
"amet", ", consetetur sadipscing elitr.", " ", "@OpenProject Admin",
"Image Caption",
"Foo",
+ "1", export_time_formatted, project.name,
cf_long_text.name, "foo",
- "1", export_time_formatted, project.name
- ].flatten
- # Joining the results for comparison since word wrapping leads to a different array for the same content
- expect(result.join(" ")).to eq(expected_result.join(" "))
- expect(result.join(" ")).not_to include("DisabledCustomField")
+ "2", export_time_formatted, project.name
+ ].flatten.join(" ")
+ expect(result).to eq(expected_result)
+ expect(result).not_to include("DisabledCustomField")
expect(pdf[:images].length).to eq(2)
end
end
@@ -330,10 +337,12 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageToPdf do
end
it "contains resolved attributes and labels" do
- result = pdf[:strings]
+ # Joining with space for comparison since word wrapping leads to a different array for the same content
+ result = pdf[:strings].join(" ")
expected_result = [
*expected_details,
label_title(:description),
+ "1", export_time_formatted, project.name,
"Work package attributes and labels",
supported_work_package_embeds.map do |embed|
[WorkPackage.human_attribute_name(
@@ -341,7 +350,6 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageToPdf do
), embed[1]]
end,
"Custom field boolean", I18n.t(:general_text_Yes),
- "1", export_time_formatted, project.name,
"Custom field rich text", "[#{I18n.t('export.macro.rich_text_unsupported')}]",
"No replacement of:", "workPackageValue:1:assignee", " ", "workPackageLabel:assignee",
"workPackageValue:2:assignee workPackageLabel:assignee",
@@ -353,8 +361,8 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageToPdf do
"[#{I18n.t('export.macro.error', message:
I18n.t('export.macro.resource_not_found', resource: "WorkPackage #{forbidden_work_package.id}"))}]",
"2", export_time_formatted, project.name
- ].flatten
- expect(result.join(" ")).to eq(expected_result.join(" "))
+ ].flatten.join(" ")
+ expect(result).to eq(expected_result)
end
end
@@ -414,8 +422,9 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageToPdf do
DESCRIPTION
end
- it "contains resolved attributes and labels" do # rubocop:disable RSpec/ExampleLength
- result = pdf[:strings]
+ it "contains resolved attributes and labels" do
+ # Joining with space for comparison since word wrapping leads to a different array for the same content
+ result = pdf[:strings].join(" ")
expected_result = [
*expected_details,
label_title(:description),
@@ -428,13 +437,13 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageToPdf do
"Custom field boolean", I18n.t(:general_text_Yes),
"Custom field rich text", "[#{I18n.t('export.macro.rich_text_unsupported')}]",
"Custom field hidden",
-
- "No replacement of:", "projectValue:1:status", "projectLabel:status",
- "projectValue:2:status projectLabel:status",
- "projectValue:3:status", "projectLabel:status",
+ "No replacement of:", "projectValue:1:status",
"1", export_time_formatted, project.name,
+ "projectLabel:status",
+ "projectValue:2:status projectLabel:status",
+ "projectValue:3:status", "projectLabel:status",
"Project by identifier:", " ", I18n.t(:general_text_Yes),
"Project not found: ",
"[#{I18n.t('export.macro.error', message:
@@ -445,8 +454,8 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageToPdf do
"Access denied by identifier:", " ", "[Macro error, resource not found: Project", "forbidden-project]",
"2", export_time_formatted, project.name
- ].flatten
- expect(result.join(" ")).to eq(expected_result.join(" "))
+ ].flatten.join(" ")
+ expect(result).to eq(expected_result)
end
end