Explorar o código

Allow multi line text for summary

theenglishway (time) %!s(int64=2) %!d(string=hai) anos
pai
achega
06e257541c
Modificáronse 1 ficheiros con 8 adicións e 1 borrados
  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