|
|
|
@ -31,34 +31,43 @@ defmodule DecentralisedBookIndexWeb.BookLive.Show do
|
|
|
|
|
</:actions>
|
|
|
|
|
</.header>
|
|
|
|
|
|
|
|
|
|
<div class="flex flex-wrap flex-[2_1_auto] gap-5">
|
|
|
|
|
<div class="mb-4">
|
|
|
|
|
<%= if @book.cover_image_url != nil do %>
|
|
|
|
|
<img class="w-36 shadow-lg mt-14 mx-auto md:mx-0 object-cover" src={@book.cover_image_url} alt={"#{@book.title} image"}/>
|
|
|
|
|
<img class="w-36 shadow-lg mt-14 mx-auto object-cover" src={@book.cover_image_url} alt={"#{@book.title} image"}/>
|
|
|
|
|
<% else %>
|
|
|
|
|
<div class="relative w-36 h-36 overflow-hidden mt-14 mx-auto md:mx-0">
|
|
|
|
|
<div class="relative w-36 h-36 overflow-hidden mt-14 mx-auto">
|
|
|
|
|
<svg class="w-36 h-36 text-gray-800 dark:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 24 24">
|
|
|
|
|
<path fill-rule="evenodd" d="M6 2a2 2 0 0 0-2 2v15a3 3 0 0 0 3 3h12a1 1 0 1 0 0-2h-2v-2h2a1 1 0 0 0 1-1V4a2 2 0 0 0-2-2h-8v16h5v2H7a1 1 0 1 1 0-2h1V2H6Z" clip-rule="evenodd"/>
|
|
|
|
|
</svg>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<.list>
|
|
|
|
|
<:item title="Id">{@book.id}</:item>
|
|
|
|
|
|
|
|
|
|
<:item title="Title">{@book.title}</:item>
|
|
|
|
|
|
|
|
|
|
<:item title="Description">{@book.description}</:item>
|
|
|
|
|
|
|
|
|
|
<:item title="Published">{@book.published}</:item>
|
|
|
|
|
|
|
|
|
|
<:item title="Language">{@book.language}</:item>
|
|
|
|
|
|
|
|
|
|
<:item title="Format">{@book.format}</:item>
|
|
|
|
|
|
|
|
|
|
<:item title="Page count">{@book.page_count}</:item>
|
|
|
|
|
|
|
|
|
|
<:item title="Cover image url">{@book.cover_image_url}</:item>
|
|
|
|
|
</.list>
|
|
|
|
|
<div>
|
|
|
|
|
<dl>
|
|
|
|
|
<dt class="mb-2 font-semibold leading-none text-gray-900 dark:text-white">Description</dt>
|
|
|
|
|
<dd class="mb-4 font-light text-gray-500 sm:mb-5 dark:text-gray-400">{@book.description}</dd>
|
|
|
|
|
</dl>
|
|
|
|
|
<dl>
|
|
|
|
|
<dt class="mb-2 font-semibold leading-none text-gray-900 dark:text-white">Publisher</dt>
|
|
|
|
|
<dd class="mb-4 font-light text-gray-500 sm:mb-5 dark:text-gray-400">{@book.publisher.name}</dd>
|
|
|
|
|
</dl>
|
|
|
|
|
<dl>
|
|
|
|
|
<dt class="mb-2 font-semibold leading-none text-gray-900 dark:text-white">Published</dt>
|
|
|
|
|
<dd class="mb-4 font-light text-gray-500 sm:mb-5 dark:text-gray-400">{@book.published}</dd>
|
|
|
|
|
</dl>
|
|
|
|
|
<dl>
|
|
|
|
|
<dt class="mb-2 font-semibold leading-none text-gray-900 dark:text-white">Format</dt>
|
|
|
|
|
<dd class="mb-4 font-light text-gray-500 sm:mb-5 dark:text-gray-400">{@book.format}</dd>
|
|
|
|
|
</dl>
|
|
|
|
|
<dl>
|
|
|
|
|
<dt class="mb-2 font-semibold leading-none text-gray-900 dark:text-white">Page Count</dt>
|
|
|
|
|
<dd class="mb-4 font-light text-gray-500 sm:mb-5 dark:text-gray-400">{@book.page_count}</dd>
|
|
|
|
|
</dl>
|
|
|
|
|
<dl>
|
|
|
|
|
<dt class="mb-2 font-semibold leading-none text-gray-900 dark:text-white">Language</dt>
|
|
|
|
|
<dd class="mb-4 font-light text-gray-500 sm:mb-5 dark:text-gray-400">{@book.language}</dd>
|
|
|
|
|
</dl>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<%= if not Enum.empty?(@alternative_editions) do %>
|
|
|
|
@ -84,7 +93,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])
|
|
|
|
|
book = Ash.get!(Metadata.Book, id, actor: socket.assigns.current_user, load: [:author_roles, :publisher])
|
|
|
|
|
alternative_editions = Metadata.get_book_alternative_editions!(book)
|
|
|
|
|
|
|
|
|
|
{:noreply,
|
|
|
|
|