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)
~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 %>
{@publisher.name}
<% else %>

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

Loading…
Cancel
Save