diff options
author | Lars Wirzenius <liw@liw.fi> | 2016-03-26 10:48:26 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2016-03-26 10:48:26 +0200 |
commit | 75077578d98bc1dad707b5bdd0954895a1fcf4b2 (patch) | |
tree | 35516e07ec40aa472c53b29d69901d673eba26f4 | |
parent | b501bc246f5924e677c7636174f834392b8677dc (diff) | |
download | distix-75077578d98bc1dad707b5bdd0954895a1fcf4b2.tar.gz |
Put update timestamp on generated HTML pages
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | distixlib/distix.css | 5 | ||||
-rw-r--r-- | distixlib/plugins/html_plugin.py | 9 | ||||
-rw-r--r-- | distixlib/templates/closed.html.j2 | 3 | ||||
-rw-r--r-- | distixlib/templates/index.html.j2 | 3 | ||||
-rw-r--r-- | distixlib/templates/ticket.html.j2 | 3 |
6 files changed, 25 insertions, 0 deletions
@@ -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 %} </ul> + <div class="footer"> + <p>Updated {{ timestamp }}. + </div> </body> </html> 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 @@ <p><a href="closed.html">Closed tickets</a></p> + <div class="footer"> + <p>Updated {{ timestamp }}. + </div> </body> </html> 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 @@ <pre>{{ msg }}</pre> {% endfor %} + <div class="footer"> + <p>Updated {{ timestamp }}. + </div> </body> </html> |