Conditionally show purchased at in edit form

This commit is contained in:
Claudio Ortolina
2024-10-21 18:57:47 +01:00
parent 4213f24ab8
commit 34420a7203
5 changed files with 10 additions and 1 deletions
@@ -43,7 +43,12 @@ defmodule MusicLibraryWeb.RecordLive.FormComponent do
/>
</div>
<.input field={@form[:release]} type="text" label={gettext("Release")} />
<.input field={@form[:purchased_at]} type="datetime-local" label={gettext("Purchased at")} />
<.input
:if={@show_purchased_at}
field={@form[:purchased_at]}
type="datetime-local"
label={gettext("Purchased at")}
/>
<div phx-drop-target={@uploads.cover_data.ref}>
<.label for={@uploads.cover_data.ref}>
<%= gettext("Cover art") %>
@@ -167,6 +167,7 @@
id={@record.id}
title={@page_title}
action={@live_action}
show_purchased_at={true}
record={@record}
patch={~p"/records"}
/>
@@ -83,6 +83,7 @@
id={@record.id}
title={@page_title}
action={@live_action}
show_purchased_at={true}
record={@record}
patch={~p"/records/#{@record}"}
/>
@@ -167,6 +167,7 @@
id={@record.id}
title={@page_title}
action={@live_action}
show_purchased_at={false}
record={@record}
patch={~p"/wishlist"}
/>
@@ -82,6 +82,7 @@
id={@record.id}
title={@page_title}
action={@live_action}
show_purchased_at={false}
record={@record}
patch={~p"/wishlist/#{@record}"}
/>