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 & erb_lint

as-op69a079e49b3c
diff --git a/app/components/work_packages/types/export_template_list_component.html.erb b/app/components/work_packages/types/export_template_list_component.html.erb
index 3d252d2c665..25ab0e64d30 100644
--- a/app/components/work_packages/types/export_template_list_component.html.erb
+++ b/app/components/work_packages/types/export_template_list_component.html.erb
@@ -39,29 +39,33 @@ See COPYRIGHT and LICENSE files for more details.
end
section_header_container.with_column(flex_layout: true, justify_content: :flex_end) do |actions_container|
actions_container.with_column do
- render(Primer::Beta::Button.new(
- tag: :a,
- href: enable_all_type_pdf_export_template_index_path(type_id: @type.id),
- scheme: :invisible,
- font_weight: :bold,
- color: :subtle,
- "aria-label": t("projects.settings.actions.label_enable_all"),
- data: { "turbo-method": :put, "turbo-stream": true }
- )) do |button|
+ render(
+ Primer::Beta::Button.new(
+ tag: :a,
+ href: enable_all_type_pdf_export_template_index_path(type_id: @type.id),
+ scheme: :invisible,
+ font_weight: :bold,
+ color: :subtle,
+ "aria-label": t("projects.settings.actions.label_enable_all"),
+ data: { "turbo-method": :put, "turbo-stream": true }
+ )
+ ) do |button|
button.with_leading_visual_icon(icon: "check-circle", color: :subtle)
I18n.t("types.edit.export_configuration.pdf_export_templates.actions.label_enable_all")
end
end
actions_container.with_column do
- render(Primer::Beta::Button.new(
- tag: :a,
- href: disable_all_type_pdf_export_template_index_path(type_id: @type.id),
- scheme: :invisible,
- font_weight: :bold,
- color: :subtle,
- "aria-label": t("projects.settings.actions.label_disable_all"),
- data: { "turbo-method": :put, "turbo-stream": true }
- )) do |button|
+ render(
+ Primer::Beta::Button.new(
+ tag: :a,
+ href: disable_all_type_pdf_export_template_index_path(type_id: @type.id),
+ scheme: :invisible,
+ font_weight: :bold,
+ color: :subtle,
+ "aria-label": t("projects.settings.actions.label_disable_all"),
+ data: { "turbo-method": :put, "turbo-stream": true }
+ )
+ ) do |button|
button.with_leading_visual_icon(icon: "x-circle", color: :subtle)
I18n.t("types.edit.export_configuration.pdf_export_templates.actions.label_disable_all")
end
@@ -69,15 +73,16 @@ See COPYRIGHT and LICENSE files for more details.
end
end
end
- pdf_export_templates.each do |template|
+ @type.pdf_export_templates.list.each do |template|
component.with_row(data: draggable_item_config(template)) do
- render(WorkPackages::Types::ExportTemplateRowComponent.new(
- type: @type,
- template:
- ))
+ render(
+ WorkPackages::Types::ExportTemplateRowComponent.new(
+ type: @type,
+ template:
+ )
+ )
end
end
end
end
%>
-
diff --git a/app/components/work_packages/types/export_template_list_component.rb b/app/components/work_packages/types/export_template_list_component.rb
index a53536d3cca..93a26c3ac22 100644
--- a/app/components/work_packages/types/export_template_list_component.rb
+++ b/app/components/work_packages/types/export_template_list_component.rb
@@ -63,10 +63,6 @@ module WorkPackages
"drop-url": drop_type_pdf_export_template_path(type_id: @type.id, id: template.id)
}
end
-
- def pdf_export_templates
- @type.pdf_export_templates.list
- end
end
end
end
diff --git a/app/models/type/pdf_export_templates.rb b/app/models/type/pdf_export_templates.rb
index 5b07acf3cc1..b0a5cd90ee8 100644
--- a/app/models/type/pdf_export_templates.rb
+++ b/app/models/type/pdf_export_templates.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
diff --git a/app/models/work_package/pdf_export/templates.rb b/app/models/work_package/pdf_export/templates.rb
index 87d17c00c86..d99c887e679 100644
--- a/app/models/work_package/pdf_export/templates.rb
+++ b/app/models/work_package/pdf_export/templates.rb
@@ -40,5 +40,5 @@ module WorkPackage::PDFExport::Templates
label: I18n.t("pdf_generator.template_contract.label"),
caption: I18n.t("pdf_generator.template_contract.caption")
}
- ]
+ ].freeze
end