newamericafoundation / newamerica-cms

CMS for New America
https://www.newamerica.org/
5 stars 5 forks source link

Feature page ordering #1841

Closed chigby closed 7 months ago

chigby commented 8 months ago

Fixes #1840

This pull request makes adjustments needed to display featured pages on Program home pages in descending order by the sort_order field. This field is the one that is determined page a page's up-and-down position on an InlinePanel. The front end program page components make requests to two different API endpoints to display these featured pages: the program details view, and the program featured page list. Both of these were hard-coding the ordering of featured pages to be by sort_order ascending. I've changed it so that the front end can now specify whether it wants the ordering to be ascending or descending. The ordering cannot easily be done on the front end entirely, as the featured pages are loaded in in "pages" of seven at a time.

So I've updated the front end to ask for descending order in all the places I could find.

I've also added a data migration that inverts the sort_order field for all featured pages on all Programs (except for a few that were unordered to start with--not sure how that happened. Some programs' featured pages have all NULL in the sort_order column. These have been unchanged). This will preserve the current presentation of featured pages.

Also, the help text has been updated to reflect these changes: image

nmorduch commented 7 months ago

Things to test: