diff --git a/lib/decentralised_book_index_web/live/author_live/index.ex b/lib/decentralised_book_index_web/live/author_live/index.ex index 1844655..e8fb3b2 100644 --- a/lib/decentralised_book_index_web/live/author_live/index.ex +++ b/lib/decentralised_book_index_web/live/author_live/index.ex @@ -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 "> +

+ Listing Authors +

<.author_search @@ -47,12 +49,28 @@ defmodule DecentralisedBookIndexWeb.AuthorLive.Index do - <.pagination - endpoint={~p"/authors"} - page={@page} - page_params={@page_params} - params={@params} - /> + <%= if Enum.empty?(@page.results) do %> +
+
+

+ No Authors +

+
+
+ <% else %> +
+ <%= for author <- @page.results do %> + <.author_card author={author} /> + <% end %> +
+ + <.pagination + endpoint={~p"/authors"} + page={@page} + page_params={@page_params} + params={@params} + /> + <% end %> <.modal :if={@live_action in [:new, :edit]} diff --git a/lib/decentralised_book_index_web/router.ex b/lib/decentralised_book_index_web/router.ex index eb14164..9b95d27 100644 --- a/lib/decentralised_book_index_web/router.ex +++ b/lib/decentralised_book_index_web/router.ex @@ -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