New Ticket

TICKET_CREATE privileges are required to perform this operation. You don't have the required permissions



Login Close


Highlight field values in ticket comments feed

Ticket #359 Assigned to nobody, last modified 4 years ago

Details

Reporter olemis
Keywords ticket comments diff starter
Type enhancement
Status new
Priority trivial
Product BHD
Milestone Unscheduled
Component ui design
Version
Cc olemis+bh@…

Description

Users that review ticket feed quite often find it a bit hard to distinguish values among ticket change text . For instance compare the two screenshots shown below

Screenshot : Ticket comment (no highlight)

Image above illustrates what it looks like nowadays . Notice that it's necessary to focus so as to delimit the text for ticket values and figure out what it is about (i.e. remove vs add).

Screenshot #359 : Ticket comment (highlighted)

Image above illustrates suggest a new change . Notice that highlighting makes it easier now to delimit the boundaries of field values and the purpose (i.e. remove vs add). Background colors are similar to those used in diff view , but lighter .

Last modified by olemis (diff)

Attachments (2)

bh_theme_x_97_ticket_chg_highlight_current.png (46.2 KB) - added by olemis 5 years ago.
Screenshot : Ticket comment (no highlight)
bh_theme_x_98_ticket_chg_highlight_new.png (49.8 KB) - added by olemis 5 years ago.
Screenshot #359 : Ticket comment (highlighted)
Download all attachments as: .zip
Note: See TracTickets for help on using tickets.

jdreimann

I responded to this via email before, but I believe that email was never delivered to the mailing list.. Anyway, here goes:

Good suggestion.

Colours are fine, even green and red, as long as they can be differentiated by saturation alone. To test that, take a screenshot and convert it to greyscale.
(We're already meeting the first condition of the colours not conveying important information, it can be understood without colours).

mudri

I'm having a problem with this. After editing bh_ticket_change.html and the CSS file, highlighting works only for:

  • Component
  • Status
  • Milestone
  • Priority
  • Summary
  • Type
  • Version

And not:

  • Owner
  • Reporter
  • CC
  • Keywords

Is there a difference between how these two groups are handled? No change in bh_ticket_change.html makes a difference to displaying the latter fields.

Anyway, here are the changes so far:

Index: bloodhound_theme/bhtheme/templates/bh_ticket_change.html
===================================================================
--- bloodhound_theme/bhtheme/templates/bh_ticket_change.html    (revision 1505634)
+++ bloodhound_theme/bhtheme/templates/bh_ticket_change.html    (working copy)
@@ -147,20 +147,20 @@
           <py:when test="field_name == 'reported'">
           </py:when>
           <py:when test="field_name == 'attachment'"><i18n:msg params="name">
-            <a href="${href.attachment('ticket', ticket.id, field.new)}"><em>${field.new
+            <a href="${href.attachment('ticket', ticket.id, field.new)}"><em class="new-value">${field.new
               }</em></a><a href="${href('raw-attachment', 'ticket', ticket.id, field.new)}"
                            title="Download" class="trac-rawlink">&#8203;</a>
             added
           </i18n:msg></py:when>
           <py:when test="'rendered' in field">${field.rendered}</py:when>
           <py:when test="field.old and field.new"><i18n:msg params="old, new">
-            changed from <em>${field.old}</em> to <em>${field.new}</em>
+            changed from <em class="old-value">${field.old}</em> to <em class="new-value">${field.new}</em>
           </i18n:msg></py:when>
           <py:when test="not field.old and field.new"><i18n:msg params="value">
-            set to <em>${field.new}</em>
+            set to <em class="new-value">${field.new}</em>
           </i18n:msg></py:when>
           <py:otherwise><i18n:msg params="value">
-            <em>${field.old}</em> deleted
+            <em class="old-value">${field.old}</em> deleted
           </i18n:msg></py:otherwise>
         </py:choose>
         <span class="${'hidden-desktop' if change.cnum else ''}">
Index: bloodhound_theme/bhtheme/htdocs/bloodhound.css
===================================================================
--- bloodhound_theme/bhtheme/htdocs/bloodhound.css      (revision 1505634)
+++ bloodhound_theme/bhtheme/htdocs/bloodhound.css      (working copy)
@@ -1281,3 +1281,16 @@
 input[type="radio"]:not(:checked) + label span {
  text-decoration:underline;
 }
+
+#content textarea,
+.popover-content textarea {
+ font-family: monospace;
+}
+
+.old-value {
+ background: #FCE9E9;
+}
+
+.new-value {
+ background: #E7FDE7;
+}

mudri

Okay, it's that those fields which aren't modified are already rendered (with a 'rendered' value). What calls the _modify_ticket() which is in theme.py?

mudri

It works when this is added to the previous stuff:

Index: trac/trac/ticket/web_ui.py
===================================================================
--- trac/trac/ticket/web_ui.py  (revision 1505634)
+++ trac/trac/ticket/web_ui.py  (working copy)
@@ -1743,9 +1743,9 @@
                     'EMAIL_VIEW' in req.perm(resource_new or ticket.resource)):
                 render_elt = obfuscate_email_address
         if (old_list, new_list) != (None, None):
-            added = [tag.em(render_elt(x)) for x in new_list
+            added = [tag.em(render_elt(x), class_="new-value") for x in new_list
                      if x not in old_list]
-            remvd = [tag.em(render_elt(x)) for x in old_list
+            remvd = [tag.em(render_elt(x), class_="old-value") for x in old_list
                      if x not in new_list]
             added = added and tagn_("%(items)s added", "%(items)s added",
                                     len(added), items=separated(added, sep))
@@ -1759,12 +1759,12 @@
                 old = obfuscate_email_address(old)
                 new = obfuscate_email_address(new)
             if old and not new:
-                rendered = tag_("%(value)s deleted", value=tag.em(old))
+                rendered = tag_("%(value)s deleted", value=tag.em(old, class_="old-value"))
             elif new and not old:
-                rendered = tag_("set to %(value)s", value=tag.em(new))
+                rendered = tag_("set to %(value)s", value=tag.em(new, class_="new-value"))
             elif old and new:
                 rendered = tag_("changed from %(old)s to %(new)s",
-                                old=tag.em(old), new=tag.em(new))
+                                old=tag.em(old, class_="old-value"), new=tag.em(new, class_="new-value"))
         return rendered
 
     def grouped_changelog_entries(self, ticket, db=None, when=None):

That does mean modifying Trac, but it's only adding classes to elements. An alternative is to take out the line

<py:when test="'rendered' in field">${field.rendered}</py:when>

from bh_ticket_change.html. This just ignores any rendering which has been done for us.

  • Milestone set to Unscheduled - by rjollos, 4 years ago