philomena/lib/philomena_web/views/advert_view.ex

14 lines
278 B
Elixir
Raw Normal View History

2019-11-29 07:26:05 +01:00
defmodule PhilomenaWeb.AdvertView do
use PhilomenaWeb, :view
def advert_image_url(%{image: image}) do
2019-11-29 07:29:14 +01:00
advert_url_root() <> "/" <> image
2019-11-29 07:26:05 +01:00
end
2020-08-08 02:23:36 +02:00
def advert_image_url(_), do: nil
2019-11-29 07:26:05 +01:00
defp advert_url_root do
Application.get_env(:philomena, :advert_url_root)
end
end