Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 7 additions & 0 deletions lib/dotcom_web/views/page_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,13 @@ defmodule DotcomWeb.PageView do
content_tag(:span, "|", aria_hidden: "true", class: "schedule-separator")
end

@decorate cacheable(
cache: @cache,
on_error: :raise,
opts: [ttl: @ttl],
# Even though the text isn't translated, the dates are so locale is part of the key
key: {"homepage|news-entries", conn.assigns.locale}
)
@spec render_news_entries(Plug.Conn.t()) :: Phoenix.HTML.Safe.t()
def render_news_entries(conn) do
content_tag(
Expand Down
1 change: 1 addition & 0 deletions test/dotcom_web/views/page_view_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ defmodule DotcomWeb.PageViewTest do
document =
conn
|> assign(:news, entries)
|> assign(:locale, "en-US")
|> PageView.render_news_entries()
|> Phoenix.HTML.Safe.to_iodata()
|> IO.iodata_to_binary()
Expand Down
Loading