Revise naming and notification around purchasing records
This commit is contained in:
@@ -167,9 +167,9 @@ defmodule MusicLibraryWeb.RecordComponents do
|
|||||||
role="menuitem"
|
role="menuitem"
|
||||||
tabindex="-1"
|
tabindex="-1"
|
||||||
id={"actions-#{record.id}-purchase"}
|
id={"actions-#{record.id}-purchase"}
|
||||||
phx-click={JS.push("purchase", value: %{id: record.id})}
|
phx-click={JS.push("add-to-collection", value: %{id: record.id})}
|
||||||
>
|
>
|
||||||
{gettext("Purchase")}
|
{gettext("Purchased")}
|
||||||
</.link>
|
</.link>
|
||||||
|
|
||||||
<.link
|
<.link
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ defmodule MusicLibraryWeb.WishlistLive.Index do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def handle_event("purchase", %{"id" => id}, socket) do
|
def handle_event("add-to-collection", %{"id" => id}, socket) do
|
||||||
record = Records.get_record!(id)
|
record = Records.get_record!(id)
|
||||||
current_time = DateTime.utc_now()
|
current_time = DateTime.utc_now()
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ defmodule MusicLibraryWeb.WishlistLive.Index do
|
|||||||
{:ok, _} ->
|
{:ok, _} ->
|
||||||
{:noreply,
|
{:noreply,
|
||||||
socket
|
socket
|
||||||
|> put_flash(:info, gettext("Record updated successfully"))
|
|> put_flash(:info, gettext("Record added to the collection"))
|
||||||
|> push_patch(to: ~p"/wishlist")}
|
|> push_patch(to: ~p"/wishlist")}
|
||||||
|
|
||||||
{:error, %Ecto.Changeset{} = changeset} ->
|
{:error, %Ecto.Changeset{} = changeset} ->
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ defmodule MusicLibraryWeb.WishlistLive.Show do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def handle_event("purchase", %{"id" => id}, socket) do
|
def handle_event("add-to-collection", %{"id" => id}, socket) do
|
||||||
record = Records.get_record!(id)
|
record = Records.get_record!(id)
|
||||||
current_time = DateTime.utc_now()
|
current_time = DateTime.utc_now()
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ defmodule MusicLibraryWeb.WishlistLive.Show do
|
|||||||
{:ok, _} ->
|
{:ok, _} ->
|
||||||
{:noreply,
|
{:noreply,
|
||||||
socket
|
socket
|
||||||
|> put_flash(:info, gettext("Record updated successfully"))
|
|> put_flash(:info, gettext("Record added to the collection"))
|
||||||
|> push_navigate(to: ~p"/wishlist")}
|
|> push_navigate(to: ~p"/wishlist")}
|
||||||
|
|
||||||
{:error, %Ecto.Changeset{} = changeset} ->
|
{:error, %Ecto.Changeset{} = changeset} ->
|
||||||
|
|||||||
@@ -126,7 +126,7 @@
|
|||||||
role="menuitem"
|
role="menuitem"
|
||||||
tabindex="-1"
|
tabindex="-1"
|
||||||
id={"actions-#{@record.id}-purchase"}
|
id={"actions-#{@record.id}-purchase"}
|
||||||
phx-click={JS.push("purchase", value: %{id: @record.id})}
|
phx-click={JS.push("add-to-collection", value: %{id: @record.id})}
|
||||||
>
|
>
|
||||||
<.icon
|
<.icon
|
||||||
name="hero-banknotes"
|
name="hero-banknotes"
|
||||||
@@ -134,7 +134,7 @@
|
|||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
data-slot="icon"
|
data-slot="icon"
|
||||||
/>
|
/>
|
||||||
{gettext("Purchase")}
|
{gettext("Purchased")}
|
||||||
</.link>
|
</.link>
|
||||||
|
|
||||||
<.link
|
<.link
|
||||||
|
|||||||
@@ -169,9 +169,7 @@ msgstr ""
|
|||||||
msgid "Previous"
|
msgid "Previous"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/components/record_components.ex:172
|
|
||||||
#: lib/music_library_web/live/collection_live/index.html.heex:42
|
#: lib/music_library_web/live/collection_live/index.html.heex:42
|
||||||
#: lib/music_library_web/live/wishlist_live/show.html.heex:137
|
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Purchase"
|
msgid "Purchase"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -196,8 +194,6 @@ msgid "Record imported successfully"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/live/record_live/form_component.ex:128
|
#: lib/music_library_web/live/record_live/form_component.ex:128
|
||||||
#: lib/music_library_web/live/wishlist_live/index.ex:140
|
|
||||||
#: lib/music_library_web/live/wishlist_live/show.ex:113
|
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Record updated successfully"
|
msgid "Record updated successfully"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -605,3 +601,15 @@ msgstr ""
|
|||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Vinyl"
|
msgid "Vinyl"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/music_library_web/components/record_components.ex:172
|
||||||
|
#: lib/music_library_web/live/wishlist_live/show.html.heex:137
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Purchased"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/music_library_web/live/wishlist_live/index.ex:140
|
||||||
|
#: lib/music_library_web/live/wishlist_live/show.ex:113
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Record added to the collection"
|
||||||
|
msgstr ""
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ defmodule MusicLibraryWeb.WishlistLive.IndexTest do
|
|||||||
|
|
||||||
conn
|
conn
|
||||||
|> visit(~p"/wishlist")
|
|> visit(~p"/wishlist")
|
||||||
|> click_link("#records-#{record.id} a", "Purchase")
|
|> click_link("#records-#{record.id} a", "Purchased")
|
||||||
|> assert_has("p", text: "Record updated successfully")
|
|> assert_has("p", text: "Record added to the collection")
|
||||||
|
|
||||||
purchased_record = MusicLibrary.Records.get_record!(record.id)
|
purchased_record = MusicLibrary.Records.get_record!(record.id)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user