← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/add-comment-monospace into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/add-comment-monospace into lp:launchpad.

Commit message:
Use a monospace font for "Add comment" boxes for bugs, to match how the comments will be displayed.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1366932 in Launchpad itself: "The "Add comment" text field should be monospaced"
  https://bugs.launchpad.net/launchpad/+bug/1366932

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/add-comment-monospace/+merge/293383

Use a monospace font for "Add comment" boxes for bugs, to match how the comments will be displayed.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/add-comment-monospace into lp:launchpad.
=== modified file 'lib/lp/bugs/browser/bugmessage.py'
--- lib/lp/bugs/browser/bugmessage.py	2016-01-26 15:47:37 +0000
+++ lib/lp/bugs/browser/bugmessage.py	2016-04-29 11:15:54 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """IBugMessage-related browser view classes."""
@@ -11,9 +11,11 @@
 from StringIO import StringIO
 
 from zope.component import getUtility
+from zope.formlib.widgets import TextAreaWidget
 
 from lp.app.browser.launchpadform import (
     action,
+    custom_widget,
     LaunchpadFormView,
     )
 from lp.bugs.browser.bugattachment import BugAttachmentContentCheck
@@ -28,6 +30,8 @@
     schema = IBugMessageAddForm
     initial_focus_widget = None
 
+    custom_widget('comment', TextAreaWidget, cssClass='comment-text')
+
     page_title = "Add a comment or attachment"
 
     @property

=== modified file 'lib/lp/bugs/browser/bugtarget.py'
--- lib/lp/bugs/browser/bugtarget.py	2016-01-26 15:47:37 +0000
+++ lib/lp/bugs/browser/bugtarget.py	2016-04-29 11:15:54 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010-2014 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """IBugTarget-related browser views."""
@@ -35,7 +35,10 @@
 from zope.component import getUtility
 from zope.formlib.form import Fields
 from zope.formlib.interfaces import InputErrors
-from zope.formlib.widgets import TextWidget
+from zope.formlib.widgets import (
+    TextAreaWidget,
+    TextWidget,
+    )
 from zope.interface import (
     alsoProvides,
     implementer,
@@ -221,6 +224,7 @@
     schema = IBug
 
     custom_widget('information_type', LaunchpadRadioWidgetWithDescription)
+    custom_widget('comment', TextAreaWidget, cssClass='comment-text')
 
     extra_data_token = None
 

=== modified file 'lib/lp/bugs/stories/bugs/xx-bug-index-lots-of-comments.txt'
--- lib/lp/bugs/stories/bugs/xx-bug-index-lots-of-comments.txt	2012-02-01 15:26:32 +0000
+++ lib/lp/bugs/stories/bugs/xx-bug-index-lots-of-comments.txt	2016-04-29 11:15:54 +0000
@@ -5,12 +5,14 @@
 displayed. A notice is added at the end of the comment list to tell
 the user about this.
 
-Bug 11 has quite a few comments.
+Bug 11 has quite a few comments. Note that the "Add comment" form also has
+the comment-text CSS class, increasing all the find_tags_by_class counts
+below by one.
 
     >>> user_browser.open('http://launchpad.dev/bugs/11')
     >>> comments = find_tags_by_class(user_browser.contents, 'comment-text')
     >>> len(comments)
-    6
+    7
 
 Let's briefly override the configuration to push bug 11 over the
 threshold.
@@ -28,7 +30,7 @@
     >>> user_browser.open('http://launchpad.dev/bugs/11')
     >>> comments = find_tags_by_class(user_browser.contents, 'comment-text')
     >>> len(comments)
-    3
+    4
 
 With a warning telling the user where the comments have gone:
 
@@ -61,7 +63,7 @@
     >>> user_browser.getLink('View all 6 comments').click()
     >>> comments = find_tags_by_class(user_browser.contents, 'comment-text')
     >>> len(comments)
-    6
+    7
 
     >>> print find_tag_by_id(user_browser.contents, 'add-comment-form').name
     div

=== modified file 'lib/lp/bugs/templates/bugcomment-box.pt'
--- lib/lp/bugs/templates/bugcomment-box.pt	2014-05-29 16:18:50 +0000
+++ lib/lp/bugs/templates/bugcomment-box.pt	2016-04-29 11:15:54 +0000
@@ -129,7 +129,7 @@
                          tal:attributes="value comment/bugwatch/id" />
                   <input type="hidden" name="field.subject"
                          tal:attributes="value comment/bugtask/bug/followup_subject" />
-                  <textarea id="field.comment" name="field.comment" rows="10" cols="60"></textarea>
+                  <textarea id="field.comment" class="comment-text" name="field.comment" rows="10" cols="60"></textarea>
                   <br />
                   <div class="actions">
                     <table style="width: 100%">


Follow ups