Update the routes and Author's Index page.
This commit is contained in:
@@ -6,8 +6,10 @@ defmodule DecentralisedBookIndexWeb.AuthorLive.Index do
|
||||
@impl true
|
||||
def render(assigns) do
|
||||
~H"""
|
||||
<.header class="pb-2">
|
||||
Listing Authors
|
||||
<.header class="pb-2 ">
|
||||
<h1 class="text-lg font-semibold leading-8 text-zinc-800 dark:text-white">
|
||||
Listing Authors
|
||||
</h1>
|
||||
</.header>
|
||||
|
||||
<.author_search
|
||||
@@ -47,12 +49,28 @@ defmodule DecentralisedBookIndexWeb.AuthorLive.Index do
|
||||
</:action>
|
||||
</.table>
|
||||
|
||||
<.pagination
|
||||
endpoint={~p"/authors"}
|
||||
page={@page}
|
||||
page_params={@page_params}
|
||||
params={@params}
|
||||
/>
|
||||
<%= if Enum.empty?(@page.results) do %>
|
||||
<div class="flex justify-center ">
|
||||
<div>
|
||||
<p class="text-xl font-semibold py-5">
|
||||
No Authors
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="flex flex-wrap flex-[3_1_auto]">
|
||||
<%= for author <- @page.results do %>
|
||||
<.author_card author={author} />
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<.pagination
|
||||
endpoint={~p"/authors"}
|
||||
page={@page}
|
||||
page_params={@page_params}
|
||||
params={@params}
|
||||
/>
|
||||
<% end %>
|
||||
|
||||
<.modal
|
||||
:if={@live_action in [:new, :edit]}
|
||||
|
||||
@@ -44,13 +44,6 @@ defmodule DecentralisedBookIndexWeb.Router do
|
||||
live "/books/:id", BookLive.Show, :show
|
||||
live "/books/:id/show/edit", BookLive.Show, :edit
|
||||
|
||||
live "/authors", AuthorLive.Index, :index
|
||||
live "/authors/new", AuthorLive.Index, :new
|
||||
live "/authors/:id/edit", AuthorLive.Index, :edit
|
||||
|
||||
live "/authors/:id", AuthorLive.Show, :show
|
||||
live "/authors/:id/show/edit", AuthorLive.Show, :edit
|
||||
|
||||
live "/publishers", PublisherLive.Index, :index
|
||||
live "/publishers/new", PublisherLive.Index, :new
|
||||
live "/publishers/:id/edit", PublisherLive.Index, :edit
|
||||
@@ -76,6 +69,13 @@ defmodule DecentralisedBookIndexWeb.Router do
|
||||
#
|
||||
# If an authenticated user must *not* be present:
|
||||
# on_mount {DecentralisedBookIndexWeb.LiveUserAuth, :live_no_user}
|
||||
|
||||
live "/authors", AuthorLive.Index, :index
|
||||
live "/authors/new", AuthorLive.Edit, :new
|
||||
live "/authors/:id/edit", AuthorLive.Edit, :edit
|
||||
|
||||
live "/authors/:id", AuthorLive.Show, :show
|
||||
live "/authors/:id/show/edit", AuthorLive.Show, :edit
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user