diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 9ad342b8a..af51a93e7 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,5 +1,21 @@ module ApplicationHelper def browser_title(title) - [title, t("service_name"), "GOV.UK"].select(&:present?).join(" - ") + if user_log_errors || case_log_errors || resource_errors + ["Error", title, t("service_name"), "GOV.UK"].select(&:present?).join(" - ") + else + [title, t("service_name"), "GOV.UK"].select(&:present?).join(" - ") + end + end + + def user_log_errors + @user.present? && @user.errors.present? + end + + def case_log_errors + @case_log.present? && @case_log.errors.present? + end + + def resource_errors + @resource.present? && @resource.errors.present? end end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 2a0a0bec3..3273c8ca3 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,15 +1,7 @@
- <% if @resource.present? && @resource.errors.present? %> -