From c0d6f5eb49947ff253192fa7c035dd0b346194e2 Mon Sep 17 00:00:00 2001
From: Christian Boos <cboos@neuf.fr>
Date: Fri, 30 Apr 2010 22:11:47 +0200
Subject: [PATCH] #9282: highlight the unread events by using a green sidebar.

---
 trac/htdocs/css/timeline.css          |   12 ++++++++++--
 trac/timeline/templates/timeline.html |    7 ++++---
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/trac/htdocs/css/timeline.css b/trac/htdocs/css/timeline.css
index 8eae35c..4702c86 100644
--- a/trac/htdocs/css/timeline.css
+++ b/trac/htdocs/css/timeline.css
@@ -10,7 +10,16 @@ h2 {
  font-size: 105%;
  margin: 2em 0 .5em;
 }
-dl { line-height: 1.3em; margin-left: 1em }
+dl {
+ line-height: 1.3em;
+ margin-left: 1em;
+}
+dl.unread { 
+ margin-left: 0.55em;
+ border-left: 0.2em solid #c0f0c0;
+ padding-left: 0.35em;
+}
+
 dt { background: 3px 4px no-repeat; padding: 0 }
 dt :link, dt :visited {
  background: 3px 3px no-repeat;
@@ -31,7 +40,6 @@ dt em {
 }
 dt .time { color: #999; font-size: 80%; }
 dt .author { color: #666; }
-dt.unread { background-color: #dfd; }
 dt.highlight { background-color: #ffa; } 
 dd { 
  font-size: 80%;
diff --git a/trac/timeline/templates/timeline.html b/trac/timeline/templates/timeline.html
index cda4db9..77556fd 100644
--- a/trac/timeline/templates/timeline.html
+++ b/trac/timeline/templates/timeline.html
@@ -34,10 +34,11 @@
 
       <py:for each="day, events in groupby(events, key=lambda e: format_date(e.date))">
         <h2>${day}: ${day == today and _("Today") or day == yesterday and _("Yesterday") or None}</h2>
-        <dl>
+        <dl py:for="unread, events in groupby(events, key=
+                lambda e: lastread and lastread &lt; e.date.isoformat())"
+            class="${unread and 'unread' or None}">
           <py:for each="event in events"
-            py:with="highlight = precision and precisedate and timedelta(0) &lt;= (event.date - precisedate) &lt; precision;
-                     unread = lastread and lastread &lt; event.date.isoformat()">
+            py:with="highlight = precision and precisedate and timedelta(0) &lt;= (event.date - precisedate) &lt; precision">
             <dt class="${classes(event.kind, highlight=highlight, unread=unread)}">
               <a href="${event.render('url', context)}" py:choose="">
                 <py:when test="event.author"><i18n:msg params="time, title, author">
-- 
1.7.0.4


