changeset 5412:9baa4e79b813

Some visual cleanup (CSS, styles) of revision information presentation in diff viewer.
author Eugene Syromyatnikov <evgsyr@gmail.com>
date Sun, 10 Jan 2010 05:37:34 +0300
parents 5b31c32179d4
children b19f3bd50324
files MoinMoin/action/diff.py MoinMoin/util/diff_html.py MoinMoin/web/static/htdocs/classic/css/screen.css MoinMoin/web/static/htdocs/modern/css/screen.css MoinMoin/web/static/htdocs/modernized/css/screen.css MoinMoin/web/static/htdocs/rightsidebar/css/screen.css
diffstat 6 files changed, 42 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/diff.py	Sun Jan 10 05:08:37 2010 +0300
+++ b/MoinMoin/action/diff.py	Sun Jan 10 05:37:34 2010 +0300
@@ -186,7 +186,7 @@
   <div class="diff-info diff-info-header">%(rev_header)s</div>
   <div class="diff-info diff-info-rev-size"><span class="diff-info-caption">%(rev_size_caption)s:</span> <span class="diff-info-value">%%(rev_size)d</span></div>
   <div class="diff-info diff-info-rev-author"><span class="diff-info-caption">%(rev_author_caption)s:</span> <span class="diff-info-value">%%(rev_author)s</span></div>
-  <div class="diff-info diff-info-rev-comment diff_info_rev1"><span class="diff-info-caption">%(rev_comment_caption)s:</span> <span class="diff-info-value">%%(rev_comment)s</span></div>
+  <div class="diff-info diff-info-rev-comment"><span class="diff-info-caption">%(rev_comment_caption)s:</span> <span class="diff-info-value">%%(rev_comment)s</span></div>
 """ % {
     'rev_header': _('Revision %(rev)d as of %(date)s'),
     'rev_size_caption': _('Size'),
@@ -213,10 +213,10 @@
 
     if request.user.show_fancy_diff:
         from MoinMoin.util import diff_html
-        request.write(f.rawHTML(diff_html.diff(request, oldpage.get_raw_body(), newpage.get_raw_body(), old_top=rev_info_old_html, new_top=rev_info_new_html)))
+        request.write(f.rawHTML(diff_html.diff(request, oldpage.get_raw_body(), newpage.get_raw_body(), old_top=rev_info_old_html, new_top=rev_info_new_html, old_top_class="diff-info", new_top_class="diff-info")))
         newpage.send_page(count_hit=0, content_only=1, content_id="content-below-diff")
     else:
-        request.write(f.rawHTML('<table class="diff"><tr><td>%s</td><td>%s</td></tr></table>' % (rev_info_old_html, rev_info_new_html)))
+        request.write(f.rawHTML('<table class="diff"><tr><td class="diff-info">%s</td><td class="diff-info">%s</td></tr></table>' % (rev_info_old_html, rev_info_new_html)))
 
         from MoinMoin.util import diff_text
         lines = diff_text.diff(oldpage.getlines(), newpage.getlines())
--- a/MoinMoin/util/diff_html.py	Sun Jan 10 05:08:37 2010 +0300
+++ b/MoinMoin/util/diff_html.py	Sun Jan 10 05:37:34 2010 +0300
@@ -23,7 +23,7 @@
 
 
 # This code originally by Scott Moonen, used with permission.
-def diff(request, old, new, old_top='', new_top='', old_bottom='', new_bottom=''):
+def diff(request, old, new, old_top='', new_top='', old_bottom='', new_bottom='', old_top_class='', new_top_class='', old_bottom_class='', new_bottom_class=''):
     """ Find changes between old and new and return
         HTML markup visualising them.
 
@@ -33,6 +33,10 @@
         @param old_bottom: Custom html for adding at bottom of old revision column (optional)
         @param new_top: Custom html for adding ontop of new revision column (optional)
         @param new_bottom: Custom html for adding at bottom of new revision column (optional)
