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

16 lines
327 B
Elixir
Raw Permalink Normal View History

2019-12-14 19:28:04 +01:00
defmodule PhilomenaWeb.Admin.SiteNoticeView do
use PhilomenaWeb, :view
def time_column_class(time) do
now = DateTime.utc_now()
case DateTime.diff(time, now) > 0 do
true -> "success"
false -> "danger"
end
end
def live_text(%{live: true}), do: "Yes"
def live_text(_site_notice), do: "No"
end