Skip to content

Commit

Permalink
Merge pull request #1739 from alphagov/add-placeholder-image
Browse files Browse the repository at this point in the history
Add different placeholder image for world news
  • Loading branch information
MuriloDalRi authored Apr 16, 2020
2 parents 04a560f + 2fb0c1f commit 34f1e4c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/presenters/content_item/news_image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ def default_news_image

def placeholder_image
# this image has been uploaded to asset-manager
{ "url" => "https://assets.publishing.service.gov.uk/media/5e59279b86650c53b2cefbfe/placeholder.jpg" }
if content_item.dig("document_type") == "world_news_story"
{ "url" => "https://assets.publishing.service.gov.uk/media/5e985599d3bf7f3fc943bbd8/UK_government_logo.jpg" }
else
{ "url" => "https://assets.publishing.service.gov.uk/media/5e59279b86650c53b2cefbfe/placeholder.jpg" }
end
end
end
end
8 changes: 8 additions & 0 deletions test/presenters/content_item/news_image_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,12 @@ def initialize

assert_equal placeholder_image, item.image
end

test "presents a placeholder image if world location news has no image or default news image" do
item = DummyContentItem.new
item.content_item["document_type"] = "world_news_story"
placeholder_image = { "url" => "https://assets.publishing.service.gov.uk/media/5e985599d3bf7f3fc943bbd8/UK_government_logo.jpg" }

assert_equal placeholder_image, item.image
end
end

0 comments on commit 34f1e4c

Please sign in to comment.