From e46da74472dbaed71771d746890f66afea90cf4a Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Mon, 13 Apr 2026 10:02:19 -0500 Subject: [PATCH] Show windowed page list in live_table footer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously rendered only the current page button. Now renders 1…(current-2)..(current+1) using just has_next_page, collapsing with an ellipsis past page 4. --- lib/microwaveprop_web/live_table_footer.ex | 48 +++++++++++++++++-- .../live_table_footer_test.exs | 35 ++++++++++++++ 2 files changed, 78 insertions(+), 5 deletions(-) create mode 100644 test/microwaveprop_web/live_table_footer_test.exs diff --git a/lib/microwaveprop_web/live_table_footer.ex b/lib/microwaveprop_web/live_table_footer.ex index 288ab632..7f517aa2 100644 --- a/lib/microwaveprop_web/live_table_footer.ex +++ b/lib/microwaveprop_web/live_table_footer.ex @@ -7,12 +7,15 @@ defmodule MicrowavepropWeb.LiveTableFooter do table_options = assigns.table_options paginate? = get_in(options, ["pagination", "paginate?"]) mode = get_in(table_options, [:pagination, :mode]) + page = parse_page(get_in(options, ["pagination", "page"])) + has_next? = get_in(options, ["pagination", :has_next_page]) || false assigns = assigns |> assign(:show_pagination?, paginate? && mode != :infinite_scroll) - |> assign(:page, parse_page(get_in(options, ["pagination", "page"]))) - |> assign(:has_next_page?, get_in(options, ["pagination", :has_next_page]) || false) + |> assign(:page, page) + |> assign(:has_next_page?, has_next?) + |> assign(:page_items, page_items(page, has_next?)) ~H"""