Commits

Olemis Lang committed 51f2778

BH Dashboard #177 : Refreshing patch against r1381143

Comments (0)

Files changed (3)

 hgsvn/rm_files.diff
-t177/t177_r1371737_calendar_datetime.diff
+t177/t177_r1381143_calendar_datetime.diff

t177/t177_r1371737_calendar_datetime.diff

-# HG changeset patch
-# Parent 0958327e0a670c95e229489e26cfe3876b47300e
-BH Dashboard #177: Helper function for calendar date indicator
-
-diff -r 0958327e0a67 bhdashboard/layouts/templates/widget_macros.html
---- a/bhdashboard/layouts/templates/widget_macros.html	Fri Aug 31 19:20:25 2012 -0500
-+++ b/bhdashboard/layouts/templates/widget_macros.html	Sat Sep 01 02:45:16 2012 -0500
-@@ -118,4 +118,28 @@
-       </py:otherwise>
-     </py:choose>
-   </py:match>
-+
-+  <!--! Reusable UI fragments -->
-+
-+  <py:def function="calendar_dateinfo(date, format='relative')">
-+    <h6 class="calendar" 
-+        py:with="data = datetime_data(date); old = pretty_dateinfo(date);
-+            header = data.unit if format == 'relative' else data.month;
-+            body = data.offset if format == 'relative' else data.day;
-+            footer = data.year if format != 'relative' and date.year != data.now.year else None">
-+      <?python
-+        old.children = [];
-+        tag = __import__('genshi.builder', fromlist=['tag']).tag
-+      ?>
-+      ${old(tag.h6(header), 
-+          tag.p(body, class_='full' if not footer else None),
-+          tag.em(footer) if footer else None)}
-+      <!-- a class="timeline" title="$data.title(data)" href="$data.href(data)">
-+        <h6>$header</h6>
-+        <p class="${'full' if not footer else None}">$body</p>
-+        <sub py:if="footer">$footer</sub>
-+      </a -->
-+    </h6>
-+  </py:def>
-+
- </html>
-diff -r 0958327e0a67 bhdashboard/util.py
---- a/bhdashboard/util.py	Fri Aug 31 19:20:25 2012 -0500
-+++ b/bhdashboard/util.py	Sat Sep 01 02:45:16 2012 -0500
-@@ -31,6 +31,8 @@
- from wsgiref.util import setup_testing_defaults
- 
- from trac.core import Component, implements, ExtensionPoint
-+from trac.util.datefmt import format_datetime, pretty_timedelta, to_datetime, \
-+       user_time
- from trac.web.api import Request
- from trac.web.chrome import add_link, Chrome
- from trac.web.main import RequestDispatcher
-@@ -176,6 +178,30 @@
-     )
- 
- #------------------------------------------------------
-+#    Date and time functions
-+#------------------------------------------------------
-+
-+def datetime_data(req, date):
-+    """Detailed information about datetime object.
-+    """
-+    absolute = user_time(req, format_datetime, date, format="%a %b %d %Y")
-+    dow, m, d, y = absolute.split()
-+    absolute = user_time(req, format_datetime, date)
-+    relative = pretty_timedelta(date)
-+    offset, unit = relative.split()
-+    return {
-+            'absolute' : absolute,
-+            'year' : y,
-+            'month' : m,
-+            'day': d,
-+            'dayofweek' : dow,
-+            'timedelta' : relative,
-+            'offset': offset,
-+            'unit' : unit,
-+            'now' : to_datetime(None, getattr(req, 'tz', None))
-+        }
-+
-+#------------------------------------------------------
- #    Miscellaneous
- #------------------------------------------------------
- 
-diff -r 0958327e0a67 bhdashboard/web_ui.py
---- a/bhdashboard/web_ui.py	Fri Aug 31 19:20:25 2012 -0500
-+++ b/bhdashboard/web_ui.py	Sat Sep 01 02:45:16 2012 -0500
-@@ -47,6 +47,7 @@
- 
- from bhdashboard.api import DashboardSystem, InvalidIdentifier
- from bhdashboard import _json
-+from bhdashboard.util import datetime_data
- 
- class DashboardModule(Component):
-     """Web frontend for dashboard infrastructure.
-@@ -71,6 +72,7 @@
-         """
-         if data is not None :
-             data['bhdb'] = DashboardChrome(self.env)
-+            data['datetime_data'] = lambda date: datetime_data(req, date)
-         for item in req.chrome['nav'].get('mainnav', []):
-             self.log.debug('%s' % (item,))
-             if item['name'] == 'tickets':

