analytics/lib/plausible_web/views/layout_view.ex

25 lines
518 B
Elixir
Raw Normal View History

2019-09-02 14:29:19 +03:00
defmodule PlausibleWeb.LayoutView do
use PlausibleWeb, :view
2019-09-11 19:04:37 +03:00
2020-03-31 16:23:46 +03:00
def home_dest(conn) do
if conn.assigns[:current_user] do
"/sites"
else
"/"
end
end
2019-09-11 19:04:37 +03:00
def trial_notificaton(user) do
case Plausible.Billing.trial_days_left(user) do
days when days > 1 ->
"#{days} trial days left"
days when days == 1 ->
"Trial ends tomorrow"
days when days == 0 ->
"Trial ends today"
days when days < 0 ->
"Trial over, upgrade now"
end
end
2019-09-02 14:29:19 +03:00
end