Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add banner for org changes #2687

Merged
merged 2 commits into from
Feb 7, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add banner presenter method
We need to display a banner on three org about pages as a result of the
reshuffle, this presenter method will be used by the view to determine
whether to display the banner or not.
  • Loading branch information
1pretz1 committed Feb 7, 2023
commit 2534d7674f127d4895f764d5bc6a5cd29b86965a
10 changes: 10 additions & 0 deletions app/presenters/corporate_information_page_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ class CorporateInformationPagePresenter < ContentItemPresenter
include ContentItem::OrganisationBranding
include ContentItem::CorporateInformationGroups

ORG_CHANGING_BANNER_BASE_PATHS = %w[
/government/organisations/department-for-business-energy-and-industrial-strategy/about
/government/organisations/department-for-international-trade/about
/government/organisations/department-for-business-energy-and-industrial-strategy/about
].freeze

def page_title
page_title = super
page_title += " - #{default_organisation['title']}" if default_organisation
Expand All @@ -22,6 +28,10 @@ def contents_items
super + extra_headings
end

def show_organisation_changing_banner?
ORG_CHANGING_BANNER_BASE_PATHS.include?(base_path)
end

private

def extra_headings
Expand Down
10 changes: 10 additions & 0 deletions test/presenters/corporate_information_page_presenter_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,15 @@ def schema_name
assert presented_item.further_information.include?(information_charter["base_path"])
assert presented_item.further_information.include?(information_charter["title"])
end

test "returns true for about pages that require a banner" do
presented_item = presented_item(schema_name, "base_path" => "/government/organisations/department-for-business-energy-and-industrial-strategy/about")
assert presented_item.show_organisation_changing_banner?
end

test "returns false for about pages that don't require a banner" do
presented_item = presented_item(schema_name, "base_path" => "/government/organisations/a-random-org/about")
assert_not presented_item.show_organisation_changing_banner?
end
end
end