OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[#60730] PDF export of meetings (#18714)
Andrej Sandorfc723673fe9fc
diff --git a/app/models/work_package/exports/macros/attributes.rb b/app/models/work_package/exports/macros/attributes.rbindex 4216a45462a..2a938e8bdd3 100644--- a/app/models/work_package/exports/macros/attributes.rb+++ b/app/models/work_package/exports/macros/attributes.rb@@ -63,19 +63,18 @@ module WorkPackage::Exportsenddef self.process_match(match, _matched_string, context)- context => { user:, work_package: }type = match[2].downcase- model_s = match[1]+ model_s = match[1].downcaseid = match[4] || match[3]attribute = match[6] || match[5]- resolve_match(type, model_s, id, attribute, work_package, user)+ resolve_match(type, model_s, id, attribute, context)end- def self.resolve_match(type, model_s, id, attribute, work_package, user)- if model_s == "workPackage"- resolve_work_package_match(id || work_package.id, type, attribute, user)+ def self.resolve_match(type, model_s, id, attribute, context)+ if model_s == "workpackage"+ resolve_work_package_match(id || context[:work_package]&.id, type, attribute, context[:user])elsif model_s == "project"- resolve_project_match(id || work_package.project.id, type, attribute, user)+ resolve_project_match(id || context[:project]&.id, type, attribute, context[:user])elsemsg_macro_error I18n.t("export.macro.model_not_found", model: model_s)enddiff --git a/app/models/work_package/exports/macros/links.rb b/app/models/work_package/exports/macros/links.rbnew file mode 100644index 00000000000..5f3b0dcb63b--- /dev/null+++ b/app/models/work_package/exports/macros/links.rb@@ -0,0 +1,61 @@+# 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::Exports+ module Macros+ class WorkPackagesLinkHandler < OpenProject::TextFormatting::Matchers::LinkHandlers::WorkPackages+ def applicable?+ %w(# ## ###).include?(matcher.sep) && matcher.prefix.blank?+ end++ def render_link(wp_id, matcher)+ link = "#{matcher.sep}#{wp_id}"+ "<mention class=\"mention\" data-id=\"#{wp_id}\" data-type=\"work_package\" data-text=\"#{link}\">#{+ link+ }</mention>"+ end+ end++ class Links < OpenProject::TextFormatting::Matchers::ResourceLinksMatcher+ def self.link_handlers+ [WorkPackagesLinkHandler]+ end++ def self.html_replacement?+ true+ end++ # Faster inclusion check before the full regex is being applied+ def self.applicable?(content)+ /#\d/.match(content)+ end+ end+ end+enddiff --git a/app/models/work_package/pdf_export/common/attachments.rb b/app/models/work_package/pdf_export/common/attachments.rbindex 75a3f820461..056c50c5c17 100644--- a/app/models/work_package/pdf_export/common/attachments.rb+++ b/app/models/work_package/pdf_export/common/attachments.rb@@ -30,21 +30,17 @@ require "mini_magick"module WorkPackage::PDFExport::Common::Attachmentsdef resize_image(file_path)- tmp_file = Tempfile.new(["temp_image", File.extname(file_path)])- @resized_images = [] if @resized_images.nil?-- @resized_images << tmp_file- resized_file_path = tmp_file.path+ tmp_file = temp_image_file(File.extname(file_path))image = MiniMagick::Image.open(file_path)image.resize("x800>")- image.write(resized_file_path)+ image.write(tmp_file)- resized_file_path+ tmp_fileenddef pdf_embeddable?(content_type)- %w[image/jpeg image/png].include?(content_type)+ %w[image/jpeg image/png image/gif].include?(content_type)enddef delete_all_resized_images@@ -59,18 +55,36 @@ module WorkPackage::PDFExport::Common::Attachmentsnil # return nil as if the id was wrong and the attachment obj has not been foundend- def attachment_image_filepath(work_package, src)+ def attachment_image_filepath(src)# images are embedded into markup with the api-path as img.src- attachment = attachment_by_api_content_src(work_package, src)+ attachment = attachment_by_api_content_src(src)return nil if attachment.nil? || !pdf_embeddable?(attachment.content_type)local_file = attachment_image_local_file(attachment)return nil if local_file.nil?- resize_image(local_file.path)+ filename = local_file.path+ filename = convert_gif_to_png(filename) if attachment.content_type == "image/gif"++ resize_image(filename)+ end++ def temp_image_file(extension)+ tmp_file = Tempfile.new(["temp_image", extension])+ @resized_images = [] if @resized_images.nil?+ @resized_images << tmp_file+ tmp_file.path+ end++ def convert_gif_to_png(filename)+ tmp_file = temp_image_file(".png")++ image = MiniMagick::Image.open(filename)+ image.frames.first.write(tmp_file)+ tmp_fileend- def attachment_by_api_content_src(_work_package, src)+ def attachment_by_api_content_src(src)attachment_regex = %r{/attachments/(\d+)/content}return nil unless src&.match?(attachment_regex)diff --git a/app/models/work_package/pdf_export/common/badge.rb b/app/models/work_package/pdf_export/common/badge.rbindex d2bb8b4c2fe..98bee7fc8a5 100644--- a/app/models/work_package/pdf_export/common/badge.rb+++ b/app/models/work_package/pdf_export/common/badge.rb@@ -33,7 +33,7 @@ module WorkPackage::PDFExport::Common::Badgedef initialize(options)@color = options[:color]@document = options[:document]- @radius = options[:radius]+ @radius = options[:radius] || 0@offset = options[:offset] || 0end@@ -45,21 +45,30 @@ module WorkPackage::PDFExport::Common::Badgeendend+ def calc_grayscale_brightness(red, green, blue)+ # The brightness is calculated using the formula:+ # https://entropymine.com/imageworsener/grayscale/+ Math.sqrt(+ (0.2126 * (red**2)) ++ (0.7152 * (green**2)) ++ (0.0722 * (blue**2))+ ).to_i+ end+def readable_color(pdf_background_color)- sum = [+ brightness = calc_grayscale_brightness(*[pdf_background_color[0..1],pdf_background_color[2..3],pdf_background_color[4..5]- ].sum { |color_part| color_part.to_i(16) }- lightness = sum / 3- lightness < 130 ? "FFFFFF" : "000000"+ ].map { |color_part| color_part.to_i(16) })+ brightness < 130 ? "FFFFFF" : "000000"end- def prawn_badge(text, color, offset: 0)- badge = BadgeCallback.new({ color: color, radius: 8, document: pdf, offset: })+ def prawn_badge(text, color, offset: 0, radius: 8, font_size: 8)+ badge = BadgeCallback.new({ color: color, radius:, document: pdf, offset: }){text: (Prawn::Text::NBSP * 3) + text + (Prawn::Text::NBSP * 3),- size: 8,+ size: font_size,color: readable_color(color),callback: badge}diff --git a/app/models/work_package/pdf_export/common/common.rb b/app/models/work_package/pdf_export/common/common.rbindex 297cffad88c..fe2b3e68a62 100644--- a/app/models/work_package/pdf_export/common/common.rb+++ b/app/models/work_package/pdf_export/common/common.rb@@ -129,11 +129,15 @@ module WorkPackage::PDFExport::Common::Commonenddef draw_horizontal_line(top, left, right, height, color)- pdf.stroke do+ previous_color = pdf.stroke_color+ previous_line_width = pdf.line_width+ @pdf.stroke dopdf.stroke_color = colorpdf.line_width = heightpdf.horizontal_line left, right, at: topend+ pdf.stroke_color = previous_color+ pdf.line_width = previous_line_widthenddef draw_styled_text(text, opts)@@ -277,17 +281,17 @@ module WorkPackage::PDFExport::Common::Commonenddef footer_date- format_time(export_datetime)+ format_date(export_datetime)enddef current_page_nrpdf.page_number + @page_count - (with_cover? ? 1 : 0)end- def write_horizontal_line(y_position, height, color)+ def write_horizontal_line(y_position, height, color, left_padding: 0)draw_horizontal_line(y_position,- pdf.bounds.left, pdf.bounds.right,+ pdf.bounds.left + left_padding, pdf.bounds.right,height, color)end@@ -297,6 +301,30 @@ module WorkPackage::PDFExport::Common::Commonpdf.start_new_page unless is_first_on_pageend+ # Prawn table does not support inline formatting other than inline HTML formatting, so we have to convert the styling+ def prawn_table_cell_inline_formatting_data(text, style) # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity+ value = text || ""+ value = "<link href=\"#{style[:link]}\">#{value}</link>" if style.key?(:link)+ value = "<link anchor=\"#{style[:anchor]}\">#{value}</link>" if style.key?(:anchor)+ value = "<color rgb=\"#{style[:color]}\">#{value}</color>" if style.include?(:color)+ value = "<font size=\"#{style[:size]}\">#{value}</font>" if style.key?(:size)+ value = "<font character_spacing=\"#{style[:character_spacing]}\">#{value}</font>" if style.key?(:character_spacing)+ value = "<font name=\"#{style[:font]}\">#{value}</font>" if style.key?(:font)+ prawn_table_cell_inline_font_styles(value, style[:styles] || [])+ end++ # Prawn table does not support inline formatting other than inline HTML formatting, so we have to convert the styles+ def prawn_table_cell_inline_font_styles(text, styles)+ value = text || ""+ value = "<b>#{value}</b>" if styles.include?(:bold)+ value = "<i>#{value}</i>" if styles.include?(:italic)+ value = "<u>#{value}</u>" if styles.include?(:underline)+ value = "<strikethrough>#{value}</strikethrough>" if styles.include?(:strikethrough)+ value = "<sub>#{value}</sub>" if styles.include?(:sub)+ value = "<sup>#{value}</sup>" if styles.include?(:sup)+ value+ end+def write_optional_page_breakspace_from_bottom = pdf.y - pdf.bounds.bottomif space_from_bottom < styles.page_break_thresholddiff --git a/app/models/work_package/pdf_export/common/macro.rb b/app/models/work_package/pdf_export/common/macro.rbindex bb2a73b914d..8eb1fce6cef 100644--- a/app/models/work_package/pdf_export/common/macro.rb+++ b/app/models/work_package/pdf_export/common/macro.rb@@ -29,48 +29,104 @@module WorkPackage::PDFExport::Common::MacroPREFORMATTED_BLOCKS = %w(pre code).freeze- def apply_markdown_field_macros(markdown, work_package)- apply_macros(markdown, work_package, WorkPackage::Exports::Macros::Attributes)+ def apply_markdown_field_macros(markdown, context)+ return markdown if markdown.blank?++ apply_macros(markdown, context)+ end++ def macros+ [+ WorkPackage::Exports::Macros::Links,+ WorkPackage::Exports::Macros::Attributes+ ]endprivate- def apply_macros(markdown, work_package, formatter)- return markdown unless formatter.applicable?(markdown)+ def apply_macros(markdown, context)+ return markdown unless macros.any? { |macro| macro.applicable?(markdown) }document = Markly.parse(markdown)- document.walk do |node|- if node.type == :html- node.string_content = apply_macro_html(node.string_content, work_package, formatter) || node.string_content- elsif node.type == :text- node.string_content = apply_macro_text(node.string_content, work_package, formatter) || node.string_content- end- end+ document.walk { |node| apply_macros_node(node, context) }document.to_markdown+ .gsub("\\~", "~") # fix a bug in Markly that escapes tildes+ end++ def apply_macros_node(node, context)+ if node.type == :html+ apply_macros_node_html(node, context)+ elsif node.type == :text && not_in_mention?(node)+ apply_macros_node_text(node, context)+ end+ end++ def not_in_mention?(node)+ # Check if the text node is not inside a mention tag+ # e.g. <mention ...>#1234</mention>+ # We don't want to end up with+ # <mention ...><mention ...>#1234</mention></mention>+ node.previous.nil? || node.previous.type != :inline_html || node.previous.string_content.exclude?("<mention")+ end++ def apply_macros_node_text(node, context)+ formatted, applied_macros = apply_macro_text(node.string_content, context)+ return if formatted == node.string_content++ if has_html_macro?(applied_macros)+ fragment = Markly::Node.new(:inline_html)+ fragment.string_content = formatted+ node.insert_before(fragment)+ node.delete+ else+ node.string_content = formatted+ endend- def apply_macro_text(text, work_package, formatter)- return text unless formatter.applicable?(text)+ def apply_macros_node_html(node, context)+ node.string_content = apply_macro_html(node.string_content, context)+ end++ def applicable?(content)+ macros.any? { |macro| macro.applicable?(content) }+ end- text.gsub!(formatter.regexp) do |matched_string|- matchdata = Regexp.last_match- formatter.process_match(matchdata, matched_string, { user: User.current, work_package: })+ def apply_macro_text(text, context)+ applicable_macros = macros.select { |macro| macro.applicable?(text) }+ return text if applicable_macros.empty?++ applicable_macros.each do |macro|+ text = text.gsub(macro.regexp) do |matched_string|+ macro.process_match(Regexp.last_match, matched_string, context)+ endend+ [text, applicable_macros]end- def apply_macro_html(html, work_package, formatter)- return html unless formatter.applicable?(html)+ def apply_macro_html(html, context)+ return html unless applicable?(html)doc = Nokogiri::HTML.fragment(html)- apply_macro_html_node(doc, work_package, formatter)+ apply_macro_html_node(doc, context)doc.to_htmlend- def apply_macro_html_node(node, work_package, formatter)+ def has_html_macro?(macros)+ macros.any? { |macro| macro.respond_to?(:html_replacement?) && macro.html_replacement? }+ end++ def apply_macro_html_node(node, context)if node.text?- node.content = apply_macro_text(node.content, work_package, formatter)+ formatted, applied_macros = apply_macro_text(node.content, context)+ if formatted != node.content+ if has_html_macro?(applied_macros)+ node.replace(formatted)+ else+ node.content = formatted+ end+ endelsif PREFORMATTED_BLOCKS.exclude?(node.name)- node.children.each { |child| apply_macro_html_node(child, work_package, formatter) }+ node.children.each { |child| apply_macro_html_node(child, context) }endendenddiff --git a/app/models/work_package/pdf_export/common/styles_page.rb b/app/models/work_package/pdf_export/common/styles_page.rbindex ff42416c8a4..3c6ba4d972e 100644--- a/app/models/work_package/pdf_export/common/styles_page.rb+++ b/app/models/work_package/pdf_export/common/styles_page.rb@@ -86,7 +86,7 @@ module WorkPackage::PDFExport::Common::StylesPageenddef page_break_threshold- resolve_pt(@styles.dig(:page, :page_break_threshold), 200)+ @page_break_threshold ||= resolve_pt(@styles.dig(:page, :page_break_threshold), 200)enddef link_colordiff --git a/app/models/work_package/pdf_export/document_generator.rb b/app/models/work_package/pdf_export/document_generator.rbindex 1a635337a67..ccc0694d875 100644--- a/app/models/work_package/pdf_export/document_generator.rb+++ b/app/models/work_package/pdf_export/document_generator.rb@@ -65,7 +65,8 @@ class WorkPackage::PDFExport::DocumentGenerator < Exports::Exporterdef render_docgenerate_doc!(- apply_markdown_field_macros(work_package.description || "", work_package),+ apply_markdown_field_macros(work_package.description || "",+ { work_package:, project: work_package.project, user: User.current }),"contracts.yml")enddiff --git a/app/models/work_package/pdf_export/export/markdown.rb b/app/models/work_package/pdf_export/export/markdown.rbindex bac4f95a433..6e3b0e98c00 100644--- a/app/models/work_package/pdf_export/export/markdown.rb+++ b/app/models/work_package/pdf_export/export/markdown.rb@@ -34,6 +34,7 @@ module WorkPackage::PDFExport::Export::Markdownclass MD2PDFExportinclude MarkdownToPDF::Coreinclude MarkdownToPDF::Parser+ include WorkPackage::PDFExport::Common::Commondef initialize(styling_yml, pdf, hyphenation_language)@styles = MarkdownToPDF::Styles.new(styling_yml)@@ -68,9 +69,8 @@ module WorkPackage::PDFExport::Export::Markdown@hyphens.hyphenate(text)end- def handle_mention_html_tag(tag, node, opts)+ def handle_user_mention_html_tag(tag, node, opts)if tag.text.blank?- # <mention class="mention" data-id="46012" data-type="work_package" data-text="#46012"></mention># <mention class="mention" data-id="3" data-type="user" data-text="@Some User">text = tag.attr("data-text")if text.present? && !node.next.respond_to?(:string_content) && node.next.string_content != text@@ -78,9 +78,52 @@ module WorkPackage::PDFExport::Export::Markdownendend# <mention class="mention" data-id="3" data-type="user" data-text="@Some User">@Some User</mention>+ # the node text is used.[]end+ def handle_wp_mention_html_tag(tag, node, opts)+ # <mention class="mention" data-id="185" data-type="work_package" data-text="#185">#185</mention>+ # <mention class="mention" data-id="185" data-type="work_package" data-text="##185">##185</mention>+ # <mention class="mention" data-id="185" data-type="work_package" data-text="###185">###185</mention>+ id = tag.attr("data-id")+ return [] if id.blank?++ next_node = node&.next # there is no markdown node in a html table+ if next_node && next_node.type == :text && next_node.respond_to?(:string_content)+ # clear the text content, so it does not get rendered+ next_node.string_content = ""+ end+ wp_mention_macro(tag.attr("data-text") || "", id, opts)+ end++ def wp_mention_macro(content, id, opts)+ count = content.count("#")+ if count > 1+ work_package = WorkPackage.find_by(id: id)+ unless work_package.nil? || !work_package.visible?+ # ##1234: {Type} #{ID}: {Subject}+ content = "#{work_package.type} ##{work_package.id}: #{work_package.subject}"+ if count == 3+ # ###1234: {Status} {Type} #{ID}: {Subject}+ content = "#{work_package.status.name} #{content}"+ end+ end+ end+ [text_hash(content, opts.merge({ link: url_helpers.work_package_url(id) }))]+ end++ def handle_mention_html_tag(tag, node, opts)+ type = tag.attr("data-type")+ if type == "work_package"+ handle_wp_mention_html_tag(tag, node, opts)+ elsif type == "user"+ handle_user_mention_html_tag(tag, node, opts)+ else+ []+ end+ end+def handle_unknown_inline_html_tag(tag, node, opts)result = if tag.name == "mention"handle_mention_html_tag(tag, node, opts)@@ -93,9 +136,13 @@ module WorkPackage::PDFExport::Export::Markdownenddef handle_unknown_html_tag(_tag, _node, opts)- # unknown/unsupported html tags eg. <foo>hi</foo> are ignored- # but scanned for supported or text children [true, ...]- [true, opts]+ if tag.name == "mention"+ handle_mention_html_tag(tag, node, opts)+ else+ # unknown/unsupported html tags eg. <foo>hi</foo> are ignored+ # but scanned for supported or text children [true, ...]+ [true, opts]+ endenddef warn(text, element, node)@@ -103,10 +150,14 @@ module WorkPackage::PDFExport::Export::Markdownendend- def write_markdown!(work_package, markdown, styling_yml)- md2pdf = MD2PDFExport.new(styling_yml, pdf, hyphenation_language)- md2pdf.draw_markdown(markdown, pdf, ->(src) {- with_images? ? attachment_image_filepath(work_package, src) : nil- })+ def markdown_writer(styling_yml)+ @markdown_writer ||= MD2PDFExport.new(styling_yml, pdf, hyphenation_language)+ end++ def write_markdown!(markdown, styling_yml)+ markdown_writer(styling_yml)+ .draw_markdown(markdown, pdf, ->(src) {+ with_images? ? attachment_image_filepath(src) : nil+ })endenddiff --git a/app/models/work_package/pdf_export/export/markdown_field.rb b/app/models/work_package/pdf_export/export/markdown_field.rbindex 02c097089ac..4b657a9243b 100644--- a/app/models/work_package/pdf_export/export/markdown_field.rb+++ b/app/models/work_package/pdf_export/export/markdown_field.rb@@ -51,8 +51,8 @@ module WorkPackage::PDFExport::Export::MarkdownFielddef write_markdown_field_value(work_package, markdown)with_margin(styles.wp_markdown_margins) dowrite_markdown!(- work_package,- apply_markdown_field_macros(markdown, work_package),+ apply_markdown_field_macros(markdown,+ { work_package:, project: work_package.project, user: User.current }),styles.wp_markdown_styling_yml)enddiff --git a/app/models/work_package/pdf_export/export/meetings/schema.json b/app/models/work_package/pdf_export/export/meetings/schema.jsonnew file mode 100644index 00000000000..eafef496a51--- /dev/null+++ b/app/models/work_package/pdf_export/export/meetings/schema.json@@ -0,0 +1,1842 @@+{+ "type": "object",+ "title": "Meetings PDF",+ "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/meetings/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"+ },+ "page_subtitle": {+ "$ref": "#/$defs/page_heading"+ },+ "cover": {+ "$ref": "#/$defs/cover"+ },+ "notes": {+ "$ref": "#/$defs/notes"+ },+ "outcome": {+ "$ref": "#/$defs/outcome"+ },+ "heading": {+ "type": "object",+ "title": "Heading",+ "description": "Styling for the heading of the PDF meeting export",+ "x-example": {+ "heading": {+ "size": 12,+ "styles": [+ "bold"+ ],+ "margin_bottom": 10+ }+ },+ "properties": {+ "hr": {+ "type": "object",+ "title": "Horizontal rule before headings",+ "x-example": {+ "border": {+ "color": "6E7781",+ "height": 1.5+ }+ },+ "properties": {+ "height": {+ "title": "Line height of the horizontal rule",+ "examples": [+ 1+ ],+ "$ref": "#/$defs/measurement"+ },+ "color": {+ "title": "Line color of the horizontal rule",+ "$ref": "#/$defs/color"+ }+ },+ "allOf": [+ {+ "$ref": "#/$defs/margin"+ }+ ]+ }+ },+ "allOf": [+ {+ "$ref": "#/$defs/font"+ },+ {+ "$ref": "#/$defs/margin"+ }+ ]+ },+ "agenda_item": {+ "type": "object",+ "title": "Agenda item",+ "description": "Styling for a agenda item of the PDF meeting export",+ "x-example": {+ "agenda_item": {+ }+ },+ "properties": {+ "title_cell": {+ "title": "Agenda item title table cell",+ "description": "Styling for a table cell with the agenda item title",+ "$ref": "#/$defs/table_cell"+ },+ "title": {+ "$ref": "#/$defs/font"+ },+ "subtitle": {+ "$ref": "#/$defs/font"+ },+ "title_margin": {+ "$ref": "#/$defs/margin"+ },+ "indent": {+ "title": "Indent width",+ "description": "Indent for agenda item notes",+ "$ref": "#/$defs/measurement"+ },+ "hr": {+ "type": "object",+ "title": "Horizontal rule between agenda items",+ "x-example": {+ "border": {+ "color": "D0D7DE",+ "height": 1+ }+ },+ "properties": {+ "height": {+ "title": "Line height of the horizontal rule",+ "examples": [+ 1+ ],+ "$ref": "#/$defs/measurement"+ },+ "color": {+ "title": "Line color of the horizontal rule",+ "$ref": "#/$defs/color"+ }+ },+ "allOf": [+ {+ "$ref": "#/$defs/margin"+ }+ ]+ }+ }+ },+ "agenda_section": {+ "type": "object",+ "title": "Agenda section",+ "description": "Styling for a agenda section of the PDF meeting export",+ "x-example": {+ "agenda_section": {+ }+ },+ "properties": {+ "title_cell": {+ "title": "Agenda section title table cell",+ "description": "Styling for a table cell with the agenda section title",+ "$ref": "#/$defs/table_cell"+ },+ "title": {+ "$ref": "#/$defs/font"+ },+ "subtitle": {+ "$ref": "#/$defs/font"+ },+ "title_margins": {+ "$ref": "#/$defs/margin"+ }+ }+ },+ "participants": {+ "type": "object",+ "title": "Participants",+ "description": "Styling for the participants table",+ "x-example": {+ "margin_bottom": 12,+ "cell": {+ "size": 10,+ "padding_left": 0,+ "no_border": true+ }+ },+ "properties": {+ "cell": {+ "title": "Participant table cell",+ "description": "Styling for a table cell with a participant name",+ "$ref": "#/$defs/table_cell"+ }+ },+ "allOf": [+ {+ "$ref": "#/$defs/margin"+ }+ ]+ },+ "attachments": {+ "type": "object",+ "title": "Attachments",+ "description": "Styling for the attachments table",+ "x-example": {+ "margin_bottom": 12,+ "cell": {+ "size": 10,+ "padding_left": 0,+ "no_border": true+ }+ },+ "properties": {+ "cell": {+ "title": "Attachments table cell",+ "description": "Styling for a table cell with a attachment name",+ "$ref": "#/$defs/table_cell"+ }+ },+ "allOf": [+ {+ "$ref": "#/$defs/margin"+ }+ ]+ }+ },+ "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"+ }+ ]+ },+ "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+ }+ },+ "properties": {+ "background_color": {+ "$ref": "#/$defs/color"+ }+ },+ "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"+ }+ }+ },+ "notes": {+ "type": "object",+ "title": "Agenda item notes",+ "description": "Styling for Meeting agenda item notes",+ "x-example": {+ "notes": {+ "markdown_margin": {},+ "markdown": {}+ }+ },+ "properties": {+ "markdown_margin": {+ "type": "object",+ "title": "Agenda item notes markdown margins",+ "description": "Margins for agenda item notes",+ "x-example": {+ "markdown_margin": {+ "margin_bottom": 16+ }+ },+ "allOf": [+ {+ "$ref": "#/$defs/margin"+ }+ ]+ },+ "markdown": {+ "$ref": "#/$defs/markdown"+ }+ },+ "allOf": [+ {+ "$ref": "#/$defs/margin"+ }+ ]+ },+ "outcome": {+ "type": "object",+ "title": "Agenda item outcome",+ "description": "Styling for Meeting agenda item outcome",+ "x-example": {+ "outcome": {+ "indent": 15,+ "markdown_margin": {},+ "markdown": {}+ }+ },+ "properties": {+ "title": {+ "type": "object",+ "title": "Agenda item outcome title",+ "allOf": [+ {+ "$ref": "#/$defs/font"+ },+ {+ "$ref": "#/$defs/margin"+ }+ ]+ },+ "indent": {+ "title": "Indent width",+ "description": "Indent for agenda item notes",+ "$ref": "#/$defs/measurement"+ },+ "markdown_margin": {+ "type": "object",+ "title": "Agenda item outcome markdown margins",+ "description": "Margins for agenda item outcome",+ "x-example": {+ "markdown_margin": {+ "margin_bottom": 16+ }+ },+ "allOf": [+ {+ "$ref": "#/$defs/margin"+ }+ ]+ },+ "markdown": {+ "$ref": "#/$defs/markdown"+ }+ },+ "allOf": [+ {+ "$ref": "#/$defs/margin"+ }+ ]+ },+ "markdown": {+ "type": "object",+ "title": "Markdown Styling",+ "description": "Styling for markdown content of agenda item notes",+ "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"+ }+ }+ }+ }+}diff --git a/app/models/work_package/pdf_export/export/meetings/standard.yml b/app/models/work_package/pdf_export/export/meetings/standard.ymlnew file mode 100644index 00000000000..ad146b47d4b--- /dev/null+++ b/app/models/work_package/pdf_export/export/meetings/standard.yml@@ -0,0 +1,459 @@+page:+ page_size: "A4"+ margin_top: 60+ margin_bottom: 60+ margin_left: 36+ margin_right: 36+ page_break_threshold: 100+ 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: 2++page_subtitle:+ margin_top: 4+ margin_bottom: 10+ size: 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++notes:+ markdown_margin:+ margin: 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: 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++outcome:+ indent: 15+ title:+ size: 10+ styles: [ "bold" ]+ margin_top: 5+ margin_bottom: 5+ markdown_margin:+ margin: 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: 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++heading:+ size: 12+ styles: [ "bold" ]+ margin_bottom: 8+ hr:+ color: "6E7781"+ height: 1.5+ margin_bottom: 10++participants:+ margin_bottom: 8+ cell:+ size: 10+ padding_left: 0+ padding_bottom: 7+ no_border: true++attachments:+ margin_bottom: 8+ cell:+ size: 10+ padding_left: 0+ padding_bottom: 7+ no_border: true++agenda_section:+ title:+ size: 12+ color: "000000"+ styles: [ "bold" ]+ subtitle:+ size: 11+ color: "636C76"+ title_cell:+ padding_top: 2+ padding_bottom: 10+ padding_left: 5+ padding_right: 5+ no_border: true+ background_color: "EAEAEA"+ title_margins:+ margin_top: 15+ margin_bottom: 5++agenda_item:+ indent: 5+ title_margin:+ margin_bottom: 10+ title_cell:+ padding_top: 0+ padding_bottom: 0+ padding_left: 5+ padding_right: 5+ no_border: true+ title:+ styles: [ "bold" ]+ size: 11+ subtitle:+ color: "636C76"+ size: 10+ hr:+ color: "D0D7DE"+ height: 1+ margin_top: 6+ margin_bottom: 6diff --git a/app/models/work_package/pdf_export/export/meetings/styles.rb b/app/models/work_package/pdf_export/export/meetings/styles.rbnew file mode 100644index 00000000000..74559607aca--- /dev/null+++ b/app/models/work_package/pdf_export/export/meetings/styles.rb@@ -0,0 +1,163 @@+# 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::Meetings::Styles+ class PDFStyles+ include MarkdownToPDF::Common+ include MarkdownToPDF::StyleHelper+ include WorkPackage::PDFExport::Common::Styles+ include WorkPackage::PDFExport::Common::StylesPage+ include WorkPackage::PDFExport::Common::StylesCover++ def page_subtitle+ resolve_font(@styles[:page_subtitle])+ end++ def page_subtitle_margins+ resolve_margin(@styles[:page_subtitle])+ end++ def notes_markdown_margins+ resolve_margin(@styles.dig(:work_package, :markdown_margin))+ end++ def notes_markdown_styling_yml+ resolve_markdown_styling(@styles.dig(:notes, :markdown) || {})+ end++ def outcome_markdown_styling_yml+ resolve_markdown_styling(@styles.dig(:outcome, :markdown) || {})+ end++ def heading+ resolve_font(@styles[:heading])+ end++ def heading_hr+ {+ color: @styles.dig(:heading, :hr, :color),+ height: resolve_pt(@styles.dig(:heading, :hr, :height), 1)+ }+ end++ def heading_hr_margins+ resolve_margin(@styles.dig(:heading, :hr))+ end++ def agenda_item_title_margins+ resolve_margin(@styles.dig(:agenda_item, :title_margin))+ end++ def agenda_item_indent+ @styles.dig(:agenda_item, :indent).presence || 5+ end++ def outcome_title+ resolve_font(@styles.dig(:outcome, :title))+ end++ def outcome_title_margins+ resolve_margin(@styles.dig(:outcome, :title))+ end++ def outcome_indent+ @styles.dig(:outcome, :indent).presence || 15+ end++ def agenda_item_title+ resolve_font(@styles.dig(:agenda_item, :title))+ end++ def agenda_item_title_cell+ resolve_table_cell(@styles.dig(:agenda_item, :title_cell))+ end++ def agenda_item_subtitle+ resolve_font(@styles.dig(:agenda_item, :subtitle))+ end++ def agenda_item_hr+ {+ color: @styles.dig(:agenda_item, :hr, :color),+ height: resolve_pt(@styles.dig(:agenda_item, :hr, :height), 1)+ }+ end++ def agenda_item_margins+ resolve_margin(@styles.dig(:agenda_item, :hr))+ end++ def heading_margins+ resolve_margin(@styles[:heading])+ end++ def participants_table_cell+ resolve_table_cell(@styles.dig(:participants, :cell))+ end++ def participants_margins+ resolve_margin(@styles[:participants])+ end++ def attachments_table_cell+ resolve_table_cell(@styles.dig(:attachments, :cell))+ end++ def attachments_margins+ resolve_margin(@styles[:attachments])+ end++ def agenda_section_title+ resolve_font(@styles.dig(:agenda_section, :title))+ end++ def agenda_section_title_table_margins+ resolve_margin(@styles.dig(:agenda_section, :title_margins))+ end++ def agenda_section_subtitle+ resolve_font(@styles.dig(:agenda_section, :subtitle))+ end++ def agenda_section_title_cell+ resolve_table_cell(@styles.dig(:agenda_section, :title_cell))+ end+ end++ def styles+ @styles ||= PDFStyles.new(styles_asset_path)+ end++ private++ def styles_asset_path+ File.dirname(File.expand_path(__FILE__))+ end+enddiff --git a/app/models/work_package/pdf_export/generator/generator.rb b/app/models/work_package/pdf_export/generator/generator.rbindex 921178f4f29..77c62858e8d 100644--- a/app/models/work_package/pdf_export/generator/generator.rb+++ b/app/models/work_package/pdf_export/generator/generator.rb@@ -135,7 +135,7 @@ module WorkPackage::PDFExport::Generator::Generatorif src == logo_image_filenamelogo_image_filenameelse- attachment_image_filepath(work_package, src)+ attachment_image_filepath(src)end})enddiff --git a/app/workers/exports/export_job.rb b/app/workers/exports/export_job.rbindex 422e348bd2e..95b28bc110e 100644--- a/app/workers/exports/export_job.rb+++ b/app/workers/exports/export_job.rb@@ -39,17 +39,31 @@ module Exportsraise NotImplementedErrorend+ def list_export?+ true+ end+def export!result = exporter_instance.export!handle_export_result(export, result)enddef exporter_instance+ list_export? ? exporter_instance_list : exporter_single_list+ end++ def exporter_instance_list::Exports::Register.list_exporter(model, mime_type).new(query, options)end+ def exporter_single_list+ ::Exports::Register+ .single_exporter(model, mime_type)+ .new(query, options)+ end+def handle_export_result(export, result)case result.contentwhen Filediff --git a/frontend/src/stimulus/controllers/dynamic/meetings/export/form.controller.ts b/frontend/src/stimulus/controllers/dynamic/meetings/export/form.controller.tsnew file mode 100644index 00000000000..686146c7fa9--- /dev/null+++ b/frontend/src/stimulus/controllers/dynamic/meetings/export/form.controller.ts@@ -0,0 +1,76 @@+import { Controller } from '@hotwired/stimulus';+import * as Turbo from '@hotwired/turbo';+import { HttpErrorResponse } from '@angular/common/http';++export default class FormController extends Controller<HTMLFormElement> {+ static values = {+ jobStatusDialogUrl: String,+ };++ declare jobStatusDialogUrlValue:string;++ jobModalUrl(job_id:string):string {+ return this.jobStatusDialogUrlValue.replace('_job_uuid_', job_id);+ }++ async showJobModal(job_id:string) {+ const response = await fetch(this.jobModalUrl(job_id), {+ method: 'GET',+ headers: { Accept: 'text/vnd.turbo-stream.html' },+ });+ if (response.ok) {+ Turbo.renderStreamMessage(await response.text());+ } else {+ throw new Error(response.statusText || 'Invalid response from server');+ }+ }++ async requestExport(exportURL:string):Promise<string> {+ const response = await fetch(exportURL, {+ method: 'GET',+ headers: { Accept: 'application/json' },+ credentials: 'same-origin',+ });+ if (!response.ok) {+ throw new Error(`HTTP ${response.status}: ${response.statusText}`);+ }+ const result = await response.json() as { job_id:string };+ if (!result.job_id) {+ throw new Error('Invalid response from server');+ }+ return result.job_id;+ }++ generateExportURL(formData:FormData):string {+ const actionURL = this.element.getAttribute('action') as string;+ const searchParams = this.getExportParams(formData);+ const append = actionURL.includes('?') ? '&' : '?';+ return `${actionURL}${append}${searchParams.toString()}`;+ }++ submitForm(evt:CustomEvent) {+ evt.preventDefault(); // Don't submit+ const formData = new FormData(this.element);+ this.requestExport(this.generateExportURL(formData))+ .then((job_id) => this.showJobModal(job_id))+ .catch((error:HttpErrorResponse) => this.handleError(error));+ return true;+ }++ private handleError(error:HttpErrorResponse) {+ void window.OpenProject.getPluginContext().then((pluginContext) => {+ pluginContext.services.notifications.addError(error);+ });+ }++ private getExportParams(formData:FormData):string {+ const formParams = new URLSearchParams(formData as unknown as undefined);+ const query = new URLSearchParams();+ // Remove duplicate parameters inserted by Primer::Checkbox (two inputs per checkbox)+ formParams.forEach((value, key) => {+ query.delete(key);+ query.append(key, value);+ });+ return query.toString();+ }+}diff --git a/lib/open_project/text_formatting/matchers/link_handlers/work_packages.rb b/lib/open_project/text_formatting/matchers/link_handlers/work_packages.rbindex 9002b457956..a55e78144c3 100644--- a/lib/open_project/text_formatting/matchers/link_handlers/work_packages.rb+++ b/lib/open_project/text_formatting/matchers/link_handlers/work_packages.rb@@ -50,6 +50,10 @@ module OpenProject::TextFormatting::Matchers# prohibits links to things like #0123return if wp_id.to_s != matcher.identifier+ render_link(wp_id, matcher)+ end++ def render_link(wp_id, matcher)if ["##", "###"].include?(matcher.sep)render_work_package_macro(wp_id, detailed: (matcher.sep === "###"))elsediff --git a/lib/open_project/text_formatting/matchers/resource_links_matcher.rb b/lib/open_project/text_formatting/matchers/resource_links_matcher.rbindex 0113f9819ac..3ec9352628a 100644--- a/lib/open_project/text_formatting/matchers/resource_links_matcher.rb+++ b/lib/open_project/text_formatting/matchers/resource_links_matcher.rb@@ -78,7 +78,7 @@ module OpenProject::TextFormattingdef self.regexp%r{- ([[[:space:]](,\-\[>]|^) # Leading string+ ([[[:space:]](,~\-\[>]|^) # Leading string(!)? # Escaped marker(([a-z0-9\-_]+):)? # Project identifier(#{allowed_prefixes.join('|')})? # prefix@@ -98,6 +98,7 @@ module OpenProject::TextFormatting)|\.\z # Allow matching when string ends with .|, # or with ,+ |~ # or with ~|\) # or with )|[[:space:]]|\]diff --git a/modules/meeting/app/components/meetings/exports/modal_dialog_component.html.erb b/modules/meeting/app/components/meetings/exports/modal_dialog_component.html.erbnew file mode 100644index 00000000000..f0e67011cce--- /dev/null+++ b/modules/meeting/app/components/meetings/exports/modal_dialog_component.html.erb@@ -0,0 +1,97 @@+<%= render(+ Primer::Alpha::Dialog.new(+ title: I18n.t("meeting.export_pdf_dialog.title"),+ subtitle: I18n.t("meeting.export_pdf_dialog.description"),+ id: MODAL_ID,+ size: :medium_portrait+ )+ ) do |dialog| %>+ <% dialog.with_header(variant: :large) %>+ <% dialog.with_body do %>+ <%= primer_form_with(+ url: project_meeting_path(@project, @meeting, format: :pdf),+ method: :get,+ data: {+ "application-target": "dynamic",+ controller: "meetings--export--form",+ action: "submit->meetings--export--form#submitForm",+ "meetings--export--form-job-status-dialog-url-value": job_status_dialog_path("_job_uuid_")+ },+ id: GENERATE_PDF_FORM_ID+ ) do+ flex_layout do |modal_body|+ modal_body.with_row do+ render(+ Primer::Alpha::CheckBox.new(+ id: "pdf_include_participants",+ name: :participants,+ checked: true,+ label: I18n.t("meeting.export_pdf_dialog.include_participants.label"),+ caption: I18n.t("meeting.export_pdf_dialog.include_participants.caption"),+ visually_hide_label: false+ )+ )+ end+ modal_body.with_row(mt: 3) do+ render(+ Primer::Alpha::CheckBox.new(+ id: "pdf_include_attachments",+ name: :attachments,+ checked: false,+ label: I18n.t("meeting.export_pdf_dialog.include_attachments.label"),+ caption: I18n.t("meeting.export_pdf_dialog.include_attachments.caption"),+ visually_hide_label: false+ )+ )+ end+ modal_body.with_row(mt: 3) do+ render(+ Primer::Alpha::CheckBox.new(+ id: "pdf_include_backlog",+ name: :backlog,+ checked: false,+ label: I18n.t("meeting.export_pdf_dialog.include_backlog.label"),+ caption: I18n.t("meeting.export_pdf_dialog.include_backlog.caption"),+ visually_hide_label: false+ )+ )+ end+ modal_body.with_row(mt: 3) do+ render(+ Primer::Alpha::CheckBox.new(+ id: "pdf_include_outcomes",+ name: :outcomes,+ checked: false,+ label: I18n.t("meeting.export_pdf_dialog.include_outcomes.label"),+ caption: I18n.t("meeting.export_pdf_dialog.include_outcomes.caption"),+ visually_hide_label: false+ )+ )+ end+ modal_body.with_row(mt: 3) do+ render Primer::Alpha::TextField.new(+ id: "pdf_footer_text_right",+ name: :footer_text_right,+ label: I18n.t("meeting.export_pdf_dialog.footer_text.label"),+ caption: I18n.t("meeting.export_pdf_dialog.footer_text.caption"),+ visually_hide_label: false,+ value: default_footer_text_right+ )+ end+ end+ end %>+ <% end %>+ <% dialog.with_footer do %>+ <%= render(Primer::Beta::Button.new(data: { "close-dialog-id": MODAL_ID })) { I18n.t(:button_cancel) } %>+ <%= render(+ Primer::Beta::Button.new(+ scheme: :primary,+ type: :submit,+ form: GENERATE_PDF_FORM_ID,+ data: {+ "close-dialog-id": MODAL_ID+ }+ )+ ) { I18n.t("meeting.export_pdf_dialog.submit_button") } %>+ <% end %>+<% end %>diff --git a/modules/meeting/app/components/meetings/exports/modal_dialog_component.rb b/modules/meeting/app/components/meetings/exports/modal_dialog_component.rbnew file mode 100644index 00000000000..17bd4f5679f--- /dev/null+++ b/modules/meeting/app/components/meetings/exports/modal_dialog_component.rb@@ -0,0 +1,52 @@+# 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 Meetings+ module Exports+ class ModalDialogComponent < ApplicationComponent+ MODAL_ID = "op-meeting-generate-pdf-dialog"+ GENERATE_PDF_FORM_ID = "op-meeting-generate-pdf-dialog-form"+ include OpTurbo::Streamable+ include OpPrimer::ComponentHelpers+ attr_reader :meeting, :project++ def initialize(meeting:, project:)+ super++ @meeting = meeting+ @project = project+ end++ def default_footer_text_right+ @project.name+ end+ end+ end+enddiff --git a/modules/meeting/app/components/meetings/header_component.html.erb b/modules/meeting/app/components/meetings/header_component.html.erbindex b3dcedc39c2..67472658698 100644--- a/modules/meeting/app/components/meetings/header_component.html.erb+++ b/modules/meeting/app/components/meetings/header_component.html.erb@@ -95,6 +95,18 @@item.with_leading_visual_icon(icon: :mail)endend++ menu.with_item(+ label: t("meeting.label_export_pdf"),+ tag: :a,+ href: generate_pdf_dialog_project_meeting_path(@project, @meeting),+ content_arguments: {+ "data-controller": "async-dialog"+ },+ value: ""+ ) do |item|+ item.with_leading_visual_icon(icon: :"op-pdf")+ endendmenu.with_item(diff --git a/modules/meeting/app/controllers/meetings_controller.rb b/modules/meeting/app/controllers/meetings_controller.rbindex 65ec55eb29c..56e7e3abad0 100644--- a/modules/meeting/app/controllers/meetings_controller.rb+++ b/modules/meeting/app/controllers/meetings_controller.rb@@ -69,6 +69,7 @@ class MeetingsController < ApplicationControllerdef showrespond_to do |format|+ format.pdf { export_pdf }format.html dohtml_title "#{t(:label_meeting)}: #{@meeting.title}"if @meeting.state == "cancelled"@@ -341,6 +342,13 @@ class MeetingsController < ApplicationControllerrespond_with_turbo_streamsend+ def generate_pdf_dialog+ respond_with_dialog Meetings::Exports::ModalDialogComponent.new(+ meeting: @meeting,+ project: @project+ )+ end+privatedef load_query@@ -538,4 +546,19 @@ class MeetingsController < ApplicationControllerdef timezone_params@timezone_params ||= params.require(:meeting).permit(:start_date, :start_time_hour).compact_blankend++ def export_pdf+ job = ::Meetings::ExportJob.perform_later(+ export: MeetingExport.create,+ user: current_user,+ mime_type: :pdf,+ query: @meeting,+ options: params.to_unsafe_h+ )+ if request.headers["Accept"]&.include?("application/json")+ render json: { job_id: job.job_id }+ else+ redirect_to job_status_path(job.job_id)+ end+ endenddiff --git a/modules/meeting/app/models/meeting_export.rb b/modules/meeting/app/models/meeting_export.rbnew file mode 100644index 00000000000..d735de1a1a1--- /dev/null+++ b/modules/meeting/app/models/meeting_export.rb@@ -0,0 +1,40 @@+# 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.+#++++class MeetingExport < Export+ acts_as_attachable view_permission: :view_meetings,+ add_permission: :view_meetings,+ delete_permission: :view_meetings,+ only_user_allowed: true++ def ready?+ attachments.any?+ end+enddiff --git a/modules/meeting/app/workers/meetings/export_job.rb b/modules/meeting/app/workers/meetings/export_job.rbnew file mode 100644index 00000000000..bd696f5ec88--- /dev/null+++ b/modules/meeting/app/workers/meetings/export_job.rb@@ -0,0 +1,45 @@+# 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 Meetings+ class ExportJob < ::Exports::ExportJob+ self.model = ::Meeting++ def title+ I18n.t("meeting.export.your_meeting_export")+ end++ def prepare!; end++ def list_export?+ false+ end+ end+enddiff --git a/modules/meeting/app/workers/meetings/exporter.rb b/modules/meeting/app/workers/meetings/exporter.rbnew file mode 100644index 00000000000..c86ccd56ebb--- /dev/null+++ b/modules/meeting/app/workers/meetings/exporter.rb@@ -0,0 +1,166 @@+# 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 Meetings+ class Exporter < ::Exports::Exporter+ include WorkPackage::PDFExport::Common::Common+ include WorkPackage::PDFExport::Common::Logo+ include WorkPackage::PDFExport::Export::Page+ include WorkPackage::PDFExport::Export::Cover+ include WorkPackage::PDFExport::Export::Markdown+ include WorkPackage::PDFExport::Common::Attachments+ include WorkPackage::PDFExport::Common::Badge+ include WorkPackage::PDFExport::Common::Macro+ include WorkPackage::PDFExport::Export::Meetings::Styles+ include Meetings::PDF::PageHead+ include Meetings::PDF::Participants+ include Meetings::PDF::Agenda+ include Meetings::PDF::Attachments++ attr_accessor :pdf++ self.model = Meeting++ alias :meeting :object++ def self.key+ end++ def initialize(meeting, options = {})+ super(meeting, options[:options] || options)+ @total_page_nr = nil+ @page_count = 0++ setup_page!+ end++ def setup_page!+ self.pdf = get_pdf+ pdf.title = heading+ configure_page_size!(:portrait)+ end++ def export!+ render_doc+ success(pdf.render)+ rescue StandardError => e+ Rails.logger.error "Failed to generate PDF export: #{e.message}:\n#{e.backtrace.join("\n")}"+ error(I18n.t(:error_pdf_failed_to_export, error: e.message))+ end++ def render_doc+ write_cover_page! if with_cover?+ render_meeting!+ end++ def render_meeting!+ write_page_head+ write_participants if with_participants?+ write_agenda+ write_attachments_list if with_attachments_list?+ write_backlog if with_backlog?+ write_headers!+ write_footers!+ end++ def write_heading(text)+ pdf.formatted_text([styles.heading.merge({ text: })])+ pdf.move_down(10)+ end++ def write_hr+ hr_style = styles.heading_hr+ with_vertical_margin(styles.heading_hr_margins) do+ write_horizontal_line(pdf.cursor, hr_style[:height], hr_style[:color])+ end+ end++ def cover_page_title+ project_title+ end++ def cover_page_heading+ meeting.title+ end++ def cover_page_dates+ "#{meeting.start_date} #{meeting.start_time_hour}".strip+ end++ def cover_page_subheading+ meeting.location+ end++ def heading+ meeting.title+ end++ def project_title+ meeting.project&.name || ""+ end++ def footer_title+ options[:footer_text_right] || project_title+ end++ def title_datetime+ meeting.start_time.strftime("%Y-%m-%d")+ end++ def title+ build_pdf_filename(meeting.title)+ end++ def with_participants?+ ActiveModel::Type::Boolean.new.cast(options[:participants])+ end++ def with_attachments_list?+ ActiveModel::Type::Boolean.new.cast(options[:attachments])+ end++ def with_backlog?+ ActiveModel::Type::Boolean.new.cast(options[:backlog])+ end++ def with_outcomes?+ ActiveModel::Type::Boolean.new.cast(options[:outcomes])+ end++ def with_cover?+ true+ end++ def with_images?+ true+ end+ end+enddiff --git a/modules/meeting/app/workers/meetings/pdf/agenda.rb b/modules/meeting/app/workers/meetings/pdf/agenda.rbnew file mode 100644index 00000000000..a4eaac8f131--- /dev/null+++ b/modules/meeting/app/workers/meetings/pdf/agenda.rb@@ -0,0 +1,208 @@+# 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 Meetings::PDF+ module Agenda+ def write_agenda+ return if meeting.sections.empty?++ write_hr+ write_optional_page_break+ write_heading(I18n.t("meeting.export.label_meeting_agenda"))+ write_agenda_sections+ end++ def write_backlog+ return if meeting.backlog.blank? || meeting.backlog.agenda_items.empty?++ write_hr+ write_heading(meeting.recurring? ? I18n.t("label_series_backlog") : I18n.t("label_agenda_backlog"))+ write_agenda_items(meeting.backlog)+ end++ def write_agenda_sections+ meeting.sections.each_with_index { |section, index| write_section(section, index) }+ end++ def write_section(section, section_index)+ write_optional_page_break+ write_section_title(section, section_index)+ write_agenda_items(section)+ end++ def write_section_title(section, section_index)+ margins = styles.agenda_section_title_table_margins+ margins = margins.merge({ top_margin: 0 }) if section_index == 0+ with_vertical_margin(margins) do+ pdf.table(+ [[{ content: format_agenda_section_title_cell(section) }]],+ width: pdf.bounds.width,+ cell_style: { inline_format: true }.merge(styles.agenda_section_title_cell)+ )+ end+ end++ def format_agenda_section_title_cell(section)+ content = [prawn_table_cell_inline_formatting_data(section_title(section), styles.agenda_section_title)]+ if section.agenda_items_sum_duration_in_minutes > 0+ content.push(+ prawn_table_cell_inline_formatting_data(+ format_duration(section.agenda_items_sum_duration_in_minutes),+ styles.agenda_section_subtitle+ )+ )+ end+ content.join(" ")+ end++ def format_duration(duration)+ OpenProject::Common::DurationComponent.new(duration, :minutes, abbreviated: true).text+ end++ def section_title(section)+ section.title.presence || I18n.t("meeting_section.untitled_title")+ end++ def write_agenda_items(section)+ section.agenda_items.each_with_index do |item, index|+ write_agenda_item_hr if index > 0+ write_optional_page_break+ write_agenda_item(item)+ end+ end++ def write_agenda_item_hr+ hr_style = styles.agenda_item_hr+ with_vertical_margin(styles.agenda_item_margins) do+ write_horizontal_line(+ pdf.cursor,+ hr_style[:height],+ hr_style[:color],+ left_padding: styles.agenda_item_indent+ )+ end+ end++ def write_agenda_item(agenda_item)+ case agenda_item.item_type.to_sym+ when :simple+ write_agenda_title_item_simple(agenda_item)+ when :work_package+ write_agenda_title_item_wp(agenda_item)+ end+ write_notes(agenda_item)+ write_outcome(agenda_item) if with_outcomes?+ end++ def write_agenda_item_title(title, duration, user)+ with_vertical_margin(styles.agenda_item_title_margins) do+ pdf.table(+ [[{ content: format_agenda_item_cell(title, duration, user) }]],+ width: pdf.bounds.width,+ cell_style: { inline_format: true }.merge(styles.agenda_item_title_cell)+ )+ end+ end++ def format_agenda_item_cell(text, duration, user)+ content = [format_agenda_item_title(text)]+ content.push(format_agenda_item_subtitle(format_duration(duration))) if duration > 0+ content.push(format_agenda_item_subtitle(user.name)) unless user.nil?+ content.join(" ")+ end++ def format_agenda_item_subtitle(text)+ prawn_table_cell_inline_formatting_data(text, styles.agenda_item_subtitle)+ end++ def format_agenda_item_title(title)+ prawn_table_cell_inline_formatting_data(title, styles.agenda_item_title)+ end++ def agenda_title_wp(work_package)+ href = url_helpers.work_package_url(work_package)+ make_link_href(+ href,+ prawn_table_cell_inline_formatting_data(+ "#{work_package.type.name} ##{work_package.id} #{work_package.subject}",+ { styles: [:underline] }+ )+ )+ end++ def write_agenda_title_item_wp(agenda_item)+ work_package = agenda_item.work_package+ write_agenda_item_title(+ [agenda_title_wp(work_package), "(#{work_package.status.name})"].join(" "),+ agenda_item.duration_in_minutes || 0, agenda_item.presenter+ )+ end++ def write_agenda_title_item_simple(agenda_item)+ write_agenda_item_title(agenda_item.title, agenda_item.duration_in_minutes || 0, agenda_item.presenter)+ end++ def write_notes(agenda_item)+ return if agenda_item.notes.blank?++ pdf.indent(styles.agenda_item_indent) do+ write_markdown!(+ apply_markdown_field_macros(agenda_item.notes, { project: meeting.project, user: User.current }),+ styles.notes_markdown_styling_yml+ )+ end+ end++ def write_outcome(agenda_item)+ return unless agenda_item.outcomes.exists?++ outcome = agenda_item.outcomes.information_kind.last+ return if outcome.notes.blank?++ pdf.indent(styles.outcome_indent) do+ write_outcome_title+ write_outcome_notes(outcome.notes)+ end+ end++ def write_outcome_title+ with_vertical_margin(styles.outcome_title_margins) do+ pdf.formatted_text([{ text: I18n.t("label_agenda_outcome") }.merge(styles.outcome_title)])+ end+ end++ def write_outcome_notes(notes)+ write_markdown!(+ apply_markdown_field_macros(notes, { project: meeting.project, user: User.current }),+ styles.outcome_markdown_styling_yml+ )+ end+ end+enddiff --git a/modules/meeting/app/workers/meetings/pdf/attachments.rb b/modules/meeting/app/workers/meetings/pdf/attachments.rbnew file mode 100644index 00000000000..0d0f7a54beb--- /dev/null+++ b/modules/meeting/app/workers/meetings/pdf/attachments.rb@@ -0,0 +1,87 @@+# 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 Meetings::PDF+ module Attachments+ def write_attachments_list+ return if meeting.attachments.empty?++ columns_count = [meeting.attachments.size, 3].min+ rows = meeting_attachments_table_rows(columns_count)+ return if rows.empty?++ write_hr+ write_heading(attachments_list_title)+ write_attachments_list_table(rows, columns_count)+ end++ def write_attachments_list_table(rows, columns_count)+ with_vertical_margin(styles.attachments_margins) do+ pdf.table(+ rows,+ column_widths: attachments_list_table_column_widths(columns_count),+ cell_style: styles.attachments_table_cell+ )+ end+ end++ def attachments_list_table_column_widths(columns_count)+ width = pdf.bounds.width / columns_count+ [width] * columns_count+ end++ def meeting_attachments_table_rows(columns_count)+ groups = meeting.attachments.in_groups(columns_count)+ return [] if groups.empty?++ Array.new(groups[0].size) do |row_index|+ (0..(columns_count - 1)).map do |group_nr|+ { content: attachment_name(groups.dig(group_nr, row_index)), inline_format: true }+ end+ end+ end++ def attachment_name(attachment)+ return "" if attachment.nil?++ make_link_href(attachment_link_href(attachment), "<u>#{attachment.filename}</u>")+ end++ def attachment_link_href(attachment)+ "#{Setting.protocol}://#{Setting.host_name}#{+ API::V3::Utilities::PathHelper::ApiV3Path.attachment_content(attachment.id)+ }"+ end++ def attachments_list_title+ I18n.t(:label_attachment_plural)+ end+ end+enddiff --git a/modules/meeting/app/workers/meetings/pdf/page_head.rb b/modules/meeting/app/workers/meetings/pdf/page_head.rbnew file mode 100644index 00000000000..6adfb5d8077--- /dev/null+++ b/modules/meeting/app/workers/meetings/pdf/page_head.rb@@ -0,0 +1,109 @@+# 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 Meetings::PDF+ module PageHead+ def write_page_head+ with_vertical_margin(styles.page_heading_margins) do+ write_page_title+ end+ with_vertical_margin(styles.page_subtitle_margins) do+ write_meeting_subtitle+ end+ end++ def write_page_title+ pdf.formatted_text([styles.page_heading.merge(+ { text: meeting_title, link: url_helpers.meeting_url(meeting) }+ )])+ end++ def write_meeting_subtitle+ pdf.formatted_text(+ [+ prawn_badge(badge_text, badge_color, offset: 0, radius: 2),+ styles.page_subtitle.merge({ text: meeting_subtitle })+ ]+ )+ end++ def meeting_subtitle+ list = ["", meeting_subtitle_dates]+ list.push("-", meeting.recurring_meeting.base_schedule) if meeting.recurring?+ list.join(" ")+ end++ def meeting_subtitle_dates+ [+ "#{format_date(meeting.start_date)},",+ format_time(meeting.start_time, include_date: false),+ "–",+ format_time(meeting.end_time, include_date: false),+ "(#{OpenProject::Common::DurationComponent.new(meeting.duration, :hours, abbreviated: true).text})"+ ].join(" ")+ end++ def badge_text+ case meeting.state+ when "open"+ I18n.t("label_meeting_state_open")+ when "in_progress"+ I18n.t("label_meeting_state_in_progress")+ when "closed"+ I18n.t("label_meeting_state_closed")+ else+ meeting.state+ end+ end++ def badge_color+ meetings_state_color.hexcode&.sub("#", "") || "F0F0F0"+ end++ def meetings_state_color+ case meeting.state+ when "in_progress"+ Meetings::Statuses::IN_PROGRESS.color+ when "closed"+ Meetings::Statuses::CLOSED.color+ else+ Meetings::Statuses::OPEN.color+ end+ end++ def meeting_title+ if meeting.recurring?+ "#{format_date(meeting.start_date)} - #{meeting.title}"+ else+ meeting.title+ end+ end+ end+enddiff --git a/modules/meeting/app/workers/meetings/pdf/participants.rb b/modules/meeting/app/workers/meetings/pdf/participants.rbnew file mode 100644index 00000000000..a998969a5f9--- /dev/null+++ b/modules/meeting/app/workers/meetings/pdf/participants.rb@@ -0,0 +1,84 @@+# 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 Meetings::PDF+ module Participants+ def write_participants+ return if participants.empty?++ write_hr+ write_heading(participants_title)+ write_participants_table+ end++ def write_participants_table+ columns_count = [participants.size, 3].min++ rows = participants_table_rows(columns_count)+ with_vertical_margin(styles.participants_margins) do+ pdf.table(+ rows,+ column_widths: participants_table_column_widths(columns_count),+ cell_style: styles.participants_table_cell+ )+ end+ end++ def participants_table_column_widths(columns_count)+ width = pdf.bounds.width / columns_count+ [width] * columns_count+ end++ def participants+ meeting.invited_or_attended_participants+ end++ def participants_table_rows(columns_count)+ groups = participants.in_groups(columns_count)+ return [] if groups.empty?++ Array.new(groups[0].size) do |row_index|+ (0..(columns_count - 1)).map do |group_nr|+ { content: participant_name(groups.dig(group_nr, row_index)) }+ end+ end+ end++ def participant_name(participant)+ return "" if participant.nil?++ participant.name+ end++ def participants_title+ "#{Meeting.human_attribute_name(:participants)} (#{meeting.invited_or_attended_participants.count})"+ end+ end+enddiff --git a/modules/meeting/config/locales/en.yml b/modules/meeting/config/locales/en.ymlindex a27d244ff32..8de00a5b8ef 100644--- a/modules/meeting/config/locales/en.yml+++ b/modules/meeting/config/locales/en.yml@@ -258,6 +258,29 @@ en:blankslate:title: "No meetings to display"desc: "There are no meetings that meet the active filter criteria."+ label_export_pdf: "Export PDF"+ export:+ your_meeting_export: "Meeting is being exported"+ label_meeting_agenda: "Meeting agenda"+ export_pdf_dialog:+ title: Export PDF+ description: Generate a printable PDF file of this meeting at the current state+ include_participants:+ label: Include list of participants+ caption: A list of participants will be preset above the meeting agenda+ include_attachments:+ label: Include list of attachments+ caption: A list containing the filenames of attachments will be appended at the end+ include_backlog:+ label: Include backlog+ caption: Backlog elements are not normally considered part of a meeting occurrence but you can choose to include them+ include_outcomes:+ label: Include agenda outcomes+ caption: If your agenda outcomes contain confidential information, you can choose to not include them in the export+ footer_text:+ label: Footer text+ caption: This text will appear on every page on the right of the footer.+ submit_button: Downloadmeeting_section:untitled_title: "Untitled section"diff --git a/modules/meeting/config/routes.rb b/modules/meeting/config/routes.rbindex 0ce163b5f11..12da77fe6c6 100644--- a/modules/meeting/config/routes.rb+++ b/modules/meeting/config/routes.rb@@ -50,6 +50,7 @@ Rails.application.routes.draw dopost :notifyget :historyget :delete_dialog+ get :generate_pdf_dialogendenddiff --git a/modules/meeting/lib/open_project/meeting/engine.rb b/modules/meeting/lib/open_project/meeting/engine.rbindex 5d71ab705c3..84e216310e4 100644--- a/modules/meeting/lib/open_project/meeting/engine.rb+++ b/modules/meeting/lib/open_project/meeting/engine.rb@@ -43,7 +43,8 @@ module OpenProject::Meetingproject_module :meetings dopermission :view_meetings,{- meetings: %i[index show check_for_updates download_ics participants_dialog history],+ meetings: %i[index show check_for_updates download_ics participants_dialog+ generate_pdf_dialog history],"meetings/menus": %i[show],work_package_meetings_tab: %i[index count],recurring_meetings: %i[index show new create download_ics]@@ -180,6 +181,10 @@ module OpenProject::MeetingOpenProject::ProjectLatestActivity.register on: "Meeting"PermittedParams.permit(:search, :meetings)++ ::Exports::Register.register do+ single(::Meeting, Meetings::Exporter)+ endendadd_api_path :meetings dodiff --git a/modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rb b/modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rbindex 06039fe6510..02be677f193 100644--- a/modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rb+++ b/modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rb@@ -223,6 +223,15 @@ RSpec.describe "Meetings CRUD",expect_flash(type: :success, message: "Successful deletion.")end+ it "can open the export dialog" do+ show_page.trigger_dropdown_menu_item "Export PDF"+ show_page.expect_modal "Export PDF"++ show_page.within_modal "Export PDF" do+ expect(page).to have_button("Download")+ end+ end+context "when exporting as ICS" dobefore do@download_list = DownloadList.newdiff --git a/modules/meeting/spec/features/structured_meetings/structured_meeting_export_spec.rb b/modules/meeting/spec/features/structured_meetings/structured_meeting_export_spec.rbnew file mode 100644index 00000000000..a4b5eaf8067--- /dev/null+++ b/modules/meeting/spec/features/structured_meetings/structured_meeting_export_spec.rb@@ -0,0 +1,135 @@+# 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.+#++++require "spec_helper"++require_relative "../../support/pages/meetings/show"++RSpec.describe "Meetings Export PDF",+ :js, :selenium do+ shared_let(:project) { create(:project, enabled_module_names: %w[meetings]) }+ shared_let(:meeting) { create(:meeting, project:) }+ shared_let(:user) do+ create(:user,+ lastname: "First",+ member_with_permissions: { project => %i[view_meetings create_meetings edit_meetings delete_meetings manage_agendas+ view_work_packages] }).tap do |u|+ u.pref[:time_zone] = "Etc/UTC"++ u.save!+ end+ end+ let(:show_page) { Pages::Meetings::Show.new(meeting) }+ let(:exporter) { instance_double(Meetings::ExportJob) }+ let(:default_expected_params) do+ {+ participants: "1",+ attachments: "0",+ backlog: "0",+ outcomes: "0",+ footer_text_right: project.name+ }+ end+ let(:expected_params) do+ default_expected_params+ end++ RSpec::Matchers.define :has_mandatory_options do |expected|+ match do |actual|+ options = actual[:options] || {}+ expected.count do |key, value|+ options[key.to_sym] == value+ end == expected.size+ end+ end++ def generate!+ click_link_or_button "Download"+ sleep 0.5 # quick fix: allow the browser to process the action+ retry_block do+ expect(page).to have_no_button("Download", wait: 3)+ show_page.expect_modal "Background job status", wait: 3+ end+ end++ def mock_generating_pdf+ allow(Meetings::ExportJob)+ .to receive(:perform_later)+ .with(has_mandatory_options(expected_params))+ .and_call_original+ end++ before do+ mock_generating_pdf+ login_as user+ show_page.visit!+ show_page.trigger_dropdown_menu_item "Export PDF"+ show_page.expect_modal "Export PDF"+ end++ context "with default options" do+ it "can submit the export dialog with options" do+ expect(show_page).to have_field("pdf_include_participants", checked: true)+ expect(show_page).to have_field("pdf_include_attachments", checked: false)+ expect(show_page).to have_field("pdf_include_backlog", checked: false)+ expect(show_page).to have_field("pdf_include_outcomes", checked: false)+ generate!+ end+ end++ context "with changed options" do+ let(:expected_params) do+ default_expected_params.merge(participants: "0", attachments: "1", backlog: "1", outcomes: "1")+ end++ it "can submit the export dialog with options" do+ show_page.uncheck "pdf_include_participants"+ show_page.check "pdf_include_attachments"+ show_page.check "pdf_include_backlog"+ show_page.check "pdf_include_outcomes"+ expect(show_page).to have_field("pdf_include_participants", checked: false)+ expect(show_page).to have_field("pdf_include_attachments", checked: true)+ expect(show_page).to have_field("pdf_include_backlog", checked: true)+ expect(show_page).to have_field("pdf_include_outcomes", checked: true)+ generate!+ end+ end++ context "with custom footer text" do+ let(:expected_params) do+ default_expected_params.merge(footer_text_right: "Custom Footer Text")+ end++ it "can submit the export dialog with options" do+ show_page.fill_in "pdf_footer_text_right", with: "Custom Footer Text"+ generate!+ end+ end+enddiff --git a/modules/meeting/spec/workers/meetings/export_job_spec.rb b/modules/meeting/spec/workers/meetings/export_job_spec.rbnew file mode 100644index 00000000000..a6f89ec56ff--- /dev/null+++ b/modules/meeting/spec/workers/meetings/export_job_spec.rb@@ -0,0 +1,83 @@+# 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.+#++++require "spec_helper"++RSpec.describe Meetings::ExportJob do+ let(:user) { build_stubbed(:user) }+ let(:project) { create(:project, enabled_module_names: %w[meetings]) }+ let(:meeting) do+ create :meeting,+ project:,+ start_time: "2024-12-31T13:30:00Z",+ duration: 1.5,+ author: user+ end++ before do+ mock_permissions_for(user, &:allow_everything)+ end++ def perform_meeting_export+ job = described_class.new(+ export: MeetingExport.create,+ user: user,+ mime_type: :pdf,+ query: meeting,+ options: {}+ )+ job.perform_now+ job+ end++ RSpec::Matchers.define :have_one_attachment_with_content_type do |expected_content_type|+ def attachments(export_job)+ export_job.status_reference.attachments+ end++ match do |export_job|+ attachments_content_types = attachments(export_job).pluck(:content_type)+ attachments_content_types == [expected_content_type]+ end++ failure_message do |export_job|+ attachments_content_types = attachments(export_job).pluck(:content_type)+ "expected that #{actual} would have one attachment with mime type #{expected.inspect}, " \+ "got #{attachments_content_types.inspect} instead"+ end+ end++ it "generates an PDF export successfully" do+ job = perform_meeting_export++ expect(job.job_status).to be_success, job.job_status.message+ expect(job).to have_one_attachment_with_content_type("application/pdf")+ end+enddiff --git a/modules/meeting/spec/workers/meetings/exporter_spec.rb b/modules/meeting/spec/workers/meetings/exporter_spec.rbnew file mode 100644index 00000000000..a87a619ef2f--- /dev/null+++ b/modules/meeting/spec/workers/meetings/exporter_spec.rb@@ -0,0 +1,230 @@+# 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.+#++++require "spec_helper"+require "pdf/inspector"++RSpec.describe Meetings::Exporter do+ include Redmine::I18n+ shared_let(:user) { create(:user, firstname: "Export", lastname: "User") }+ shared_let(:project) { create(:project, enabled_module_names: %w[meetings]) }+ shared_let(:export_time) { DateTime.new(2025, 6, 3, 13, 37) }+ shared_let(:export_time_formatted) { format_date(export_time) }+ shared_let(:recurring_meeting) do+ create :recurring_meeting,+ project:,+ author: user,+ start_time: DateTime.parse("2024-12-05T10:00:00Z"),+ frequency: "daily"+ end+ shared_let(:work_package) { create(:work_package) }+ let(:options) do+ {+ participants: "0",+ outcomes: "0",+ backlog: "0"+ }+ end+ let(:exporter) { described_class.new(meeting, options) }+ let(:meeting_agenda_item) { create(:meeting_agenda_item, meeting:) }+ let(:meeting) do+ create(:meeting, :author_participates,+ project:, title: "Awesome meeting!", location: "Moon Base")+ end++ subject(:pdf) do+ result = Timecop.freeze(export_time) do+ exporter.export!+ end+ # If you want to actually see the PDF for debugging, uncomment the following line+ # File.binwrite("Meetings-test-preview.pdf", result.content)+ # `open Meetings-test-preview.pdf`+ PDF::Inspector::Text.analyze(result.content).strings.join(" ")+ end++ def expected_cover_page+ [project.name,+ meeting.title,+ "#{meeting.start_date} #{meeting.start_time_hour}",+ meeting.location,+ export_time_formatted]+ end++ def single_meeting_head+ [meeting.title,+ " #{exporter.badge_text} ",+ exporter.meeting_subtitle_dates]+ end++ def recurring_meeting_head+ [format_date(meeting.start_date), "-", meeting.title,+ " #{exporter.badge_text} ",+ exporter.meeting_subtitle_dates,+ "-", meeting.recurring_meeting.base_schedule]+ end++ context "with an empty single meeting" do+ it "renders the expected document" do+ expected_document = [+ *expected_cover_page,+ *single_meeting_head,+ "1", # Page number+ export_time_formatted,+ project.name+ ].join(" ")++ expect(subject).to eq expected_document+ end+ end++ context "with an empty recurring meeting" do+ let!(:meeting) do+ create(:meeting, :author_participates, recurring_meeting:, project:, title: "Awesome meeting!", location: "Moon Base")+ end++ it "renders the expected document" do+ expected_document = [+ *expected_cover_page,+ *recurring_meeting_head,+ "1", # Page number+ export_time_formatted,+ project.name+ ].join(" ")++ expect(subject).to eq expected_document+ end+ end++ context "with a meeting with agenda items" do+ let(:type_task) { create(:type_task) }+ let(:status) { create(:status, is_default: true, name: "Workin' on it") }+ let(:work_package) { create(:work_package, project:, status:, subject: "Important task", type: type_task) }+ let(:meeting_section) { create(:meeting_section, meeting:, title: "Section Work in Progress") }+ let(:meeting_agenda_item) do+ create(:meeting_agenda_item, meeting_section:, duration_in_minutes: 15, title: "Agenda Item TOP 1", presenter: user,+ notes: "**foo**")+ end+ let(:wp_agenda_item) { create(:wp_meeting_agenda_item, meeting:, work_package:, duration_in_minutes: 10, notes: "*bar*") }+ let(:outcome) { create(:meeting_outcome, meeting_agenda_item:, notes: "An outcome") }+ let(:attachment) { create(:attachment, container: meeting) }+ let(:meeting_backlog_item) do+ create(:meeting_agenda_item, meeting_section: meeting.backlog,+ duration_in_minutes: 1,+ title: "Agenda Item in Backlog", presenter: user, notes: "# yeah")+ end++ before do+ meeting_agenda_item # create the agenda item+ wp_agenda_item # create the wp agenda item+ outcome # create the outcome+ attachment # create the attachment+ meeting_backlog_item # create the backlog item+ end++ context "with bells and whistles options" do+ let(:options) do+ {+ participants: "1",+ outcomes: "1",+ backlog: "1",+ attachments: "1",+ footer_text_right: "Custom Footer Text"+ }+ end++ it "renders the expected document" do+ expected_document = [+ *expected_cover_page,+ *single_meeting_head,+ "Participants (1)",+ meeting.author.name,++ "Meeting agenda",++ "Section Work in Progress", " ", "25 mins",++ "Agenda Item TOP 1", " ", "15 mins", " ", "Export User",+ "foo",+ "Outcome",+ "An outcome",++ "Task", "##{work_package.id}", "Important task", " (Workin' on it)", " ", "10 mins",+ "bar",++ "Attachments",+ attachment.filename,++ "Agenda backlog",+ "Agenda Item in Backlog", " ", "1 min", " ", "Export User",+ "yeah",++ "1", # Page number+ export_time_formatted,+ "Custom Footer Text"+ ].join(" ")++ expect(subject).to eq expected_document+ end+ end++ context "with minimal options" do+ let(:options) do+ {+ participants: "0",+ outcomes: "0",+ backlog: "0",+ attachments: "0"+ }+ end++ it "renders the expected document" do+ expected_document = [+ *expected_cover_page,+ *single_meeting_head,+ "Meeting agenda",++ "Section Work in Progress", " ", "25 mins",++ "Agenda Item TOP 1", " ", "15 mins", " ", "Export User",+ "foo",++ "Task", "##{work_package.id}", "Important task", " (Workin' on it)", " ", "10 mins",+ "bar",++ "1", # Page number+ export_time_formatted,+ project.name+ ].join(" ")++ expect(subject).to eq expected_document+ end+ end+ end+enddiff --git a/script/pdf_export/validate_styles b/script/pdf_export/validate_stylesindex 69eb195dbe4..c2ea41c2657 100755--- a/script/pdf_export/validate_styles+++ b/script/pdf_export/validate_styles@@ -11,7 +11,7 @@ class SchemaValidatordef validateroot = File.expand_path("../../", __dir__)export_folder = File.join(root, "app", "models", "work_package", "pdf_export", "export")- %w[report wp timesheet].each do |type|+ %w[report wp timesheet meetings].each do |type|puts "Validating #{type} styles"schema = JSON::load_file(File.join(export_folder, type, "schema.json"))styles_file = File.join(export_folder, type, "standard.yml")diff --git a/spec/models/work_package/pdf_export/common/badge_spec.rb b/spec/models/work_package/pdf_export/common/badge_spec.rbindex 84ed7139095..324ee7e4fcd 100644--- a/spec/models/work_package/pdf_export/common/badge_spec.rb+++ b/spec/models/work_package/pdf_export/common/badge_spec.rb@@ -34,28 +34,36 @@ RSpec.describe WorkPackage::PDFExport::Common::Badge dolet(:badge) { Class.new { extend WorkPackage::PDFExport::Common::Badge } }describe "#readable_color" do- it "returns white for dark colors: black" do- expect(badge.readable_color("000000")).to eq("FFFFFF")- end+ describe "returns white for dark colors" do+ it "black" do+ expect(badge.readable_color("000000")).to eq("FFFFFF")+ end- it "returns white for dark colors: dark blue" do- expect(badge.readable_color("1864AB")).to eq("FFFFFF")- end+ it "dark blue" do+ expect(badge.readable_color("1864AB")).to eq("FFFFFF")+ end- it "returns white for dark colors: blue-6" do- expect(badge.readable_color("228BE6")).to eq("000000")+ it "purple" do+ expect(badge.readable_color("894CEB")).to eq("FFFFFF")+ endend- it "returns black for light colors: orange-2" do- expect(badge.readable_color("FFD8A8")).to eq("000000")- end+ describe "returns black for light colors" do+ it "blue-6" do+ expect(badge.readable_color("228BE6")).to eq("000000")+ end- it "returns black for light colors: cyan-0" do- expect(badge.readable_color("E3FAFC")).to eq("000000")- end+ it "orange-2" do+ expect(badge.readable_color("FFD8A8")).to eq("000000")+ end++ it "cyan-0" do+ expect(badge.readable_color("E3FAFC")).to eq("000000")+ end- it "returns black for light colors: white" do- expect(badge.readable_color("FFFFFF")).to eq("000000")+ it "white" do+ expect(badge.readable_color("FFFFFF")).to eq("000000")+ endendendenddiff --git a/spec/models/work_package/pdf_export/common/macro_spec.rb b/spec/models/work_package/pdf_export/common/macro_spec.rbnew file mode 100644index 00000000000..9d32edcad91--- /dev/null+++ b/spec/models/work_package/pdf_export/common/macro_spec.rb@@ -0,0 +1,94 @@+# 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.+#++++require "spec_helper"++RSpec.describe WorkPackage::PDFExport::Common::Macro do+ let(:work_package) do+ create(:work_package, id: 185, subject: "Work package 1")+ end+ let(:markdown) { "" }+ let(:formatter) { Class.new { extend WorkPackage::PDFExport::Common::Macro } }++ subject(:formatted) do+ formatter.apply_markdown_field_macros(markdown, { work_package: work_package, user: User.current })+ end++ describe "empty text" do+ it "contains correct data" do+ expect(formatted).to eq ""+ end+ end++ describe "wp mention tag" do+ let(:markdown) { '<mention class="mention" data-id="185" data-type="work_package" data-text="#185">#185</mention>' }++ it "ignores the tag" do+ expect(formatted).to eq("<mention class=\"mention\" data-id=\"185\" " ++ "data-type=\"work_package\" data-text=\"#185\">\\#185</mention>\n")+ end+ end++ describe "wp mention plain" do+ let(:markdown) { "#185" }++ it "contains correct data" do+ expect(formatted).to eq("<mention class=\"mention\" data-id=\"185\" " ++ "data-type=\"work_package\" data-text=\"#185\">#185</mention>\n")+ end+ end++ describe "wp mention with markdown formating bold" do+ let(:markdown) { "\n**#185**\n" }++ it "contains correct data" do+ expect(formatted).to eq("**<mention class=\"mention\" data-id=\"185\" " ++ "data-type=\"work_package\" data-text=\"#185\">#185</mention>**\n")+ end+ end++ describe "wp mention with markdown formating strikethrough" do+ let(:markdown) { "~~#185~~" }++ it "contains correct data" do+ expect(formatted).to eq("~~<mention class=\"mention\" data-id=\"185\" " ++ "data-type=\"work_package\" data-text=\"#185\">#185</mention>~~\n")+ end+ end++ describe "wp mention with strikethrough in table" do+ let(:markdown) { "<table><tr><td><p><s>##185</s></p></td></tr></table>" }++ it "contains correct data" do+ expect(formatted).to eq("<table><tr><td><p><s><mention class=\"mention\" data-id=\"185\" " ++ "data-type=\"work_package\" data-text=\"##185\">##185</mention></s></p></td></tr></table>\n")+ end+ end+enddiff --git a/spec/models/work_package/pdf_export/document_generator_spec.rb b/spec/models/work_package/pdf_export/document_generator_spec.rbindex d15ab4bbb37..99d6d586f59 100644--- a/spec/models/work_package/pdf_export/document_generator_spec.rb+++ b/spec/models/work_package/pdf_export/document_generator_spec.rb@@ -38,6 +38,7 @@ RSpec.describe WorkPackage::PDFExport::DocumentGenerator doendlet(:export_time) { DateTime.new(2023, 6, 30, 23, 59) }let(:export_time_formatted) { format_time(export_time, include_date: true) }+ let(:export_date_formatted) { format_date(export_time) }let(:export_pdf) doTimecop.freeze(export_time) doexport.export!@@ -56,7 +57,7 @@ RSpec.describe WorkPackage::PDFExport::DocumentGenerator doexpected_result = ["This is a test description with an macro:",user.name,- export_time_formatted,+ export_date_formatted,"A text in the center of the footer","Page 1 of 1"]@@ -80,7 +81,7 @@ RSpec.describe WorkPackage::PDFExport::DocumentGenerator doexpected_result = ["honorificabilitudinitatibus honorificabilitudinitatibus honorificabilitudinitatibus " \"honorificabili tudinitatibus honorificabilitudinitatibus honorificabilitudinitatibus",- export_time_formatted,+ export_date_formatted,"Page 1 of 1"]result = pdfdiff --git a/spec/models/work_packages/pdf_export/work_package_list_to_pdf_gantt_spec.rb b/spec/models/work_packages/pdf_export/work_package_list_to_pdf_gantt_spec.rbindex a8d956d46ad..1fc3aba1d00 100644--- a/spec/models/work_packages/pdf_export/work_package_list_to_pdf_gantt_spec.rb+++ b/spec/models/work_packages/pdf_export/work_package_list_to_pdf_gantt_spec.rb@@ -80,7 +80,7 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageListToPdf doendendlet(:export_time) { DateTime.new(2024, 4, 22, 12, 37) }- let(:export_time_formatted) { format_time(export_time, include_date: true) }+ let(:export_date_formatted) { format_date(export_time) }let(:export) dologin_as(user)work_packages@@ -189,7 +189,7 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageListToPdf doexpect(pdf[:strings]).to eq [query.name, "2024 Apr 21 22 23", # header columnswp_title_column(work_package_task),wp_title_column(work_package_milestone),- "1/1", export_time_formatted, query.name].join(" ").squeeze(" ")+ "1/1", export_date_formatted, query.name].join(" ").squeeze(" ")# if one of these expect fails you can output the actual pdf calls uncommenting the following line# show_calls@@ -221,9 +221,9 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageListToPdf doexpect(pdf[:strings]).to eq [query.name, "2024 Apr May 21 22 23 24 25 26 27 28 29 30 1 2 3 4 5", # header columnswp_title_column(work_package_task),wp_title_column(work_package_milestone),- "1/2", export_time_formatted, query.name,+ "1/2", export_date_formatted, query.name,"2024 May 6 7 8", # header columns- "2/2", export_time_formatted, query.name].join(" ").squeeze(" ")+ "2/2", export_date_formatted, query.name].join(" ").squeeze(" ")# if one of these expect fails you can output the actual pdf calls uncommenting the following line# show_calls@@ -258,25 +258,25 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageListToPdf doquery.name, "2024 Apr May 21 22 23 24 25 26 27 28 29 30 1 2 3 4 5", # header columnswp_title_column(work_package_task),filler_work_packages.slice(0, 17).map.map { |wp| wp_title_column(wp) },- "1/6", export_time_formatted, query.name,+ "1/6", export_date_formatted, query.name,"2024 May 6 7 8", # header columns- "2/6", export_time_formatted, query.name,+ "2/6", export_date_formatted, query.name,query.name, "2024 Apr May 21 22 23 24 25 26 27 28 29 30 1 2 3 4 5", # header columnsfiller_work_packages.slice(17, 18).map { |wp| wp_title_column(wp) },- "3/6", export_time_formatted, query.name,+ "3/6", export_date_formatted, query.name,"2024 May 6 7 8", # header columns- "4/6", export_time_formatted, query.name,+ "4/6", export_date_formatted, query.name,query.name, "2024 Apr May 21 22 23 24 25 26 27 28 29 30 1 2 3 4 5", # header columnsfiller_work_packages.slice(35, 15).map { |wp| wp_title_column(wp) },wp_title_column(work_package_milestone),- "5/6", export_time_formatted, query.name,+ "5/6", export_date_formatted, query.name,"2024 May 6 7 8", # header columns- "6/6", export_time_formatted, query.name+ "6/6", export_date_formatted, query.name].flatten.join(" ").squeeze(" ")end@@ -319,16 +319,16 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageListToPdf doquery.name, "2024 Apr May 21 22 23 24 25 26 27 28 29 30 1", # header columnswp_title_column(work_package_task),filler_work_packages.slice(0, 17).map { |wp| wp_title_column(wp) },- "1/3", export_time_formatted, query.name,+ "1/3", export_date_formatted, query.name,query.name, "2024 Apr May 21 22 23 24 25 26 27 28 29 30 1", # header columnsfiller_work_packages.slice(17, 18).map { |wp| wp_title_column(wp) },- "2/3", export_time_formatted, query.name,+ "2/3", export_date_formatted, query.name,query.name, "2024 Apr May 21 22 23 24 25 26 27 28 29 30 1", # header columnsfiller_work_packages.slice(35, 15).map { |wp| wp_title_column(wp) },wp_title_column(work_package_milestone),- "3/3", export_time_formatted, query.name+ "3/3", export_date_formatted, query.name].flatten.join(" ").squeeze(" ")end@@ -368,7 +368,7 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageListToPdf dowp_title_column(work_package_milestone),type_standard.name,wp_title_column(work_package_task),- "1/1", export_time_formatted, query.name].join(" ").squeeze(" ")+ "1/1", export_date_formatted, query.name].join(" ").squeeze(" ")# if one of these expect fails you can output the actual pdf calls uncommenting the following line# show_callsdiff --git a/spec/models/work_packages/pdf_export/work_package_list_to_pdf_spec.rb b/spec/models/work_packages/pdf_export/work_package_list_to_pdf_spec.rbindex 4dbafcac63e..386df9a46e3 100644--- a/spec/models/work_packages/pdf_export/work_package_list_to_pdf_spec.rb+++ b/spec/models/work_packages/pdf_export/work_package_list_to_pdf_spec.rb@@ -64,7 +64,7 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageListToPdf domember_with_permissions: { project => %w[view_work_packages export_work_packages] })endshared_let(:export_time) { DateTime.new(2023, 6, 30, 23, 59) }- shared_let(:export_time_formatted) { format_time(export_time, include_date: true) }+ shared_let(:export_date_formatted) { format_date(export_time) }shared_let(:work_package_parent) docreate(:work_package,project:,@@ -164,7 +164,7 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageListToPdf doenddef cover_page_content- [project.name, query.name, user.name, export_time_formatted]+ [project.name, query.name, user.name, export_date_formatted]enddef show@@ -191,7 +191,7 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageListToPdf do*column_titles,*work_package_columns(work_package_parent),*work_package_columns(work_package_child),- "1/1", export_time_formatted, query.name+ "1/1", export_date_formatted, query.name].join(" ")endend@@ -208,7 +208,7 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageListToPdf dowork_package_child.type.name,*column_titles,*work_package_columns(work_package_child),- "1/1", export_time_formatted, query.name+ "1/1", export_date_formatted, query.name].join(" ")endend@@ -227,7 +227,7 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageListToPdf do*column_titles,*work_package_columns(work_package_child),I18n.t("js.label_sum"), work_package_child.story_points.to_s, "50%",- "1/1", export_time_formatted, query.name+ "1/1", export_date_formatted, query.name].join(" ")endend@@ -246,7 +246,7 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageListToPdf do*column_titles,*work_package_columns(work_package_parent),I18n.t("js.label_sum"), work_package_parent.story_points.to_s, "25%",- "1/1", export_time_formatted, query.name+ "1/1", export_date_formatted, query.name].join(" ")endend@@ -265,10 +265,10 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageListToPdf doquery.name,"1.", "2", work_package_parent.subject,"2.", "2", work_package_child.subject,- "1/2", export_time_formatted, query.name,+ "1/2", export_date_formatted, query.name,*work_package_details(work_package_parent, "1", long_text_fields),*work_package_details(work_package_child, "2", long_text_fields),- "2/2", export_time_formatted, query.name+ "2/2", export_date_formatted, query.name].join(" ")endend@@ -283,10 +283,10 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageListToPdf doquery.name,"1.", "2", work_package_parent.subject,"2.", "2", work_package_child.subject,- "1/2", export_time_formatted, query.name,+ "1/2", export_date_formatted, query.name,*work_package_details(work_package_parent, "1", long_text_fields),*work_package_details(work_package_child, "2", long_text_fields),- "2/2", export_time_formatted, query.name+ "2/2", export_date_formatted, query.name].join(" ")endend@@ -301,10 +301,10 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageListToPdf doquery.name,"1.", "2", work_package_parent.subject,"2.", "2", work_package_child.subject,- "1/2", export_time_formatted, query.name,+ "1/2", export_date_formatted, query.name,*work_package_details(work_package_parent, "1", long_text_fields),*work_package_details(work_package_child, "2", long_text_fields),- "2/2", export_time_formatted, query.name+ "2/2", export_date_formatted, query.name].join(" ")endend@@ -318,10 +318,10 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageListToPdf doquery.name,"1.", "2", work_package_parent.subject,"1.1.", "2", work_package_child.subject,- "1/2", export_time_formatted, query.name,+ "1/2", export_date_formatted, query.name,*work_package_details(work_package_parent, "1", long_text_fields),*work_package_details(work_package_child, "1.1", long_text_fields),- "2/2", export_time_formatted, query.name+ "2/2", export_date_formatted, query.name].join(" ")endend@@ -335,14 +335,14 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageListToPdf doquery.name,"1.", "2", work_package_parent.subject,"2.", "2", work_package_child.subject,- "1/2", export_time_formatted, query.name,+ "1/2", export_date_formatted, query.name,I18n.t("js.work_packages.tabs.overview"),column_title(:story_points),column_title(:done_ratio),I18n.t("js.label_sum"), work_packages_sum.to_s, "38%",*work_package_details(work_package_parent, "1", long_text_fields),*work_package_details(work_package_child, "2", long_text_fields),- "2/2", export_time_formatted, query.name+ "2/2", export_date_formatted, query.name].join(" ")endend@@ -356,7 +356,7 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageListToPdf doquery.name,"1.", "2", work_package_parent.subject,"2.", "2", work_package_child.subject,- "1/2", export_time_formatted, query.name,+ "1/2", export_date_formatted, query.name,I18n.t("js.work_packages.tabs.overview"),column_title(:type), column_title(:story_points), column_title(:done_ratio),work_package_parent.type.name, work_package_parent.story_points.to_s, "25%",@@ -364,7 +364,7 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageListToPdf doI18n.t("js.label_sum"), work_packages_sum.to_s, "38%",*work_package_details(work_package_parent, "1", long_text_fields),*work_package_details(work_package_child, "2", long_text_fields),- "2/2", export_time_formatted, query.name+ "2/2", export_date_formatted, query.name].join(" ")endend@@ -378,7 +378,7 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageListToPdf doquery.name,"1.", "2", work_package_child.subject,"2.", "2", work_package_parent.subject,- "1/2", export_time_formatted, query.name,+ "1/2", export_date_formatted, query.name,I18n.t("js.work_packages.tabs.overview"),list_custom_field.name, column_title(:story_points), column_title(:done_ratio),@@ -388,7 +388,7 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageListToPdf do*work_package_details(work_package_child, "1", long_text_fields),*work_package_details(work_package_parent, "2", long_text_fields),- "2/2", export_time_formatted, query.name+ "2/2", export_date_formatted, query.name].join(" ")endenddiff --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.rbindex 56893afe549..1f1c9ba2060 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@@ -96,6 +96,7 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageToPdf dolet(:version) { create(:version, project:) }let(:export_time) { DateTime.new(2023, 6, 30, 23, 59) }let(:export_time_formatted) { format_time(export_time, include_date: true) }+ let(:export_date_formatted) { format_date(export_time) }let(:image_path) { Rails.root.join("spec/fixtures/files/image.png") }let(:priority) { create(:priority_normal) }let(:image_attachment) { Attachment.new author: user, file: File.open(image_path) }@@ -278,7 +279,7 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageToPdf do"amet", ", consetetur sadipscing elitr.", " ", "@OpenProject Admin","Image Caption","Foo",- "1", export_time_formatted, project.name+ "1", export_date_formatted, project.name].flatten.join(" ")expect(result).to eq(expected_result)expect(result).not_to include("DisabledCustomField")@@ -364,7 +365,7 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageToPdf doexpected_result = [*expected_details,label_title(:description),- "1", export_time_formatted, project.name,+ "1", export_date_formatted, project.name,"Work package attributes and labels",supported_work_package_embeds.map do |embed|[WorkPackage.human_attribute_name(@@ -382,7 +383,7 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageToPdf do"Access denied: ","[#{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+ "2", export_date_formatted, project.name].flatten.join(" ")expect(result).to eq(expected_result)end@@ -455,7 +456,7 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageToPdf doend,"Custom field boolean", I18n.t(:general_text_Yes),- "1", export_time_formatted, project.name,+ "1", export_date_formatted, project.name,"Custom field rich text", "[#{I18n.t('export.macro.rich_text_unsupported')}]","Custom field hidden",@@ -473,7 +474,7 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageToPdf doI18n.t('export.macro.resource_not_found', resource: "Project #{forbidden_project.id}"))}] ","Access denied by identifier:", " ", "[Macro error, resource not found: Project", "forbidden-project]",- "2", export_time_formatted, project.name+ "2", export_date_formatted, project.name].flatten.join(" ")end