[PATCH] fix https://fedorahosted.org/bodhi/ticket/290
by Development discussions related to Fedora
Hi, I got cheesed off again by bodhi's display of comments, so I have
had a go at adjusting code bits to make the comment text wrap, and still
enforce applying CRLF when the commenter uses it.
I haven't bothered with a local bodhi server instance, just inferred
from a typical page how the template would need to change to generate
html without <pre>, and instead a fixed-width style. I hope I was on the
right track...
DaveT.
diff --git a/bodhi/static/css/layout.css b/bodhi/static/css/layout.css
index eee822c..df4b738 100644
--- a/bodhi/static/css/layout.css
+++ b/bodhi/static/css/layout.css
@@ -449,6 +449,14 @@ div.flash {
background: #ffb200;
}
+div.comment-text {
+ font-family: monospace;
+ white-space: pre-wrap; /* 2009-01-03: best effort for current browsers*/
+ white-space: pre-line; /* css 2.1, enable later when moz 3.1+ available*/
+/*https://developer.mozilla.org/en/CSS/white-space*/
+/*http://www.w3.org/TR/CSS21/text.html#white-space-prop*/
+}
+
/*
** Login CSS (login.kid)
*/
diff --git a/bodhi/templates/show.kid b/bodhi/templates/show.kid
index d80d538..ca88573 100644
--- a/bodhi/templates/show.kid
+++ b/bodhi/templates/show.kid
@@ -202,7 +202,7 @@ karma = "<img src=\"%s\" align=\"top\" /> <b>%d</b>" % (tg.url('/static/images/k
<div py:if="update.comments">
<div py:for="comment in update.get_comments()">
<img py:attrs="{'src' : tg.url('/static/images/comment-%d.png' % comment.karma)}" hspace="3"/><b>${comment.anonymous and 'Anonymous Tester' or comment.author}</b> - ${comment.timestamp}<br/>
- <pre><div py:replace="comment.text">Comment</div></pre>
+ <div class="comment-text" py:replace="comment.text">Comment</div>
</div>
</div>
<div py:if="not update.comments">