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