OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
feat(logo): use CustomStyle.current.logo if defined
as-op8f6050aa10d2
diff --git a/app/models/work_package/pdf_export/attachments.rb b/app/models/work_package/pdf_export/attachments.rbindex 682f6d0816f..5639c525a74 100644--- a/app/models/work_package/pdf_export/attachments.rb+++ b/app/models/work_package/pdf_export/attachments.rb@@ -48,8 +48,8 @@ module WorkPackage::PDFExport::AttachmentsFile.join(dir_path, "#{file_name}#{name_suffix}#{file_extension}")end- def pdf_embeddable?(attachment)- %w[image/jpeg image/png].include?(attachment.content_type)+ def pdf_embeddable?(content_type)+ %w[image/jpeg image/png].include?(content_type)enddef delete_all_resized_imagesdiff --git a/app/models/work_package/pdf_export/markdown.rb b/app/models/work_package/pdf_export/markdown.rbindex 069afcdffee..802446e8dd4 100644--- a/app/models/work_package/pdf_export/markdown.rb+++ b/app/models/work_package/pdf_export/markdown.rb@@ -207,7 +207,7 @@ module WorkPackage::PDFExport::Markdowndef attachment_image_filepath(work_package, src)# images are embedded into markup with the api-path as img.srcattachment = attachment_by_api_content_src(work_package, src)- return nil if attachment.nil? || attachment.file.local_file.nil? || !pdf_embeddable?(attachment)+ return nil if attachment.nil? || attachment.file.local_file.nil? || !pdf_embeddable?(attachment.content_type)resize_image(attachment.file.local_file.path)enddiff --git a/app/models/work_package/pdf_export/page.rb b/app/models/work_package/pdf_export/page.rbindex 003997e359c..eb810d73abf 100644--- a/app/models/work_package/pdf_export/page.rb+++ b/app/models/work_package/pdf_export/page.rb@@ -15,12 +15,23 @@ module WorkPackage::PDFExport::Pageenddef logo_pdf_image- image_file = Rails.root.join("app/assets/images/logo_openproject.png")+ image_file = custom_logo_image+ image_file = Rails.root.join("app/assets/images/logo_openproject.png") if image_file.nil?image_obj, image_info = pdf.build_image_object(image_file)scale = [logo_height / image_info.height.to_f, 1].min[image_obj, image_info, scale]end+ def custom_logo_image+ return unless CustomStyle.current.logo.present? && CustomStyle.current.logo.local_file.present?++ image_file = CustomStyle.current.logo.local_file.path+ content_type = OpenProject::ContentTypeDetector.new(image_file).detect+ return unless pdf_embeddable?(content_type)++ image_file+ end+def write_title!pdf.title = headingpdf.formatted_text([page_heading_style.merge({ text: heading })])