From 75077578d98bc1dad707b5bdd0954895a1fcf4b2 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sat, 26 Mar 2016 10:48:26 +0200 Subject: Put update timestamp on generated HTML pages --- NEWS | 2 ++ distixlib/distix.css | 5 +++++ distixlib/plugins/html_plugin.py | 9 +++++++++ distixlib/templates/closed.html.j2 | 3 +++ distixlib/templates/index.html.j2 | 3 +++ distixlib/templates/ticket.html.j2 | 3 +++ 6 files changed, 25 insertions(+) diff --git a/NEWS b/NEWS index b0aa27f..1be7a95 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,8 @@ distix, a distributed ticketing system. Version 0.6.1+git, not yet released ----------------------------------- +* `distix html` now puts an update timestamp on the HTML pages it + generates. Version 0.6.1, released 2016-03-25 --------------------------------- diff --git a/distixlib/distix.css b/distixlib/distix.css index 0faf8ae..1457210 100644 --- a/distixlib/distix.css +++ b/distixlib/distix.css @@ -33,3 +33,8 @@ span.links { ul.ticketlist a.ticketinlist { font-family: monospace; } + +div.footer { + margin-top: 2em; + border-top: solid black 1px; +} diff --git a/distixlib/plugins/html_plugin.py b/distixlib/plugins/html_plugin.py index 7e6b7d2..379a83c 100644 --- a/distixlib/plugins/html_plugin.py +++ b/distixlib/plugins/html_plugin.py @@ -19,6 +19,7 @@ import locale import markdown import os +import time import uuid import cliapp @@ -67,6 +68,7 @@ class StaticSite(object): self._repo = None self._ticket_store = None self._renderer = distixlib.HtmlRenderer() + self._timestamp = None def set_repository(self, repo): self._repo = repo @@ -76,6 +78,8 @@ class StaticSite(object): self._dirname = dirname def render(self): + self._timestamp = self._format_timestamp() + self._render_ticket_list( 'index.html.j2', 'index.html', self._ticket_is_open) self._render_ticket_list( @@ -84,10 +88,14 @@ class StaticSite(object): self._render_ticket(ticket) self._copy_static_files() + def _format_timestamp(self): + return time.strftime('%Y-%d-%m %H:%M:%S') + def _render_ticket_list(self, template, filename, condition): variables = { 'description_html': self._make_html(self._repo.get_description()), 'tickets': self._sort_tickets(self._get_tickets(condition)), + 'timestamp': self._timestamp, } html = self._renderer.render(template, variables) self._write_file(filename, html) @@ -111,6 +119,7 @@ class StaticSite(object): msg_renderer.summary(msg) for msg in thread.get_messages_in_date_order() ], + 'timestamp': self._timestamp, } html = self._renderer.render('ticket.html.j2', variables) diff --git a/distixlib/templates/closed.html.j2 b/distixlib/templates/closed.html.j2 index 5a7f84e..092e046 100644 --- a/distixlib/templates/closed.html.j2 +++ b/distixlib/templates/closed.html.j2 @@ -25,5 +25,8 @@ {% endfor %} + diff --git a/distixlib/templates/index.html.j2 b/distixlib/templates/index.html.j2 index 814ba21..60b3b22 100644 --- a/distixlib/templates/index.html.j2 +++ b/distixlib/templates/index.html.j2 @@ -24,5 +24,8 @@

Closed tickets

+ diff --git a/distixlib/templates/ticket.html.j2 b/distixlib/templates/ticket.html.j2 index 9d19b37..f31dbf2 100644 --- a/distixlib/templates/ticket.html.j2 +++ b/distixlib/templates/ticket.html.j2 @@ -22,5 +22,8 @@
{{ msg }}
{% endfor %} + -- cgit v1.2.1