Change routes from "/records/*" to "/collection/*"
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
<%= gettext("Stats") %>
|
||||
</.link>
|
||||
<.link
|
||||
navigate={~p"/records"}
|
||||
navigate={~p"/collection"}
|
||||
class={section_link_classes(assigns[:nav_section], :records)}
|
||||
>
|
||||
<%= gettext("Collection") %>
|
||||
|
||||
@@ -96,7 +96,7 @@ defmodule MusicLibraryWeb.CollectionLive.Index do
|
||||
|> Map.put(:query, query)
|
||||
|> Map.take([:query, :page, :page_size])
|
||||
|
||||
{:noreply, push_patch(socket, to: ~p"/records?#{qs}")}
|
||||
{:noreply, push_patch(socket, to: ~p"/collection?#{qs}")}
|
||||
end
|
||||
|
||||
def handle_event("import", %{"id" => musicbrainz_id, "format" => format}, socket) do
|
||||
@@ -110,7 +110,7 @@ defmodule MusicLibraryWeb.CollectionLive.Index do
|
||||
{:noreply,
|
||||
socket
|
||||
|> put_flash(:info, gettext("Record imported successfully"))
|
||||
|> push_navigate(to: ~p"/records/#{record.id}")}
|
||||
|> push_navigate(to: ~p"/collection/#{record.id}")}
|
||||
|
||||
{:error, %Ecto.Changeset{} = changeset} ->
|
||||
{:noreply, assign(socket, form: to_form(changeset))}
|
||||
@@ -119,7 +119,7 @@ defmodule MusicLibraryWeb.CollectionLive.Index do
|
||||
{:noreply,
|
||||
socket
|
||||
|> put_flash(:error, gettext("Error importing record") <> "," <> inspect(reason))
|
||||
|> push_patch(to: ~p"/records")}
|
||||
|> push_patch(to: ~p"/collection")}
|
||||
end
|
||||
end
|
||||
|
||||
@@ -149,7 +149,7 @@ defmodule MusicLibraryWeb.CollectionLive.Index do
|
||||
|> Map.take([:query, :page, :page_size])
|
||||
|> Enum.filter(fn {_, v} -> v not in ["", nil] end)
|
||||
|
||||
~p"/records?#{qs}"
|
||||
~p"/collection?#{qs}"
|
||||
end
|
||||
|
||||
defp musicbrainz_url(record) do
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
autocapitalize="none"
|
||||
/>
|
||||
</form>
|
||||
<.link patch={~p"/records/import"}>
|
||||
<.link patch={~p"/collection/import"}>
|
||||
<.button><%= gettext("Import") %></.button>
|
||||
</.link>
|
||||
</div>
|
||||
@@ -36,7 +36,7 @@
|
||||
>
|
||||
<li
|
||||
:for={{id, record} <- @streams.records}
|
||||
phx-click={JS.navigate(~p"/records/#{record}")}
|
||||
phx-click={JS.navigate(~p"/collection/#{record}")}
|
||||
class="flex justify-between gap-x-6 py-5 hover:bg-zinc-50 dark:hover:bg-zinc-800 px-2 -mx-2 md:px-4 md:-mx-4 cursor-pointer"
|
||||
id={id}
|
||||
>
|
||||
@@ -51,7 +51,7 @@
|
||||
<.link
|
||||
:for={artist <- record.artists}
|
||||
class="text-zinc-700 hover:text-zinc-500 dark:text-zinc-400 dark:hover:text-zinc-300"
|
||||
patch={~p"/records?query=mbid:#{artist.musicbrainz_id}"}
|
||||
patch={~p"/collection?query=mbid:#{artist.musicbrainz_id}"}
|
||||
>
|
||||
<%= artist.name %>
|
||||
</.link>
|
||||
@@ -151,7 +151,7 @@
|
||||
role="menuitem"
|
||||
tabindex="-1"
|
||||
id={"actions-#{record.id}-show"}
|
||||
navigate={~p"/records/#{record}"}
|
||||
navigate={~p"/collection/#{record}"}
|
||||
>
|
||||
<%= gettext("Show") %>
|
||||
</.link>
|
||||
@@ -171,7 +171,7 @@
|
||||
role="menuitem"
|
||||
tabindex="-1"
|
||||
id={"actions-#{record.id}-edit"}
|
||||
patch={~p"/records/#{record}/edit"}
|
||||
patch={~p"/collection/#{record}/edit"}
|
||||
>
|
||||
<%= gettext("Edit") %>
|
||||
</.link>
|
||||
|
||||
@@ -9,9 +9,9 @@ defmodule MusicLibraryWeb.CollectionLive.Show do
|
||||
if connected?(socket) do
|
||||
socket
|
||||
|> get_connect_params()
|
||||
|> Map.get("_live_referer", ~p"/records")
|
||||
|> Map.get("_live_referer", ~p"/collection")
|
||||
else
|
||||
~p"/records"
|
||||
~p"/collection"
|
||||
end
|
||||
|
||||
socket =
|
||||
@@ -40,7 +40,7 @@ defmodule MusicLibraryWeb.CollectionLive.Show do
|
||||
record = Records.get_record!(id)
|
||||
{:ok, _} = Records.delete_record(record)
|
||||
|
||||
{:noreply, push_navigate(socket, to: ~p"/records")}
|
||||
{:noreply, push_navigate(socket, to: ~p"/collection")}
|
||||
end
|
||||
|
||||
def handle_event("refresh_musicbrainz_data", %{"id" => id}, socket) do
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<.link
|
||||
:for={artist <- @record.artists}
|
||||
class="text-zinc-700 hover:text-zinc-500 dark:text-zinc-400 dark:hover:text-zinc-300"
|
||||
patch={~p"/records?query=mbid:#{artist.musicbrainz_id}"}
|
||||
patch={~p"/collection?query=mbid:#{artist.musicbrainz_id}"}
|
||||
>
|
||||
<%= artist.name %>
|
||||
</.link>
|
||||
@@ -27,7 +27,7 @@
|
||||
</p>
|
||||
|
||||
<nav class="mt-5 isolate inline-flex rounded-md shadow-sm">
|
||||
<.link patch={~p"/records/#{@record}/show/edit"} phx-click={JS.push_focus()}>
|
||||
<.link patch={~p"/collection/#{@record}/show/edit"} phx-click={JS.push_focus()}>
|
||||
<.button type="button" class="relative inline-flex items-center rounded-r-none">
|
||||
<%= gettext("Edit") %>
|
||||
</.button>
|
||||
@@ -159,7 +159,7 @@
|
||||
:if={@live_action == :edit}
|
||||
id="record-modal"
|
||||
show
|
||||
on_cancel={JS.patch(~p"/records/#{@record}")}
|
||||
on_cancel={JS.patch(~p"/collection/#{@record}")}
|
||||
>
|
||||
<.live_component
|
||||
module={MusicLibraryWeb.RecordLive.FormComponent}
|
||||
@@ -168,6 +168,6 @@
|
||||
action={@live_action}
|
||||
show_purchased_at={true}
|
||||
record={@record}
|
||||
patch={~p"/records/#{@record}"}
|
||||
patch={~p"/collection/#{@record}"}
|
||||
/>
|
||||
</.modal>
|
||||
|
||||
@@ -12,7 +12,7 @@ defmodule MusicLibraryWeb.StatsLive.DataComponents do
|
||||
"relative overflow-hidden rounded-md bg-white dark:bg-zinc-800 px-4 pb-3 pt-5 shadow sm:px-6 sm:pt-6 cursor-pointer",
|
||||
@class
|
||||
]}
|
||||
phx-click={JS.navigate(~p"/records/#{@record}")}
|
||||
phx-click={JS.navigate(~p"/collection/#{@record}")}
|
||||
>
|
||||
<dt>
|
||||
<img
|
||||
@@ -29,7 +29,7 @@ defmodule MusicLibraryWeb.StatsLive.DataComponents do
|
||||
<.link
|
||||
:for={artist <- @record.artists}
|
||||
class="text-sm md:text-base lg:text-2xl text-zinc-900 hover:text-zinc-500 dark:text-zinc-300 dark:hover:text-zinc-200"
|
||||
patch={~p"/records?query=mbid:#{artist.musicbrainz_id}"}
|
||||
patch={~p"/collection?query=mbid:#{artist.musicbrainz_id}"}
|
||||
>
|
||||
<%= artist.name %>
|
||||
</.link>
|
||||
|
||||
@@ -8,7 +8,11 @@
|
||||
title={gettext("Latest purchase")}
|
||||
class="col-span-2 sm:col-span-3"
|
||||
/>
|
||||
<.counter title={gettext("Total collection")} count={@collection_count} path={~p"/records"} />
|
||||
<.counter
|
||||
title={gettext("Total collection")}
|
||||
count={@collection_count}
|
||||
path={~p"/collection"}
|
||||
/>
|
||||
<.counter title={gettext("Total wishlist")} count={@wishlist_count} path={~p"/wishlist"} />
|
||||
</dl>
|
||||
</div>
|
||||
@@ -28,7 +32,7 @@
|
||||
<dd class="mt-1 text-center">
|
||||
<a
|
||||
class="text-xl lg:text-2xl font-semibold hover:text-zinc-500 dark:text-zinc-300 dark:hover:text-zinc-200"
|
||||
href={~p"/records?query=format:#{format}"}
|
||||
href={~p"/collection?query=format:#{format}"}
|
||||
>
|
||||
<%= count %>
|
||||
</a>
|
||||
@@ -52,7 +56,7 @@
|
||||
<dd class="mt-1 text-center">
|
||||
<a
|
||||
class="text-xl lg:text-2xl font-semibold hover:text-zinc-500 dark:text-zinc-300 dark:hover:text-zinc-200"
|
||||
href={~p"/records?query=type:#{type}"}
|
||||
href={~p"/collection?query=type:#{type}"}
|
||||
>
|
||||
<%= count %>
|
||||
</a>
|
||||
|
||||
@@ -32,12 +32,12 @@ defmodule MusicLibraryWeb.Router do
|
||||
|
||||
live "/", StatsLive.Index, :index
|
||||
|
||||
live "/records", CollectionLive.Index, :index
|
||||
live "/records/import", CollectionLive.Index, :import
|
||||
live "/records/:id/edit", CollectionLive.Index, :edit
|
||||
live "/collection", CollectionLive.Index, :index
|
||||
live "/collection/import", CollectionLive.Index, :import
|
||||
live "/collection/:id/edit", CollectionLive.Index, :edit
|
||||
|
||||
live "/records/:id", CollectionLive.Show, :show
|
||||
live "/records/:id/show/edit", CollectionLive.Show, :edit
|
||||
live "/collection/:id", CollectionLive.Show, :show
|
||||
live "/collection/:id/show/edit", CollectionLive.Show, :edit
|
||||
|
||||
live "/wishlist", WishlistLive.Index, :index
|
||||
live "/wishlist/import", WishlistLive.Index, :import
|
||||
|
||||
Reference in New Issue
Block a user