diff --git a/lib/cannery_web/components/tag_card.ex b/lib/cannery_web/components/tag_card.ex index d3d4a2c0..d4b54714 100644 --- a/lib/cannery_web/components/tag_card.ex +++ b/lib/cannery_web/components/tag_card.ex @@ -4,7 +4,6 @@ defmodule CanneryWeb.Components.TagCard do """ use CanneryWeb, :component - alias CanneryWeb.Endpoint def tag_card(assigns) do ~H""" @@ -20,20 +19,7 @@ defmodule CanneryWeb.Components.TagCard do <%= @tag.name %> - <%= live_patch to: Routes.tag_index_path(Endpoint, :edit, @tag), - class: "text-primary-500 link" do %> - - <% end %> - - <%= link to: "#", - class: "text-primary-500 link", - phx_click: "delete", - phx_value_id: @tag.id, - data: [ - confirm: dgettext("prompts", "Are you sure you want to delete %{name}?", name: @tag.name) - ] do %> - - <% end %> + <%= render_slot(@inner_block) %> """ end diff --git a/lib/cannery_web/live/tag_live/index.ex b/lib/cannery_web/live/tag_live/index.ex index 5f0ce2ef..e8ceb8a5 100644 --- a/lib/cannery_web/live/tag_live/index.ex +++ b/lib/cannery_web/live/tag_live/index.ex @@ -5,8 +5,8 @@ defmodule CanneryWeb.TagLive.Index do use CanneryWeb, :live_view import CanneryWeb.Components.TagCard - alias Cannery.Tags - alias Cannery.Tags.Tag + alias Cannery.{Tags, Tags.Tag} + alias CanneryWeb.Endpoint @impl true def mount(_params, session, socket) do diff --git a/lib/cannery_web/live/tag_live/index.html.heex b/lib/cannery_web/live/tag_live/index.html.heex index 50589ebd..6a070cae 100644 --- a/lib/cannery_web/live/tag_live/index.html.heex +++ b/lib/cannery_web/live/tag_live/index.html.heex @@ -22,7 +22,22 @@ <% end %>
<%= for tag <- @tags do %> - <.tag_card tag={tag} /> + <.tag_card tag={tag}> + <%= live_patch to: Routes.tag_index_path(Endpoint, :edit, tag), + class: "text-primary-500 link" do %> + + <% end %> + + <%= link to: "#", + class: "text-primary-500 link", + phx_click: "delete", + phx_value_id: tag.id, + data: [ + confirm: dgettext("prompts", "Are you sure you want to delete %{name}?", name: tag.name) + ] do %> + + <% end %> + <% end %>