+        @param old_top_class: Custom class for <td> with old_top content (optional)
+        @param new_top_class: Custom class for <td> with new_top content (optional)
+        @param old_bottom_class: Custom class for <td> with old_bottom content (optional)
+        @param new_bottom_class: Custom class for <td> with new_bottom content (optional)
     """
     _ = request.getText
     t_line = _("Line") + " %d"
@@ -54,7 +58,7 @@
 """
 
     if old_top or new_top:
-        result += "<tr><td>%s</td><td>%s</td></tr>" % (old_top, new_top)
+        result += '<tr><td class="%s">%s</td><td class="%s">%s</td></tr>' % (old_top_class, old_top, new_top_class, new_top)
 
     result += """
 <tr>
@@ -152,7 +156,7 @@
         lastmatch = (match[0] + match[2], match[1] + match[2])
 
     if old_bottom or new_bottom:
-        result += "<tr><td>%s</td><td>%s</td></tr>" % (old_bottom, new_bottom)
+        result += '<tr><td class="%s">%s</td><td class="%s">%s</td></tr>' % (old_top_class, old_top, new_top_class, new_top)
 
     result += '</table>\n'
     return result
--- a/MoinMoin/web/static/htdocs/classic/css/screen.css	Sun Jan 10 05:08:37 2010 +0300
+++ b/MoinMoin/web/static/htdocs/classic/css/screen.css	Sun Jan 10 05:37:34 2010 +0300
@@ -415,10 +415,18 @@
 	background-color: #FFFF80;
 }
 
+td.diff-info {
+    vertical-align:top;
+}
+
 div.diff-info {
     white-space:nowrap;
 }
 
+div.diff-info-rev-comment span.diff-info-value {
+    white-space:normal;
+}
+
 div.diff-info-header {
     background-color:#E8E8E8;
     width:100%;
--- a/MoinMoin/web/static/htdocs/modern/css/screen.css	Sun Jan 10 05:08:37 2010 +0300
+++ b/MoinMoin/web/static/htdocs/modern/css/screen.css	Sun Jan 10 05:37:34 2010 +0300
@@ -475,10 +475,18 @@
     background-color: #FFFF80;
 }
 
+td.diff-info {
+    vertical-align:top;
+}
+
 div.diff-info {
     white-space:nowrap;
 }
 
+div.diff-info-rev-comment span.diff-info-value {
+    white-space:normal;
+}
+
 div.diff-info-header {
     background-color:#E8E8E8;
     width:100%;
--- a/MoinMoin/web/static/htdocs/modernized/css/screen.css	Sun Jan 10 05:08:37 2010 +0300
+++ b/MoinMoin/web/static/htdocs/modernized/css/screen.css	Sun Jan 10 05:37:34 2010 +0300
@@ -431,10 +431,18 @@
     background-color: #FFFF80;
 }
 
+td.diff-info {
+    vertical-align:top;
+}
+
 div.diff-info {
     white-space:nowrap;
 }
 
+div.diff-info-rev-comment span.diff-info-value {
+    white-space:normal;
+}
+
 div.diff-info-header {
     background-color:#E8E8E8;
     width:100%;
--- a/MoinMoin/web/static/htdocs/rightsidebar/css/screen.css	Sun Jan 10 05:08:37 2010 +0300
+++ b/MoinMoin/web/static/htdocs/rightsidebar/css/screen.css	Sun Jan 10 05:37:34 2010 +0300
@@ -366,10 +366,18 @@
 	background-color: #FFFF80;
 }
 
+td.diff-info {
+    vertical-align:top;
+}
+
 div.diff-info {
     white-space:nowrap;
 }
 
+div.diff-info-rev-comment span.diff-info-value {
+    white-space:normal;
+}
+
 div.diff-info-header {
     background-color:#E8E8E8;
     width:100%;