Browse Source

Move date to a specific module

theenglishway (time) 2 năm trước cách đây
mục cha
commit
1a756c75e0
2 tập tin đã thay đổi với 13 bổ sung9 xóa
  1. 1 9
      lib/cv_gen_view.ex
  2. 12 0
      lib/views/date.ex

+ 1 - 9
lib/cv_gen_view.ex

@@ -1,18 +1,10 @@
 defmodule CvGenView do
   use Phoenix.Component
+  import CvGenView.Date, only: [date: 1]
   @after_compile __MODULE__
 
   embed_templates("templates/*")
 
-  attr(:date, :any)
-  attr(:rest, :global)
-
-  def date(assigns) do
-    ~H"""
-    <time datetime={@date} {@rest}><%= @date %></time>
-    """
-  end
-
   attr(:work, :map)
 
   def work(assigns) do

+ 12 - 0
lib/views/date.ex

@@ -0,0 +1,12 @@
+defmodule CvGenView.Date do
+  use Phoenix.Component
+
+  attr(:date, :any)
+  attr(:rest, :global)
+
+  def date(assigns) do
+    ~H"""
+    <time datetime={@date} {@rest}><%= @date %></time>
+    """
+  end
+end