qpixel icon indicating copy to clipboard operation
qpixel copied to clipboard

Post history pagination & permalinks

Open Oaphi opened this issue 2 years ago • 2 comments

Closes #1229

Oaphi avatar Oct 30 '23 09:10 Oaphi

I'm not familiar with Rails' pagination functionality so I don't know how to completely fix this, but just in case it helps I believe the numbering of the edits can be calculated using information which already seems to be available:

  • @count: the total number of edits
  • per_page: the number to show per page in the pagination
  • @page: the currently displayed page

If you know the number of an item within the current page (from 1 to per_page), say number_in_page, then the number to display (the edit number) can be calculated as:

@count - (number_in_page - 1) - (@page - 1) * per_page

The 1s are due to number_in_page and @page being 1-indexed rather than 0-indexed. They can be omitted if those variables are actually 0-indexed.

trichoplax avatar Jun 02 '24 17:06 trichoplax