Bug: Revisions are displayed oldest first, rather than newest first

Bug: Revisions are displayed oldest first, rather than newest first

Re: Soks 1.0.3

Kris Klindworth pointed out by email:

The other problem was with the Page_revisions.rhtml file. It seemed to me that the intent was to show the 10 most resent changes in reverse chronological order on the first page and then go to following pages to see older changes. Instead, it should the first 10 change in reverse chron order, and then the next page showed the next ten in reverse chron order.

and kindly provided a diff against Page_revision.rhtml to fix:


---------------------------------------------------------------
Diff against the Page_revisions.rhtml file, Soks 1.0.3.
---------------------------------------------------------------
3c3,15
< <% start_at_revision = query['revision'] ? query['revision'].to_i : 0 %>
---
<% 
   final_revision=page.revisions.size-1
   start_at_revision= final_revision
   start_at_revision= query['revision'].to_i if query['revision']
   start_at_revision= 0 if 0 > start_at_revision 
   start_at_revision= final_revision if final_revision < start_at_revision
   end_at_revision = (start_at_revision > 10 ? start_at_revision - 10 : 0 )
   older_revision = (end_at_revision > 0 ? end_at_revision - 1 : 0 )
   newer_revision = (
       start_at_revision+10 > final_revision ? 
         start_at_revision+10 : 
     final_revision)
%>
5,6c17,19
< <% if start_at_revision > 0 %>
<     <p><a href='<%= url page.name, "revisions", "?revision=#{start_at_revision-10}" %>' accesskey="N" >Newer revisions</a></p>
---

<% if start_at_revision < final_revision %>
    <p><a href='<%= url page.name, "revisions", "?revision=#{newer_revision}" %>' accesskey="N" >Newer revisions</a></p>
9c22
< <% page.revisions[start_at_revision,10].reverse_each do |revision| %>
---
<% page.revisions[end_at_revision..start_at_revision].reverse_each do |revision| %>
31,32c44,45
< <% if (start_at_revision+10) < page.revisions.size %>
<     <p><a href='<%= url page.name, "revisions", "?revision=#{start_at_revision+10}" %>' accesskey="O" >Older revisions</a></p>
---
<% if end_at_revision > 0 %>
    <p><a href='<%= url page.name, "revisions", "?revision=#{older_revision}" %>' accesskey="O" >Older revisions</a></p>

Fixed in soks-testing

Edit this page or watch for changes using RSS.