瀏覽代碼

Allow multi line text for summary

theenglishway (time) 2 年之前
父節點
當前提交
06e257541c
共有 1 個文件被更改,包括 8 次插入1 次删除
  1. 8 1
      lib/views/text.ex

+ 8 - 1
lib/views/text.ex

@@ -4,8 +4,15 @@ defmodule CvGenView.Text do
   attr(:text, :any, required: true)
   attr(:rest, :global)
 
-  def text(assigns),
+  def text(assigns) when is_binary(assigns.text),
     do: ~H"""
     <p {@rest}><%= @text %></p>
     """
+
+  def text(assigns) when is_list(assigns.text),
+    do: ~H"""
+    <%= for paragraph <- @text do %>
+      <p {@rest}><%= paragraph %></p>
+    <% end %>
+    """
 end