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

obey rubocop

as-op32ff7de6aff0
diff --git a/app/models/exports/pdf/components/page.rb b/app/models/exports/pdf/components/page.rb
index d2e8d2781e3..9e3e03577f0 100644
--- a/app/models/exports/pdf/components/page.rb
+++ b/app/models/exports/pdf/components/page.rb
@@ -94,21 +94,23 @@ module Exports::PDF::Components::Page
def draw_footer_on_page
top = styles.page_footer_offset
text_style = styles.page_footer
- spacing = styles.page_footer_horizontal_spacing
right_width = footer_page_nr.present? ? draw_text_right(footer_page_nr, text_style, top) : 0
left_width = footer_date.present? ? draw_text_left(footer_date, text_style, top) : 0
- if footer_title.present?
- footer_sides = [left_width, right_width].max + spacing
- available_width = pdf.bounds.width - (2 * footer_sides)
- draw_text_multiline_center(
- text: footer_title,
- text_style:,
- left: footer_sides,
- available_width:,
- top:,
- max_lines: MAX_NR_OF_PDF_FOOTER_LINES
- )
- end
+ draw_footer_title(left_width, right_width) if footer_title.present?
+ end
+
+ def draw_footer_title(left_width, right_width)
+ spacing = styles.page_footer_horizontal_spacing
+ footer_sides = [left_width, right_width].max + spacing
+ available_width = pdf.bounds.width - (2 * footer_sides)
+ draw_text_multiline_center(
+ text: footer_title,
+ text_style:,
+ left: footer_sides,
+ available_width:,
+ top:,
+ max_lines: MAX_NR_OF_PDF_FOOTER_LINES
+ )
end
def footer_page_nr
diff --git a/script/pdf_export/validate_styles b/script/pdf_export/validate_styles
index 814ec66c986..4196ecff756 100755
--- a/script/pdf_export/validate_styles
+++ b/script/pdf_export/validate_styles
@@ -12,14 +12,18 @@ class SchemaValidator
root = File.expand_path("../../", __dir__)
config = YAML.load_file(File.join(__dir__, "styles.yml"))
config["styles"].each do |entry|
- puts "Validating #{entry['name']} styles"
- schema = JSON::load_file(File.join(root, entry["path"], "schema.json"))
- styles_file = File.join(root, entry["path"], "standard.yml")
- styles = YAML.load_file(styles_file)
- validate_schema!(styles, schema)
- puts "Valid: #{styles_file}"
+ validate_styles(entry, root)
end
end
+
+ def validate_styles(entry, root)
+ puts "Validating #{entry['name']} styles"
+ schema = JSON::load_file(File.join(root, entry["path"], "schema.json"))
+ styles_file = File.join(root, entry["path"], "standard.yml")
+ styles = YAML.load_file(styles_file)
+ validate_schema!(styles, schema)
+ puts "Valid: #{styles_file}"
+ end
end
SchemaValidator.new.validate
diff --git a/spec/models/work_package/pdf_export/common/badge_spec.rb b/spec/models/exports/pdf/common/badge_spec.rb
similarity index 100%
rename from spec/models/work_package/pdf_export/common/badge_spec.rb
rename to spec/models/exports/pdf/common/badge_spec.rb
diff --git a/spec/models/work_package/pdf_export/common/macro_spec.rb b/spec/models/exports/pdf/common/macro_spec.rb
similarity index 100%
rename from spec/models/work_package/pdf_export/common/macro_spec.rb
rename to spec/models/exports/pdf/common/macro_spec.rb