t177/t177_r1381143_calendar_datetime.diff

+# HG changeset patch
+# Parent 4fddc33d1fc2add2dcf360ff857ed854cde4ef1b
+BH Dashboard #177: Helper function for calendar date indicator
+
+diff -r 4fddc33d1fc2 bhdashboard/layouts/templates/widget_macros.html
+--- a/bhdashboard/layouts/templates/widget_macros.html	Wed Sep 05 22:57:52 2012 -0500
++++ b/bhdashboard/layouts/templates/widget_macros.html	Thu Sep 06 01:39:28 2012 -0500
+@@ -118,4 +118,22 @@
+       </py:otherwise>
+     </py:choose>
+   </py:match>
++
++  <!--! Reusable UI fragments -->
++
++  <py:def function="calendar_dateinfo(date, format='relative')">
++    <h6 class="calendar" 
++        py:with="data = datetime_data(date); old = pretty_dateinfo(date);
++            body = data.unit if format == 'relative' else data.month;
++            header = data.offset if format == 'relative' else data.day;
++            footer = data.year if format != 'relative' and date.year != data.now.year else None">
++      <?python
++        old.children = [];
++        tag = __import__('genshi.builder', fromlist=['tag']).tag
++      ?>
++      ${old(tag.h6(header), tag.p(body),
++          tag.em(footer) if footer else None)}
++    </h6>
++  </py:def>
++
+ </html>
+diff -r 4fddc33d1fc2 bhdashboard/util.py
+--- a/bhdashboard/util.py	Wed Sep 05 22:57:52 2012 -0500
++++ b/bhdashboard/util.py	Thu Sep 06 01:39:28 2012 -0500
+@@ -31,6 +31,8 @@
+ from wsgiref.util import setup_testing_defaults
+ 
+ from trac.core import Component, implements, ExtensionPoint
++from trac.util.datefmt import format_datetime, pretty_timedelta, to_datetime, \
++       user_time
+ from trac.web.api import Request
+ from trac.web.chrome import add_link, Chrome
+ from trac.web.main import RequestDispatcher
+@@ -176,6 +178,30 @@
+     )
+ 
+ #------------------------------------------------------
++#    Date and time functions
++#------------------------------------------------------
++
++def datetime_data(req, date):
++    """Detailed information about datetime object.
++    """
++    absolute = user_time(req, format_datetime, date, format="%a %b %d %Y")
++    dow, m, d, y = absolute.split()
++    absolute = user_time(req, format_datetime, date)
++    relative = pretty_timedelta(date)
++    offset, unit = relative.split()
++    return {
++            'absolute' : absolute,
++            'year' : y,
++            'month' : m,
++            'day': d,
++            'dayofweek' : dow,
++            'timedelta' : relative,
++            'offset': offset,
++            'unit' : unit,
++            'now' : to_datetime(None, getattr(req, 'tz', None))
++        }
++
++#------------------------------------------------------
+ #    Miscellaneous
+ #------------------------------------------------------
+ 
+diff -r 4fddc33d1fc2 bhdashboard/web_ui.py
+--- a/bhdashboard/web_ui.py	Wed Sep 05 22:57:52 2012 -0500
++++ b/bhdashboard/web_ui.py	Thu Sep 06 01:39:28 2012 -0500
+@@ -47,6 +47,7 @@
+ 
+ from bhdashboard.api import DashboardSystem, InvalidIdentifier
+ from bhdashboard import _json
++from bhdashboard.util import datetime_data
+ 
+ class DashboardModule(Component):
+     """Web frontend for dashboard infrastructure.
+@@ -71,6 +72,7 @@
+         """
+         if data is not None :
+             data['bhdb'] = DashboardChrome(self.env)
++            data['datetime_data'] = lambda date: datetime_data(req, date)
+         for item in req.chrome['nav'].get('mainnav', []):
+             self.log.debug('%s' % (item,))
+             if item['name'] == 'tickets':