You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
543 B
20 lines
543 B
module ApplicationHelper |
|
include Pagy::Frontend |
|
|
|
def browser_title(title, pagy, *resources) |
|
if resources.any? { |r| r.present? && r.errors.present? } |
|
"Error: #{[title, t('service_name'), 'GOV.UK'].select(&:present?).join(' - ')}" |
|
else |
|
[paginated_title(title, pagy), t("service_name"), "GOV.UK"].select(&:present?).join(" - ") |
|
end |
|
end |
|
|
|
private |
|
|
|
def paginated_title(title, pagy) |
|
return unless title |
|
return title unless pagy && pagy.pages > 1 |
|
|
|
title + " (page #{pagy.page} of #{pagy.pages})" |
|
end |
|
end
|
|
|