Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Merge branch 'dev' into feature/66384-custom-font-for-pdf-exports

as-op3fe0d04c0416
diff --cc app/controllers/custom_styles_controller.rb
index c269eb3ef4c,53311bc1396..96f2202801b
--- a/app/controllers/custom_styles_controller.rb
+++ b/app/controllers/custom_styles_controller.rb
@@@ -197,18 -192,13 +205,19 @@@ class CustomStylesController < Applicat
end
def custom_style_params
- params.expect(custom_style: %i[logo remove_logo
- export_logo remove_export_logo
- export_cover remove_export_cover
- export_cover_text_color
- export_footer remove_export_footer
- favicon remove_favicon
- touch_icon remove_touch_icon])
+ params.expect(custom_style: %i[
+ logo remove_logo
+ export_logo remove_export_logo
+ export_cover remove_export_cover
++ export_footer remove_export_footer
+ favicon remove_favicon
+ touch_icon remove_touch_icon
+ export_font_regular remove_export_font_regular
+ export_font_bold remove_export_font_bold
+ export_font_italic remove_export_font_italic
+ export_font_bold_italic remove_export_font_bold_italic
+ export_cover_text_color
+ ])
end
def file_download(path_method)
diff --cc app/helpers/custom_styles_helper.rb
index 4e19d1294fc,b2481a8d695..7c1a62294da
--- a/app/helpers/custom_styles_helper.rb
+++ b/app/helpers/custom_styles_helper.rb
@@@ -47,13 -54,8 +54,15 @@@ module CustomStylesHelpe
name: "pdf_export_styles",
partial: "custom_styles/pdf_export_styles",
path: custom_style_path(tab: :pdf_export_styles),
- label: t(:"admin.custom_styles.tab_pdf_export_styles")
+ label: t(:"admin.custom_styles.tab_pdf_export_styles"),
+ pdf: true
+ },
+ {
+ name: "pdf_export_font",
+ partial: "custom_styles/pdf_export_font",
+ path: custom_style_path(tab: :pdf_export_font),
- label: t(:"admin.custom_styles.tab_pdf_export_font")
++ label: t(:"admin.custom_styles.tab_pdf_export_font"),
++ pdf: true
}
]
end
diff --cc app/models/custom_style.rb
index 18da96906d7,6afd6674705..b54b70b96d1
--- a/app/models/custom_style.rb
+++ b/app/models/custom_style.rb
@@@ -32,12 -32,9 +32,13 @@@ class CustomStyle < ApplicationRecor
mount_uploader :logo, OpenProject::Configuration.file_uploader
mount_uploader :export_logo, OpenProject::Configuration.file_uploader
mount_uploader :export_cover, OpenProject::Configuration.file_uploader
+ mount_uploader :export_footer, OpenProject::Configuration.file_uploader
mount_uploader :favicon, OpenProject::Configuration.file_uploader
mount_uploader :touch_icon, OpenProject::Configuration.file_uploader
+ mount_uploader :export_font_regular, OpenProject::Configuration.file_uploader
+ mount_uploader :export_font_bold, OpenProject::Configuration.file_uploader
+ mount_uploader :export_font_italic, OpenProject::Configuration.file_uploader
+ mount_uploader :export_font_bold_italic, OpenProject::Configuration.file_uploader
class << self
def current
@@@ -56,13 -53,12 +57,13 @@@
updated_at.to_i
end
- %i(favicon touch_icon export_logo export_cover logo
- %i(favicon touch_icon export_logo export_cover export_footer logo).each do |name|
++ %i(favicon touch_icon export_logo export_cover export_footer logo
+ export_font_regular export_font_bold export_font_italic export_font_bold_italic).each do |name|
define_method :"#{name}_path" do
- image = send(name)
+ attachment = send(name)
- if image.readable?
- image.local_file.path
+ if attachment.readable?
+ attachment.local_file.path
end
end
diff --cc config/locales/en.yml
index f900e7042f4,7f8f556d44a..23b57ce5696
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@@ -3050,10 -3050,7 +3051,11 @@@ en
label_custom_logo: "Custom logo"
label_custom_export_logo: "Custom export logo"
label_custom_export_cover: "Custom export cover background"
+ label_custom_export_footer: "Custom export footer image"
+ label_custom_export_font_regular: "Regular"
+ label_custom_export_font_bold: "Bold"
+ label_custom_export_font_italic: "Italic"
+ label_custom_export_font_bold_italic: "Bold Italic"
label_custom_export_cover_overlay: "Custom export cover background overlay"
label_custom_export_cover_text_color: "Text color"
label_custom_pdf_export_settings: "Custom PDF export settings"
@@@ -4409,18 -4406,9 +4411,21 @@@
text_custom_export_cover_instructions: >
This is the image that appears in the background of a cover page in your PDF exports.
It needs to be an about 800px width by 500px height sized PNG or JPEG image file.
+ text_custom_export_footer_instructions: >
+ PDF exports will include a graphical element positioned to the left of the footer.
+ This image must be a PNG or JPEG file with approximately 200 pixels in width.
+ label_custom_export_font_instructions: >
+ The following font files are used in your PDF exports.
+ Upload and manage custom TrueType (.ttf) fonts for PDF exports. Ensure your license permits PDF embedding.
+ For best results, use matching files from the same font family. If no font is provided, the default NotoSans font will be used.
+ text_custom_export_font_regular_instructions: >
+ This is the font file for regular text. It needs to be in TTF format and is required.
+ text_custom_export_font_bold_instructions: >
+ This is the font file for bold text. It needs to be in TTF format.
+ text_custom_export_font_italic_instructions: >
+ This is the font file for italic text. It needs to be in TTF format.
+ text_custom_export_font_bold_italic_instructions: >
+ This is the font file for bold and italic text. It needs to be in TTF format.
text_custom_favicon_instructions: >
This is the tiny icon that appears in your browser window/tab next to the
page's title.
diff --cc config/routes.rb
index fda3f967be9,3547fed7f65..cb2957b7d5b
--- a/config/routes.rb
+++ b/config/routes.rb
@@@ -503,12 -507,7 +507,13 @@@ Rails.application.routes.draw d
delete "design/logo" => "custom_styles#logo_delete", as: "custom_style_logo_delete"
delete "design/export_logo" => "custom_styles#export_logo_delete", as: "custom_style_export_logo_delete"
delete "design/export_cover" => "custom_styles#export_cover_delete", as: "custom_style_export_cover_delete"
+ delete "design/export_footer" => "custom_styles#export_footer_delete", as: "custom_style_export_footer_delete"
+ delete "design/export_font_regular" => "custom_styles#export_font_regular_delete",
+ as: "custom_style_export_font_regular_delete"
+ delete "design/export_font_bold" => "custom_styles#export_font_bold_delete", as: "custom_style_export_font_bold_delete"
+ delete "design/export_font_italic" => "custom_styles#export_font_italic_delete", as: "custom_style_export_font_italic_delete"
+ delete "design/export_font_bold_italic" => "custom_styles#export_font_bold_italic_delete",
+ as: "custom_style_export_font_bold_italic_delete"
delete "design/favicon" => "custom_styles#favicon_delete", as: "custom_style_favicon_delete"
delete "design/touch_icon" => "custom_styles#touch_icon_delete", as: "custom_style_touch_icon_delete"
post "design/colors" => "custom_styles#update_colors", as: "update_design_colors"