changeset 156:206b3db4eade

RC: make NEW icon clickable, make long comment parts breakable (fixing ugly rendering for some use cases) imported from: moin--main--1.5--patch-158
author Thomas Waldmann <tw@waldmann-edv.de>
date Sat, 29 Oct 2005 20:18:48 +0000
parents 98592419bc03
children 99bf20eeb0bc
files MoinMoin/macro/RecentChanges.py MoinMoin/wikiutil.py docs/CHANGES
diffstat 3 files changed, 26 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/macro/RecentChanges.py	Sat Oct 29 19:10:31 2005 +0000
+++ b/MoinMoin/macro/RecentChanges.py	Sat Oct 29 20:18:48 2005 +0000
@@ -16,6 +16,7 @@
 _DAYS_SELECTION = [1, 2, 3, 7, 14, 30, 60, 90]
 _MAX_DAYS = 7
 _MAX_PAGENAME_LENGTH = 15 # 35
+_MAX_COMMENT_LENGTH = 20
 
 #############################################################################
 ### RecentChanges Macro
@@ -40,7 +41,8 @@
     elif line.action.find('/REVERT') != -1:
         rev = int(line.extra)
         comment = _("Revert to revision %(rev)d.") % {'rev': rev}
-    return comment
+
+    return wikiutil.make_breakable(comment, _MAX_COMMENT_LENGTH)
 
 def format_page_edits(macro, lines, bookmark_usecs):
     request = macro.request
@@ -61,7 +63,9 @@
     elif is_new:
         # show "NEW" icon if page was created after the user's bookmark
         if hilite:
-            html_link = request.theme.make_icon('new')
+            img = request.theme.make_icon('new')
+            html_link = wikiutil.link_tag(request, wikiutil.quoteWikinameURL(pagename),
+                                          img, formatter=macro.formatter)
     elif hilite:
         # show "UPDATED" icon if page was edited after the user's bookmark
         img = request.theme.make_icon('updated')
@@ -85,7 +89,7 @@
     d['time_html'] = None
     if request.cfg.changed_time_fmt:
         tdiff = long(tnow - wikiutil.version2timestamp(long(line.ed_time_usecs))) / 60 # has to be long for py 2.2.x
-        if tdiff < 100: # was 1440
+        if tdiff < 100:
             d['time_html'] = _("%(mins)dm ago") % {
                 'mins': tdiff}
         else:
--- a/MoinMoin/wikiutil.py	Sat Oct 29 19:10:31 2005 +0000
+++ b/MoinMoin/wikiutil.py	Sat Oct 29 20:18:48 2005 +0000
@@ -237,6 +237,19 @@
         s = s.replace('"', "&quot;")
     return s
 
+def make_breakable(text, maxlen):
+    """ make a text breakable by inserting spaces into nonbreakable parts
+    """
+    text = text.split(" ")
+    newtext = []
+    for part in text:
+        if len(part) > maxlen:
+            while part:
+                newtext.append(part[:maxlen])
+                part = part[maxlen:]
+        else:
+            newtext.append(part)
+    return " ".join(newtext)
 
 ########################################################################
 ### Storage
--- a/docs/CHANGES	Sat Oct 29 19:10:31 2005 +0000
+++ b/docs/CHANGES	Sat Oct 29 20:18:48 2005 +0000
@@ -21,6 +21,7 @@
        * bang_meta old: 0 new: 1
        * show_section_numbers old: 1 new: 0
        * some regexes that used to be [a-z]Uxxxx$ are now [a-z0-9]Uxxxx$
+       * navi_bar has no page_front_page as first element any more
      * removed settings and code [new behaviour]:
        * acl_enabled [1]
        * allow_extended_names [1]
@@ -180,6 +181,11 @@
       They are used additionally to the global lists in MoinMoin/dict/.
     * moin_dump now also dumps attachments referenced from the page.
       It doesn't dump stuff that is just attached, but not referenced!
+    * On RecentChanges we now force the comment to be breakable, this improves
+      rendering of over-long words or on narrow browser windows - especially
+      for themes with limited content width like rightsidebar.
+    * We now have the "new" icon on RecentChanges clickable, just links to the
+      page.
 
   International support:    
     * mail_from can be now a unicode name-address