Skip to content

Commit

Permalink
Merge pull request #9766 from alphagov/make-jobs-section-optional
Browse files Browse the repository at this point in the history
Remove default value for jobs url
  • Loading branch information
GDSNewt authored Jan 2, 2025
2 parents 6c8a325 + f26774b commit 664e8f9
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 22 deletions.
3 changes: 1 addition & 2 deletions app/models/organisation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ class Organisation < ApplicationRecord

date_attributes(:closed_at)

DEFAULT_JOBS_URL = "https://www.civilservicejobs.service.gov.uk/csr".freeze
FEATURED_DOCUMENTS_DISPLAY_LIMIT = 6

has_one :default_news_image, class_name: "FeaturedImageData", as: :featured_imageable, inverse_of: :featured_imageable
Expand Down Expand Up @@ -416,7 +415,7 @@ def select_name
end

def jobs_url
custom_jobs_url.presence || DEFAULT_JOBS_URL
custom_jobs_url.presence
end

def indexable_content
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ def page_content_ids_by_menu_heading(menu_heading)
end

def payload_for_jobs
return if organisation.jobs_url.blank?

{
title: "Jobs",
url: organisation.jobs_url,
Expand Down
10 changes: 6 additions & 4 deletions app/presenters/publishing_api/organisation_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,12 @@ def corporate_information_pages
}
end

cips << {
title: I18n.t("organisation.corporate_information.jobs"),
href: item.jobs_url,
}
if item.jobs_url.present?
cips << {
title: I18n.t("organisation.corporate_information.jobs"),
href: item.jobs_url,
}
end

cips
end
Expand Down
7 changes: 1 addition & 6 deletions test/unit/app/models/organisation_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -929,12 +929,7 @@ class OrganisationTest < ActiveSupport::TestCase
assert_equal [org_with_announcement], Organisation.with_statistics_announcements
end

test "#jobs_url defaults to the default jobs url" do
organisation = build(:organisation)
assert_equal Organisation::DEFAULT_JOBS_URL, organisation.jobs_url
end

test "#jobs_url can be overridden" do
test "#jobs_url can be set" do
organisation = build(:organisation, custom_jobs_url: "http://jobs.com/")

assert organisation.valid?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,6 @@ class AboutCorporateInformationPage < TestCase
jobs = [
@procurement_corporate_information_page.content_id,
@recruitment_corporate_information_page.content_id,
{
title: "Jobs",
url: corporate_information_page.organisation.jobs_url,
},
]

our_information = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,7 @@ def govspeak_to_html(govspeak)
crest: "single-identity",
},
foi_exempt: false,
ordered_corporate_information_pages: [
{
title: "Jobs",
href: "https://www.civilservicejobs.service.gov.uk/csr",
},
],
ordered_corporate_information_pages: [],
secondary_corporate_information_pages: "",
ordered_featured_links: [],
ordered_featured_documents: [],
Expand Down

0 comments on commit 664e8f9

Please sign in to comment.