From fa55c13c2920b6d94a098a46b2110c2a92b1e0e4 Mon Sep 17 00:00:00 2001 From: shibao Date: Sat, 12 Feb 2022 02:28:04 -0500 Subject: [PATCH] add datetime view helper --- lib/cannery_web.ex | 1 + lib/cannery_web/views/view_helpers.ex | 34 +++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 lib/cannery_web/views/view_helpers.ex diff --git a/lib/cannery_web.ex b/lib/cannery_web.ex index 5239169..e0b4704 100644 --- a/lib/cannery_web.ex +++ b/lib/cannery_web.ex @@ -98,6 +98,7 @@ defmodule CanneryWeb do import CanneryWeb.ErrorHelpers import CanneryWeb.Gettext + import CanneryWeb.ViewHelpers alias CanneryWeb.Router.Helpers, as: Routes end end diff --git a/lib/cannery_web/views/view_helpers.ex b/lib/cannery_web/views/view_helpers.ex new file mode 100644 index 0000000..3f68539 --- /dev/null +++ b/lib/cannery_web/views/view_helpers.ex @@ -0,0 +1,34 @@ +defmodule CanneryWeb.ViewHelpers do + @moduledoc """ + Contains common helpers that can be used in liveviews and regular views. These + are automatically imported into any Phoenix View using `use CanneryWeb, + :view` + """ + + import Phoenix.LiveView.Helpers + + @doc """ + Returns a