baarkerlounger
3 years ago
6 changed files with 8 additions and 20 deletions
@ -1,21 +1,9 @@ |
|||||||
module ApplicationHelper |
module ApplicationHelper |
||||||
def browser_title(title) |
def browser_title(title, *resources) |
||||||
if user_log_errors || case_log_errors || resource_errors |
if resources.any? { |r| r.present? && r.errors.present? } |
||||||
"Error: #{[title, t('service_name'), 'GOV.UK'].select(&:present?).join(' - ')}" |
"Error: #{[title, t('service_name'), 'GOV.UK'].select(&:present?).join(' - ')}" |
||||||
else |
else |
||||||
[title, t("service_name"), "GOV.UK"].select(&:present?).join(" - ") |
[title, t("service_name"), "GOV.UK"].select(&:present?).join(" - ") |
||||||
end |
end |
||||||
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 |
end |
||||||
|
Loading…
Reference in new issue