Update the Book form to show the label for Publisher.

dev
KKlochko 2 months ago
parent 34bf021962
commit 7c4eb2357c

@ -17,7 +17,7 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.SelectedPublisher do
assigns = assign(assigns, :publisher, publisher) assigns = assign(assigns, :publisher, publisher)
~H""" ~H"""
<button type="button" phx-click="open-select-publisher" phx-target={@notify_component} class="text-white bg-blue-700 hover:bg-blue-800 focus:outline-none focus:ring-4 focus:ring-blue-300 font-medium rounded-full text-sm px-5 py-2.5 text-center me-2 mb-2 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"> <button type="button" phx-click="open-select-publisher" phx-target={@notify_component} class="text-white bg-blue-700 hover:bg-blue-800 focus:outline-none focus:ring-4 focus:ring-blue-300 font-medium rounded-full text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">
<%= if @publisher != nil do %> <%= if @publisher != nil do %>
{@publisher.name} {@publisher.name}
<% else %> <% else %>

@ -33,10 +33,13 @@ defmodule DecentralisedBookIndexWeb.BookLive.FormComponent do
label="Language" label="Language"
/> />
<.input field={@form[:page_count]} type="number" label="Page count" /> <.input field={@form[:page_count]} type="number" label="Page count" />
<.selected_publisher <div>
publisher_form={@form[:publisher_id]} <.label>Publisher</.label>
notify_component={@myself} <.selected_publisher
/> publisher_form={@form[:publisher_id]}
notify_component={@myself}
/>
</div>
<.input <.input
field={@form[:published]} field={@form[:published]}
type="date" type="date"
@ -60,10 +63,13 @@ defmodule DecentralisedBookIndexWeb.BookLive.FormComponent do
label="Language" label="Language"
/> />
<.input field={@form[:page_count]} type="number" label="Page count" /> <.input field={@form[:page_count]} type="number" label="Page count" />
<.selected_publisher <div>
publisher_form={@form[:publisher_id]} <.label>Publisher</.label>
notify_component={@myself} <.selected_publisher
/> publisher_form={@form[:publisher_id]}
notify_component={@myself}
/>
</div>
<.input <.input
field={@form[:published]} field={@form[:published]}
type="date" type="date"
@ -90,7 +96,6 @@ defmodule DecentralisedBookIndexWeb.BookLive.FormComponent do
<.live_component <.live_component
id="select-publisher" id="select-publisher"
module={SelectPublisher} module={SelectPublisher}
action={:edit}
current_user={@current_user} current_user={@current_user}
notify_component={@myself} notify_component={@myself}
/> />

Loading…
Cancel
Save