.vbw-planning/milestones/ui-fixes-and-smart-scraping/phases/03-dashboard-pagination/03-PLAN.md
Replace the manual prev/next pagination in the sources index with the shared pagination partial from Plan 01. Use the enhanced paginator's total_count and total_pages to show page numbers and jump-to-page.
What: Modify the sources index action to pass the full paginator result to the view instead of extracting individual fields.
Files to modify:
app/controllers/source_monitor/sources_controller.rbImplementation details:
@sources, @page, @has_next_page, @has_previous_page separately, assign @paginator = Paginator.new(...).paginate@sources = @paginator.records for backward compat with the row partial@page, @has_next_page, @has_previous_page instance variables (the shared partial reads from @paginator directly)total_count and total_pages from Plan 01Acceptance criteria:
@paginator is available in the view with all pagination fields@sources still works for the table body renderingWhat: Replace the hand-rolled pagination controls at the bottom of sources/index.html.erb with the shared _pagination.html.erb partial from Plan 01.
Files to modify:
app/views/source_monitor/sources/index.html.erbImplementation details:
<div> at the bottom (lines 264-288 approximately)<%= render "source_monitor/shared/pagination", paginator_result: @paginator, base_path: source_monitor.sources_path, extra_params: pagination_extra_params, turbo_frame: "source_monitor_sources_table" %>pagination_extra_params hash combining search params and per_pageImplementation for extra_params building (in the view or a helper):
extra_params = {}
extra_params[:q] = @search_params if @search_params.present?
extra_params[:per_page] = params[:per_page] if params[:per_page].present?
Acceptance criteria:
What: Update existing controller tests to verify the new pagination UX elements.
Files to modify:
Test cases:
test "index renders page numbers and total pages" -- Create 30 sources, per_page 10, verify page 1 shows "Page 1 of 3" and page number linkstest "jump to page preserves search params" -- Search + jump to page 2, verify search params in resulting URLtest "pagination preserves filter params" -- Filter by health status + paginate, verify filter preservedAcceptance criteria:
What: Remove any dead code left over from the old manual pagination implementation.
Files to modify:
app/views/source_monitor/sources/index.html.erb (verify no leftover references to old @page, @has_next_page, @has_previous_page)app/controllers/source_monitor/sources_controller.rb (verify no leftover assigns)Acceptance criteria:
bin/rubocop passes cleanbin/rails test passesThis plan modifies:
app/controllers/source_monitor/sources_controller.rbapp/views/source_monitor/sources/index.html.erbDepends on Plan 01 (paginator total_count/total_pages + shared pagination partial). No conflict with Plan 02 (dashboard files) or Plan 04 (stats files).