diff --git a/lib/pinchflat_web/controllers/sources/source_html/media_item_table_live.ex b/lib/pinchflat_web/controllers/sources/source_html/media_item_table_live.ex index bc2705c..8c56d97 100644 --- a/lib/pinchflat_web/controllers/sources/source_html/media_item_table_live.ex +++ b/lib/pinchflat_web/controllers/sources/source_html/media_item_table_live.ex @@ -11,17 +11,33 @@ defmodule Pinchflat.Sources.MediaItemTableLive do def render(%{records: []} = assigns) do ~H""" -

Nothing Here!

+
+ +

Nothing Here!

+
""" end def render(assigns) do ~H"""
- - Showing <%= length(@records) %> of <%= @total_record_count %> + + + Showing <%= length(@records) %> of <%= @total_record_count %> - <.table rows={@records} table_class="text-black dark:text-white"> + <.table rows={@records} table_class="text-white"> <:col :let={media_item} label="Title"> <.subtle_link href={~p"/sources/#{@source.id}/media/#{media_item.id}"}> <%= StringUtils.truncate(media_item.title, 50) %> @@ -57,6 +73,12 @@ defmodule Pinchflat.Sources.MediaItemTableLive do {:noreply, assign(socket, new_assigns)} end + def handle_event("reload_page", _params, %{assigns: assigns} = socket) do + new_assigns = fetch_pagination_attributes(assigns.base_query, assigns.page) + + {:noreply, assign(socket, new_assigns)} + end + defp fetch_pagination_attributes(base_query, page) do total_record_count = Repo.aggregate(base_query, :count, :id) total_pages = max(ceil(total_record_count / @limit), 1) diff --git a/lib/pinchflat_web/controllers/sources/source_html/show.html.heex b/lib/pinchflat_web/controllers/sources/source_html/show.html.heex index 2d110c4..0f8869d 100644 --- a/lib/pinchflat_web/controllers/sources/source_html/show.html.heex +++ b/lib/pinchflat_web/controllers/sources/source_html/show.html.heex @@ -64,7 +64,7 @@ <% else %> -

Nothing Here!

+

Nothing Here!

<% end %>