Skip to content

Commit

Permalink
AO3-5889 Paginate pseuds using default per page setting (otwcode#4569)
Browse files Browse the repository at this point in the history
We're also adding alphabetical sorting to the pseuds.
  • Loading branch information
neuroalien authored Jul 11, 2023
1 parent a41dcfb commit 7f43395
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/pseuds_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion app/views/pseuds/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<li><%= link_to ts('New Pseud'), new_user_pseud_path(@user) %></li>
</ul>
<% end %>
<%= will_paginate @pseuds %>
<!--/subnav-->

<!--main content-->
Expand All @@ -20,4 +21,6 @@
</ul>
<!--/content-->


<!--subnav-->
<%= will_paginate @pseuds %>
<!--/subnav-->
9 changes: 9 additions & 0 deletions features/other_a/pseuds.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 7f43395

Please sign in to comment.