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

refactor: remove always nil `classes` parameter

Christophe Bliardbf38384bda22
diff --git a/app/helpers/error_message_helper.rb b/app/helpers/error_message_helper.rb
index a4e311ab0c9..42c7acc0644 100644
--- a/app/helpers/error_message_helper.rb
+++ b/app/helpers/error_message_helper.rb
@@ -48,12 +48,11 @@ module ErrorMessageHelper
render_error_messages_partial(error_messages, object:)
end
- def render_error_messages_partial(messages, options)
+ def render_error_messages_partial(messages, object:)
unless messages.empty?
render partial: 'common/validation_error',
locals: { error_messages: messages,
- classes: options[:classes],
- object_name: options[:object].class.model_name.human }
+ object_name: object.class.model_name.human }
end
end
end
diff --git a/app/views/common/_validation_error.html.erb b/app/views/common/_validation_error.html.erb
index 3ca24d9cf28..221937a7600 100644
--- a/app/views/common/_validation_error.html.erb
+++ b/app/views/common/_validation_error.html.erb
@@ -38,7 +38,6 @@ See COPYRIGHT and LICENSE files for more details.
<%= render partial: "common/error_base",
locals: {
- error_message: t("activerecord.errors.template.header", model: object_name, count: error_messages.count),
- classes:
+ error_message: t("activerecord.errors.template.header", model: object_name, count: error_messages.count)
}
%>
diff --git a/spec/views/common/validation_error.html.erb_spec.rb b/spec/views/common/validation_error.html.erb_spec.rb
index 7062a030b4a..95f5a7a689f 100644
--- a/spec/views/common/validation_error.html.erb_spec.rb
+++ b/spec/views/common/validation_error.html.erb_spec.rb
@@ -36,10 +36,8 @@ RSpec.describe 'common/_validation_error' do
render partial: 'common/validation_error',
locals: { error_messages:,
- classes: 'custom-class-name',
object_name: 'Test' }
end
it { expect(rendered).not_to include('Clear this!') }
- it { expect(rendered).to match(/class=.+custom-class-name/) }
end