diff --git a/lib/music_library_web/components/record_components.ex b/lib/music_library_web/components/record_components.ex index 202f930c..1e7e9fd5 100644 --- a/lib/music_library_web/components/record_components.ex +++ b/lib/music_library_web/components/record_components.ex @@ -188,6 +188,25 @@ defmodule MusicLibraryWeb.RecordComponents do """ end + attr :query, :string, required: true + + def search_form(assigns) do + ~H""" +
+ <.input + type="search" + id={:query} + name={:query} + value={@query} + placeholder={gettext("Search")} + phx-debounce="500" + autocorrect="off" + autocapitalize="none" + /> +
+ """ + end + defp toggle_actions_menu(record_id) do JS.toggle(to: "#actions-#{record_id}") |> JS.toggle_class("pointer-events-none", to: "#records > li") diff --git a/lib/music_library_web/live/collection_live/index.html.heex b/lib/music_library_web/live/collection_live/index.html.heex index dcadc460..14d592be 100644 --- a/lib/music_library_web/live/collection_live/index.html.heex +++ b/lib/music_library_web/live/collection_live/index.html.heex @@ -1,18 +1,7 @@
-
- <.input - type="search" - id={:query} - name={:query} - value={@record_list_params.query} - placeholder={gettext("Search")} - phx-debounce="500" - autocorrect="off" - autocapitalize="none" - /> -
+ <.search_form query={@record_list_params.query} /> <.link patch={~p"/collection/import"}> <.button>{gettext("Import")} diff --git a/lib/music_library_web/live/wishlist_live/index.html.heex b/lib/music_library_web/live/wishlist_live/index.html.heex index 26a1d847..cb181437 100644 --- a/lib/music_library_web/live/wishlist_live/index.html.heex +++ b/lib/music_library_web/live/wishlist_live/index.html.heex @@ -1,18 +1,7 @@
-
- <.input - type="search" - id={:query} - name={:query} - value={@record_list_params.query} - placeholder={gettext("Search")} - phx-debounce="500" - autocorrect="off" - autocapitalize="none" - /> -
+ <.search_form query={@record_list_params.query} /> <.link patch={~p"/wishlist/import"}> <.button>{gettext("Import")} diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot index 8ddf176f..073b085c 100644 --- a/priv/gettext/default.pot +++ b/priv/gettext/default.pot @@ -113,8 +113,8 @@ msgstr "" msgid "Hang in there while we get back on track" msgstr "" -#: lib/music_library_web/live/collection_live/index.html.heex:17 -#: lib/music_library_web/live/wishlist_live/index.html.heex:17 +#: lib/music_library_web/live/collection_live/index.html.heex:6 +#: lib/music_library_web/live/wishlist_live/index.html.heex:6 #, elixir-autogen, elixir-format msgid "Import" msgstr "" @@ -231,8 +231,7 @@ msgstr "" msgid "Saving..." msgstr "" -#: lib/music_library_web/live/collection_live/index.html.heex:10 -#: lib/music_library_web/live/wishlist_live/index.html.heex:10 +#: lib/music_library_web/components/record_components.ex:201 #, elixir-autogen, elixir-format msgid "Search" msgstr "" @@ -254,8 +253,8 @@ msgstr "" msgid "Show" msgstr "" -#: lib/music_library_web/live/collection_live/index.html.heex:23 -#: lib/music_library_web/live/wishlist_live/index.html.heex:23 +#: lib/music_library_web/live/collection_live/index.html.heex:12 +#: lib/music_library_web/live/wishlist_live/index.html.heex:12 #, elixir-autogen, elixir-format msgid "Showing %{visible} of %{total} records" msgstr ""