Browse Source

feat: add correct pluralisation to warning message

pull/1570/head
natdeanlewissoftwire 3 years ago
parent
commit
de8bbae9d0
  1. 5
      app/controllers/bulk_upload_lettings_resume_controller.rb
  2. 2
      app/views/bulk_upload_lettings_resume/confirm.html.erb

5
app/controllers/bulk_upload_lettings_resume_controller.rb

@ -23,6 +23,11 @@ class BulkUploadLettingsResumeController < ApplicationController
end end
end end
def pluralize_logs_and_errors_warning(log_count, error_count)
is_or_are = log_count == 1 ? 'is' : 'are'
need_or_needs = error_count == 1 ? 'needs' : 'needs'
"There #{is_or_are} #{view_context.pluralize(log_count, 'log')} in this bulk upload with #{view_context.pluralize(error_count, 'error')} that still #{need_or_needs} to be fixed after upload."
end
private private
def form def form

2
app/views/bulk_upload_lettings_resume/confirm.html.erb

@ -7,7 +7,7 @@
<span class="govuk-caption-l">Bulk upload for lettings (<%= @bulk_upload.year_combo %>)</span> <span class="govuk-caption-l">Bulk upload for lettings (<%= @bulk_upload.year_combo %>)</span>
<h1 class="govuk-heading-l">Are you sure you want to upload all logs from this bulk upload?</h1> <h1 class="govuk-heading-l">Are you sure you want to upload all logs from this bulk upload?</h1>
<p class="govuk-body">There are <%= pluralize(@bulk_upload.logs.count, "log") %> in this bulk upload with <%= pluralize(@bulk_upload.bulk_upload_errors.count, "error") %> that still need to be fixed after upload.</p> <p class="govuk-body"><%= controller.pluralize_logs_and_errors_warning(@bulk_upload.logs.count, @bulk_upload.bulk_upload_errors.count)%> </p>
<%= govuk_warning_text(icon_fallback_text: "Danger") do %> <%= govuk_warning_text(icon_fallback_text: "Danger") do %>
You can not delete logs once you create them You can not delete logs once you create them

Loading…
Cancel
Save