From 7f43395f313a26ce0bff06eb91c1f0f3b65affdf Mon Sep 17 00:00:00 2001 From: neuroalien <105230050+neuroalien@users.noreply.github.com> Date: Tue, 11 Jul 2023 04:07:10 +0100 Subject: [PATCH] AO3-5889 Paginate pseuds using default per page setting (#4569) We're also adding alphabetical sorting to the pseuds. --- app/controllers/pseuds_controller.rb | 2 +- app/views/pseuds/index.html.erb | 5 ++++- features/other_a/pseuds.feature | 9 +++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/controllers/pseuds_controller.rb b/app/controllers/pseuds_controller.rb index 50eec2b5bb9..f1e03bb0d32 100644 --- a/app/controllers/pseuds_controller.rb +++ b/app/controllers/pseuds_controller.rb @@ -14,7 +14,7 @@ def load_user # GET /pseuds.xml def index if @user - @pseuds = @user.pseuds + @pseuds = @user.pseuds.alphabetical.paginate(page: params[:page]) @rec_counts = Pseud.rec_counts_for_pseuds(@pseuds) @work_counts = Pseud.work_counts_for_pseuds(@pseuds) @page_subtitle = @user.login diff --git a/app/views/pseuds/index.html.erb b/app/views/pseuds/index.html.erb index f6ff829cf04..db2071ecbe6 100644 --- a/app/views/pseuds/index.html.erb +++ b/app/views/pseuds/index.html.erb @@ -9,6 +9,7 @@
  • <%= link_to ts('New Pseud'), new_user_pseud_path(@user) %>
  • <% end %> +<%= will_paginate @pseuds %> @@ -20,4 +21,6 @@ - + +<%= will_paginate @pseuds %> + diff --git a/features/other_a/pseuds.feature b/features/other_a/pseuds.feature index ce6fe1cc767..c8e40515e0d 100644 --- a/features/other_a/pseuds.feature +++ b/features/other_a/pseuds.feature @@ -161,6 +161,15 @@ Scenario: Many pseuds Then I should see "Slartibartfast" within "li.pseud > a" And I should not see "Slartibartfast" within "ul.expandable" + When I go to my pseuds page + Then I should not see "Zaphod (Zaphod)" within "ul.pseud.index" + But I should see "Agrajag (Zaphod)" within "ul.pseud.index" + And I should see "Betelgeuse (Zaphod)" within "ul.pseud.index" + And I should see "Slartibartfast (Zaphod)" within "ul.pseud.index" + And I should see "Next" within ".pagination" + When I follow "Next" within ".pagination" + Then I should see "Zaphod (Zaphod)" within "ul.pseud.index" + When there are 10 pseuds per page And I view my profile Then I should see "Zaphod, Agrajag, Betelgeuse, and Slartibartfast" within "dl.meta"