preview first line only (#65)
This commit is contained in:
parent
8c09142f8e
commit
e0ad13ee6c
2 changed files with 7 additions and 1 deletions
|
@ -26,5 +26,9 @@ defmodule Planner.Tasks.Task do
|
||||||
change(task, finished_at: now())
|
change(task, finished_at: now())
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def preview(task) do
|
||||||
|
hd(String.split(task.value, "\n"))
|
||||||
|
end
|
||||||
|
|
||||||
defp now(), do: NaiveDateTime.utc_now() |> NaiveDateTime.truncate(:second)
|
defp now(), do: NaiveDateTime.utc_now() |> NaiveDateTime.truncate(:second)
|
||||||
end
|
end
|
||||||
|
|
|
@ -67,6 +67,8 @@ end
|
||||||
defmodule TaskComponent do
|
defmodule TaskComponent do
|
||||||
use Phoenix.LiveComponent
|
use Phoenix.LiveComponent
|
||||||
|
|
||||||
|
alias Planner.Tasks.Task
|
||||||
|
|
||||||
import PlannerWeb.Util
|
import PlannerWeb.Util
|
||||||
|
|
||||||
def render(assigns) do
|
def render(assigns) do
|
||||||
|
@ -111,7 +113,7 @@ defmodule TaskComponent do
|
||||||
style: "display: block;"
|
style: "display: block;"
|
||||||
) do %>
|
) do %>
|
||||||
<div class="value">
|
<div class="value">
|
||||||
<%= md_to_html(@task.value) %>
|
<%= md_to_html(Task.preview(@task)) %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= if(not is_nil(@task.due_at)) do %>
|
<%= if(not is_nil(@task.due_at)) do %>
|
||||||
|
|
Loading…
Add table
Reference in a new issue