philomena/lib/philomena_web/views/admin/advert_view.ex

29 lines
651 B
Elixir
Raw Permalink Normal View History

2019-12-15 03:54:16 +01:00
defmodule PhilomenaWeb.Admin.AdvertView do
use PhilomenaWeb, :view
alias PhilomenaWeb.AdvertView
defp advert_image_url(advert),
do: AdvertView.advert_image_url(advert)
2019-12-15 03:54:16 +01:00
def time_column_class(other_time) do
now = DateTime.utc_now()
case DateTime.diff(other_time, now) > 0 do
2020-01-11 05:20:19 +01:00
true -> "success"
2019-12-15 03:54:16 +01:00
_false -> "danger"
end
end
def live_text(%{live: true}), do: "Yes"
def live_text(_advert), do: "No"
def restrictions do
[
[key: "Display on all images", value: "none"],
[key: "Display on NSFW images only", value: "nsfw"],
[key: "Display on SFW images only", value: "sfw"]
]
end
end