Update the Book Show to show the alternative editions.
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -54,6 +54,17 @@ defmodule DecentralisedBookIndexWeb.BookLive.Show do
|
||||
</.list>
|
||||
</div>
|
||||
|
||||
<%= if not Enum.empty?(@alternative_editions) do %>
|
||||
<h1 class="text-lg font-semibold leading-8 text-zinc-800 dark:text-white">Editions</h1>
|
||||
<div class="flex flex-wrap flex-[3_1_auto]">
|
||||
<%= for book <- @alternative_editions do %>
|
||||
<.book_card
|
||||
book={book}
|
||||
current_user={@current_user}
|
||||
/>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<.back navigate={~p"/books"}>Back to books</.back>
|
||||
"""
|
||||
@@ -67,6 +78,7 @@ defmodule DecentralisedBookIndexWeb.BookLive.Show do
|
||||
@impl true
|
||||
def handle_params(%{"id" => id}, _, socket) do
|
||||
book = Ash.get!(Metadata.Book, id, actor: socket.assigns.current_user, load: [:author_roles])
|
||||
alternative_editions = Metadata.get_book_alternative_editions!(book)
|
||||
|
||||
{:noreply,
|
||||
socket
|
||||
|
||||
Reference in New Issue
Block a user