Compare commits

..

1 Commits

Author SHA1 Message Date
0729c63c3a add search to notes
Some checks are pending
continuous-integration/drone/push Build is pending
2022-11-19 00:19:55 -05:00
2 changed files with 5 additions and 1 deletions

View File

@ -3,6 +3,10 @@ defmodule MemexWeb.NoteLive.Index do
alias Memex.{Notes, Notes.Note} alias Memex.{Notes, Notes.Note}
@impl true @impl true
def mount(%{"search" => search}, _session, socket) do
{:ok, socket |> assign(search: search) |> display_notes()}
end
def mount(_params, _session, socket) do def mount(_params, _session, socket) do
{:ok, socket |> assign(search: nil) |> display_notes()} {:ok, socket |> assign(search: nil) |> display_notes()}
end end

View File

@ -11,7 +11,7 @@
phx-debounce="500" phx-debounce="500"
class="self-stretch flex flex-col items-stretch" class="self-stretch flex flex-col items-stretch"
> >
<%= text_input(f, :search_term, class: "input input-primary") %> <%= text_input(f, :search_term, class: "input input-primary", value: @search) %>
</.form> </.form>
<%= if @notes |> Enum.empty?() do %> <%= if @notes |> Enum.empty?() do %>