Update the select components to show the message about no records.

dev
KKlochko 4 weeks ago
parent e226e696da
commit bf333aad07

@ -42,18 +42,26 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.SelectAuthor do
</div>
</form>
<%= for author <- @page.results do %>
<div
phx-click="select-author"
phx-target={@notify_component}
phx-value-author={author.id}
phx-value-path={@form_path}
class="w-full bg-white border border-gray-200 rounded-lg shadow-sm dark:bg-gray-800 dark:border-gray-700 mx-auto my-3 hover:bg-gray-100 dark:hover:bg-gray-700"
>
<h5 class="mb-1 text-lg font-medium text-gray-900 dark:text-white px-2 pt-1">
{author.name}
</h5>
<%= if Enum.empty?(@page.results) do %>
<div class="flex justify-center ">
<p class="text-lg font-semibold py-5 dark:text-white">
No Authors
</p>
</div>
<% else %>
<%= for author <- @page.results do %>
<div
phx-click="select-author"
phx-target={@notify_component}
phx-value-author={author.id}
phx-value-path={@form_path}
class="w-full bg-white border border-gray-200 rounded-lg shadow-sm dark:bg-gray-800 dark:border-gray-700 mx-auto my-3 hover:bg-gray-100 dark:hover:bg-gray-700"
>
<h5 class="mb-1 text-lg font-medium text-gray-900 dark:text-white px-2 pt-1">
{author.name}
</h5>
</div>
<% end %>
<% end %>
</div>
"""

@ -42,17 +42,25 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.SelectAuthorAlias do
</div>
</form>
<%= for author_alias <- @page.results do %>
<div
phx-click="select-author-alias"
phx-target={@notify_component}
phx-value-author-alias={author_alias.author_alias_registry_id}
class="w-full bg-white border border-gray-200 rounded-lg shadow-sm dark:bg-gray-800 dark:border-gray-700 mx-auto my-3 hover:bg-gray-100 dark:hover:bg-gray-700"
>
<h5 class="mb-1 text-lg font-medium text-gray-900 dark:text-white px-2 pt-1">
{author_alias.name}
</h5>
<%= if Enum.empty?(@page.results) do %>
<div class="flex justify-center ">
<p class="text-lg font-semibold py-5 dark:text-white">
No Authors
</p>
</div>
<% else %>
<%= for author_alias <- @page.results do %>
<div
phx-click="select-author-alias"
phx-target={@notify_component}
phx-value-author-alias={author_alias.author_alias_registry_id}
class="w-full bg-white border border-gray-200 rounded-lg shadow-sm dark:bg-gray-800 dark:border-gray-700 mx-auto my-3 hover:bg-gray-100 dark:hover:bg-gray-700"
>
<h5 class="mb-1 text-lg font-medium text-gray-900 dark:text-white px-2 pt-1">
{author_alias.name}
</h5>
</div>
<% end %>
<% end %>
</div>
"""

@ -42,17 +42,25 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.SelectBookEdition do
</div>
</form>
<%= for book_edition <- @page.results do %>
<div
phx-click="select-book-edition"
phx-target={@notify_component}
phx-value-book-edition={book_edition.book_editions_registry_id}
class="w-full bg-white border border-gray-200 rounded-lg shadow-sm dark:bg-gray-800 dark:border-gray-700 mx-auto my-3 hover:bg-gray-100 dark:hover:bg-gray-700"
>
<h5 class="mb-1 text-lg font-medium text-gray-900 dark:text-white px-2 pt-1">
{book_edition.title}
</h5>
<%= if Enum.empty?(@page.results) do %>
<div class="flex justify-center ">
<p class="text-lg font-semibold py-5 dark:text-white">
No Books
</p>
</div>
<% else %>
<%= for book_edition <- @page.results do %>
<div
phx-click="select-book-edition"
phx-target={@notify_component}
phx-value-book-edition={book_edition.book_editions_registry_id}
class="w-full bg-white border border-gray-200 rounded-lg shadow-sm dark:bg-gray-800 dark:border-gray-700 mx-auto my-3 hover:bg-gray-100 dark:hover:bg-gray-700"
>
<h5 class="mb-1 text-lg font-medium text-gray-900 dark:text-white px-2 pt-1">
{book_edition.title}
</h5>
</div>
<% end %>
<% end %>
</div>
"""

@ -42,17 +42,25 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.SelectPublisher do
</div>
</form>
<%= for publisher <- @page.results do %>
<div
phx-click="select-publisher"
phx-target={@notify_component}
phx-value-publisher={publisher.id}
class="w-full bg-white border border-gray-200 rounded-lg shadow-sm dark:bg-gray-800 dark:border-gray-700 mx-auto my-3 hover:bg-gray-100 dark:hover:bg-gray-700"
>
<h5 class="mb-1 text-lg font-medium text-gray-900 dark:text-white px-2 pt-1">
{publisher.name}
</h5>
<%= if Enum.empty?(@page.results) do %>
<div class="flex justify-center ">
<p class="text-lg font-semibold py-5 dark:text-white">
No Publishers
</p>
</div>
<% else %>
<%= for publisher <- @page.results do %>
<div
phx-click="select-publisher"
phx-target={@notify_component}
phx-value-publisher={publisher.id}
class="w-full bg-white border border-gray-200 rounded-lg shadow-sm dark:bg-gray-800 dark:border-gray-700 mx-auto my-3 hover:bg-gray-100 dark:hover:bg-gray-700"
>
<h5 class="mb-1 text-lg font-medium text-gray-900 dark:text-white px-2 pt-1">
{publisher.name}
</h5>
</div>
<% end %>
<% end %>
</div>
"""

Loading…
Cancel
Save