Skip to content

Commit

Permalink
Add different placeholder image for world news
Browse files Browse the repository at this point in the history
Adds a new placeholder image for world news stories.

https://govuk.zendesk.com/agent/tickets/3992513
  • Loading branch information
MuriloDalRi committed Apr 16, 2020
1 parent 70f5219 commit 2fb0c1f
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 2fb0c1f

Please sign in to comment.