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

remove unnecessary function, better naming

as-opf77041b0065f
diff --git a/app/helpers/custom_styles_helper.rb b/app/helpers/custom_styles_helper.rb
index c63647fbd67..4e19d1294fc 100644
--- a/app/helpers/custom_styles_helper.rb
+++ b/app/helpers/custom_styles_helper.rb
@@ -79,21 +79,17 @@ module CustomStylesHelper
apply_custom_styles?(skip_ee_check: false) && CustomStyle.current.touch_icon.present?
end
- def export_font_file(custom_style, font)
- custom_style.id && font.present? ? File.basename(font.file.path) : nil
- end
-
- def export_fonts(custom_style)
+ def export_fonts_fields(custom_style)
%i[regular bold italic bold_italic].map do |variant|
field = :"export_font_#{variant}"
font = custom_style.public_send(field)
{
field: field,
- label: I18n.t(:"label_custom_export_font_#{variant}"),
+ label: I18n.t("label_custom_export_font_#{variant}"),
present: font.present?,
- filename: export_font_file(custom_style, font),
+ filename: custom_style.id && font.present? ? File.basename(font.file.path) : nil,
delete_path: public_send(:"custom_style_export_font_#{variant}_delete_path"),
- instructions: I18n.t(:"text_custom_export_font_#{variant}_instructions")
+ instructions: I18n.t("text_custom_export_font_#{variant}_instructions")
}
end
end
diff --git a/app/views/custom_styles/_pdf_export_font.html.erb b/app/views/custom_styles/_pdf_export_font.html.erb
index 98d0bd010e2..3ec2fef9d22 100644
--- a/app/views/custom_styles/_pdf_export_font.html.erb
+++ b/app/views/custom_styles/_pdf_export_font.html.erb
@@ -29,7 +29,7 @@ See COPYRIGHT and LICENSE files for more details.
<p><%= I18n.t(:label_custom_export_font_instructions) %></p>
-<% export_fonts(@custom_style).each do |font| %>
+<% export_fonts_fields(@custom_style).each do |font| %>
<%= form_for @custom_style, url: custom_style_path, html: { multipart: true, class: "form -vertical" } do |f| %>
<section class="form--section">
<fieldset class="form--fieldset">