From 7c5316b773629190d25089000b95c9e6ad6517a0 Mon Sep 17 00:00:00 2001 From: Ant Zucaro Date: Mon, 10 Sep 2012 22:01:54 -0400 Subject: [PATCH] Add localized time support (on hover). Without Javascript people will see the UTC time. With Javascript all of those UTC times will be changed to localtime (accounting for DST) via the epoch time of the object. --- xonstat/models.py | 3 +++ xonstat/templates/base.mako | 12 ++++++++++++ xonstat/templates/game_info.mako | 2 +- xonstat/templates/main_index.mako | 2 +- xonstat/templates/map_index.mako | 2 +- xonstat/templates/map_info.mako | 4 ++-- xonstat/templates/player_index.mako | 2 +- xonstat/templates/player_info.mako | 4 ++-- xonstat/templates/search.mako | 8 ++++---- xonstat/templates/server_index.mako | 2 +- xonstat/templates/server_info.mako | 4 ++-- 11 files changed, 30 insertions(+), 15 deletions(-) diff --git a/xonstat/models.py b/xonstat/models.py index b6ebca1..bbf8bf4 100644 --- a/xonstat/models.py +++ b/xonstat/models.py @@ -39,6 +39,9 @@ class Player(object): def to_dict(self): return {'player_id':self.player_id, 'name':self.nick.encode('utf-8')} + def epoch(self): + return timegm(self.create_dt.timetuple()) + class GameType(object): def __repr__(self): diff --git a/xonstat/templates/base.mako b/xonstat/templates/base.mako index 0386533..3d6af2d 100644 --- a/xonstat/templates/base.mako +++ b/xonstat/templates/base.mako @@ -47,8 +47,20 @@ <%block name="js"> + + + + +