--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/candolint/uimodules.py Wed Jun 15 15:48:54 2016 +0800
+from tornado.web import UIModule
+ def render(self, value):
+ datetime = value.isoformat() + 'Z'
+ text = value.strftime('%Y-%m-%d %H:%M:%S') + ' UTC'
+ return self.render_string('ui/time.html', datetime=datetime, title=text, text=text)
--- a/templates/check.html Wed Jun 15 01:44:31 2016 +0800
+++ b/templates/check.html Wed Jun 15 15:48:54 2016 +0800
<div class="uk-width-medium-1-3">
<dl class="uk-description-list-horizontal list-terse">
- <dd>{{ check.started }}</dd>
+ <dd>{% module Time(value=check.started) %}</dd>
- <dd>{{ check.finished }}</dd>
+ <dd>{% module Time(value=check.finished) %}</dd>
<dd>{{ check.finished - check.started }}</dd>
--- a/templates/index.html Wed Jun 15 01:44:31 2016 +0800
+++ b/templates/index.html Wed Jun 15 15:48:54 2016 +0800
<td>{{ change.rev }}:{{ change.node[:12] }} {{ change.branch }}</td>
- <td>{{ check.started }}</td>
- <td>{{ check.finished }}</td>
+ <td>{% module Time(value=check.started) %}</td>
+ <td>{% module Time(value=check.finished) %}</td>
<td>{{ check.finished - check.started }}</td>
--- a/templates/project.html Wed Jun 15 01:44:31 2016 +0800
+++ b/templates/project.html Wed Jun 15 15:48:54 2016 +0800
<h2>{{ project.name }}</h2>
<dl class="uk-description-list-horizontal list-terse">
- <dd>{{ checks[0].finished }}</dd>
+ <dd>{% module Time(value=checks[0].finished) %}</dd>
<dd>{{ project.url }}</dd>
<div>{{ change.message }}</div>
<div>{{ change.author }}, <time>{{ change.date }}</time></div>
- <td>{{ check.started }}</td>
- <td>{{ check.finished }}</td>
+ <td>{% module Time(value=check.started) %}</td>
+ <td>{% module Time(value=check.finished) %}</td>
<td>{{ check.finished - check.started }}</td>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/ui/time.html Wed Jun 15 15:48:54 2016 +0800
+<time datetime="{{ datetime }}" title="{{ title }}">{{ text }}</time>
--- a/viewer.py Wed Jun 15 01:44:31 2016 +0800
+++ b/viewer.py Wed Jun 15 15:48:54 2016 +0800
from tornado.options import define, options
from tornado.web import Application, RequestHandler, URLSpec
+from candolint import uimodules
from candolint.models import database, Project, Change, Check
static_path=rel('static'),
template_path=rel('templates'),
super(CandolintViewer, self).__init__(handlers, **settings)