Browse Source

Update success banner

pull/1793/head
Kat 3 years ago
parent
commit
b922ecd20c
  1. 5
      app/controllers/form_controller.rb
  2. 2
      config/locales/en.yml
  3. 2
      spec/features/lettings_log_spec.rb
  4. 2
      spec/features/sales_log_spec.rb

5
app/controllers/form_controller.rb

@ -257,6 +257,9 @@ private
end end
def deduplication_success_banner def deduplication_success_banner
"<a class=\"govuk-notification-banner__link govuk-!-font-weight-bold\" href=\"#{send("#{@log.class.name.underscore}_path", @log)}\">Log #{@log.id}</a> is no longer a duplicate and has been removed from the list".html_safe deduplicated_log_link = "<a class=\"govuk-notification-banner__link govuk-!-font-weight-bold\" href=\"#{send("#{@log.class.name.underscore}_path", @log)}\">Log #{@log.id}</a>"
changed_question_label = (@page.questions.first.check_answer_label.to_s.presence || @page.questions.first.header.to_s).downcase
I18n.t("notification.duplicate_logs.deduplication_success_banner", log_link: deduplicated_log_link, changed_question_label:).html_safe
end end
end end

2
config/locales/en.yml

@ -187,6 +187,8 @@ en:
duplicate_logs_deleted: duplicate_logs_deleted:
one: "%{log_ids} has been deleted." one: "%{log_ids} has been deleted."
other: "%{log_ids} have been deleted." other: "%{log_ids} have been deleted."
duplicate_logs:
deduplication_success_banner: "%{log_link} is no longer a duplicate and has been removed from the list.<p class=\"govuk-body govuk-!-margin-top-4\">You changed the %{changed_question_label}.</p>"
validations: validations:
organisation: organisation:

2
spec/features/lettings_log_spec.rb

@ -515,6 +515,7 @@ RSpec.describe "Lettings Log Features" do
expect(page).to have_link("Back to Log #{lettings_log.id}", href: "/lettings-logs/#{lettings_log.id}") expect(page).to have_link("Back to Log #{lettings_log.id}", href: "/lettings-logs/#{lettings_log.id}")
expect(page).to have_css(".govuk-notification-banner.govuk-notification-banner--success") expect(page).to have_css(".govuk-notification-banner.govuk-notification-banner--success")
expect(page).to have_content("Log #{duplicate_log.id} is no longer a duplicate and has been removed from the list") expect(page).to have_content("Log #{duplicate_log.id} is no longer a duplicate and has been removed from the list")
expect(page).to have_content("You changed the tenant code.")
end end
it "allows deduplicating logs by changing the answers on the original log" do it "allows deduplicating logs by changing the answers on the original log" do
@ -525,6 +526,7 @@ RSpec.describe "Lettings Log Features" do
expect(page).to have_link("Back to Log #{lettings_log.id}", href: "/lettings-logs/#{lettings_log.id}") expect(page).to have_link("Back to Log #{lettings_log.id}", href: "/lettings-logs/#{lettings_log.id}")
expect(page).to have_css(".govuk-notification-banner.govuk-notification-banner--success") expect(page).to have_css(".govuk-notification-banner.govuk-notification-banner--success")
expect(page).to have_content("Log #{lettings_log.id} is no longer a duplicate and has been removed from the list") expect(page).to have_content("Log #{lettings_log.id} is no longer a duplicate and has been removed from the list")
expect(page).to have_content("You changed the tenant code.")
end end
end end
end end

2
spec/features/sales_log_spec.rb

@ -254,6 +254,7 @@ RSpec.describe "Sales Log Features" do
expect(page).to have_link("Back to Log #{sales_log.id}", href: "/sales-logs/#{sales_log.id}") expect(page).to have_link("Back to Log #{sales_log.id}", href: "/sales-logs/#{sales_log.id}")
expect(page).to have_css(".govuk-notification-banner.govuk-notification-banner--success") expect(page).to have_css(".govuk-notification-banner.govuk-notification-banner--success")
expect(page).to have_content("Log #{duplicate_log.id} is no longer a duplicate and has been removed from the list") expect(page).to have_content("Log #{duplicate_log.id} is no longer a duplicate and has been removed from the list")
expect(page).to have_content("You changed the purchaser code.")
end end
it "allows deduplicating logs by changing the answers on the original log" do it "allows deduplicating logs by changing the answers on the original log" do
@ -264,6 +265,7 @@ RSpec.describe "Sales Log Features" do
expect(page).to have_link("Back to Log #{sales_log.id}", href: "/sales-logs/#{sales_log.id}") expect(page).to have_link("Back to Log #{sales_log.id}", href: "/sales-logs/#{sales_log.id}")
expect(page).to have_css(".govuk-notification-banner.govuk-notification-banner--success") expect(page).to have_css(".govuk-notification-banner.govuk-notification-banner--success")
expect(page).to have_content("Log #{sales_log.id} is no longer a duplicate and has been removed from the list") expect(page).to have_content("Log #{sales_log.id} is no longer a duplicate and has been removed from the list")
expect(page).to have_content("You changed the purchaser code.")
end end
end end
end end

Loading…
Cancel
Save