Reverse timeline in page history

Applies to
unreleased 1.9.2, possibly higher.
Purpose
Reverse the offsets timeline in page history.
Description

I have noticed that the new elements added by EugeneSyromyatnikov (thanks!) in info action use an unusual timeline, in reversed order. For example, a timeline of events which happened along the years would probably, at least for left-to-right languages, have the older events on the left, and newer on the right. Therefore, I think it would be more natural if we change the revision timeline in that action from this:

current.png

to this:

implementation.png

Patch

This patch is based on revision 48c7d851938f. It was mostly about reordering the source code:

   1 --- MoinMoin/action/info.py     2010-02-13 18:50:09 +0000
   2 +++ MoinMoin/action/info.py     2010-02-13 18:46:36 +0000
   3 @@ -129,43 +129,45 @@
   4                          f.table_cell(0)
   5                      )
   6  
   7 -                # link to previous page - only if not at start
   8 -                if offset > 0:
   9 -                    add_offset_link(((offset - 1) / max_count) * max_count, _("Newer"))
  10 -
  11 -                # link to beggining of event log - if min_offset is not minimal
  12 -                if min_offset > 0:
  13 -                    add_offset_link(0)
  14 -                    # adding gap only if min_offset not explicitly following beginning
  15 -                    if min_offset > 1:
  16 +                # link to next page
  17 +                if offset < (log_size - max_count):
  18 +                    add_offset_link(((offset + max_count) / max_count) * max_count, _("Older"))
  19 +                    
  20 +                # special case - if offset is greater than max_offset * max_count
  21 +                if offset > max_offset * max_count:
  22 +                    offset_links.append(f.table_cell(1, css_class="info-offset-item info-cur-offset") + f.text(str(log_size - offset)) + f.table_cell(0))
  23 +                    
  24 +                # link to the last page of event log
  25 +                if max_offset < (log_size - 1) / max_count:
  26 +                    if max_offset < (log_size - 1) / max_count - 1:
  27                          offset_links.append(f.table_cell(1, css_class="info-offset-gap") + f.text(u'\u2026') + f.table_cell(0))
  28 +                    add_offset_link(((log_size - 1) / max_count) * max_count)
  29  
  30                  # generating near pages links
  31 -                for cur_offset in range(min_offset, max_offset + 1):
  32 +                offsets = range(min_offset, max_offset + 1)
  33 +                offsets.reverse()
  34 +                for cur_offset in offsets:
  35 +                    # add link, if not at this offset
  36 +                    if offset != cur_offset * max_count:
  37 +                        add_offset_link(cur_offset * max_count)
  38 +
  39                      # note that current offset may be not multiple of max_count,
  40                      # so we check whether we should add current offset marker like this
  41 -                    if not offset_added and offset <= cur_offset * max_count:
  42 +                    if not offset_added and offset >= cur_offset * max_count:
  43                          # current info history view offset
  44                          offset_links.append(f.table_cell(1, css_class="info-offset-item info-cur-offset") + f.text(str(log_size - offset)) + f.table_cell(0))
  45                          offset_added = True
  46  
  47 -                    # add link, if not at this offset
  48 -                    if offset != cur_offset * max_count:
  49 -                        add_offset_link(cur_offset * max_count)
  50 -
  51 -                # link to the last page of event log
  52 -                if max_offset < (log_size - 1) / max_count:
  53 -                    if max_offset < (log_size - 1) / max_count - 1:
  54 +                # link to beggining of event log - if min_offset is not minimal
  55 +                if min_offset > 0:
  56 +                    add_offset_link(0)
  57 +                    # adding gap only if min_offset not explicitly following beginning
  58 +                    if min_offset > 1:
  59                          offset_links.append(f.table_cell(1, css_class="info-offset-gap") + f.text(u'\u2026') + f.table_cell(0))
  60 -                    add_offset_link(((log_size - 1) / max_count) * max_count)
  61 -
  62 -                # special case - if offset is greater than max_offset * max_count
  63 -                if offset > max_offset * max_count:
  64 -                    offset_links.append(f.table_cell(1, css_class="info-offset-item info-cur-offset") + f.text(str(log_size - offset)) + f.table_cell(0))
  65 -
  66 -                # link to next page
  67 -                if offset < (log_size - max_count):
  68 -                    add_offset_link(((offset + max_count) / max_count) * max_count, _("Older"))
  69 +                        
  70 +                # link to previous page - only if not at start
  71 +                if offset > 0:
  72 +                    add_offset_link(((offset - 1) / max_count) * max_count, _("Newer"))
  73  
  74                  # generating html
  75                  paging_nav_html += "".join([

Discussion

The most preferred order (by me) is order which also used by Gmail, like Newer 1 101 201 ... 100500 Older. But this definitely should be discussed by some representative number of people. -- EugeneSyromyatnikov 2010-02-13 22:54:46

Plan


CategoryMoinMoinPatch

MoinMoin: MoinMoinPatch/ReverseTimelineInPageHistory (last edited 2010-09-21 12:42:36 by ThomasWaldmann)