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.
21 lines
650 B
21 lines
650 B
2 years ago
|
module TitleHelper
|
||
|
def format_label(count, item)
|
||
|
count > 1 ? item.pluralize : item
|
||
|
end
|
||
|
|
||
|
def format_title(searched, page_title, current_user, item_label, count, organisation_name)
|
||
|
if searched.present?
|
||
|
actual_title = support_sab_nav?(current_user, organisation_name) ? organisation_name : page_title
|
||
|
"#{actual_title} (#{count} #{item_label} matching ‘#{searched}’)"
|
||
|
else
|
||
|
support_sab_nav?(current_user, organisation_name) ? "#{organisation_name} (#{page_title})" : page_title
|
||
|
end
|
||
|
end
|
||
|
|
||
|
private
|
||
|
|
||
|
def support_sab_nav?(current_user, organisation_name)
|
||
|
current_user.support? && organisation_name
|
||
|
end
|
||
|
end
|