summaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-10-13 22:23:59 +0200
committerTor Andersson <tor@ccxvii.net>2024-10-13 22:23:59 +0200
commit22d96bbd8d2f3c63328e0beb4e192eb9bf3d5ce3 (patch)
tree659ba958d21f3b3455b3a603111b861da3c14b69 /views
parentede55b317dea7915f4ced8b628d2b31262dc2847 (diff)
downloadserver-22d96bbd8d2f3c63328e0beb4e192eb9bf3d5ce3.tar.gz
Format human dates in view templates rather than in server queries.
Diffstat (limited to 'views')
-rw-r--r--views/contacts.pug2
-rw-r--r--views/forum_view.pug2
-rw-r--r--views/games_active.pug2
-rw-r--r--views/head.pug12
-rw-r--r--views/message_inbox.pug2
-rw-r--r--views/message_outbox.pug2
-rw-r--r--views/message_read.pug2
-rw-r--r--views/search_user.pug2
-rw-r--r--views/user.pug4
9 files changed, 15 insertions, 15 deletions
diff --git a/views/contacts.pug b/views/contacts.pug
index a3ca8d0..e3c8067 100644
--- a/views/contacts.pug
+++ b/views/contacts.pug
@@ -25,7 +25,7 @@ html
tr
td
a.black(href="/user/"+who.name)= who.name
- td.w= who.atime
+ td.w= human_date(who.atime)
td.w.r
a.blue(href="/message/send/"+who.name) &#x1f4dd;
a.red(href="/contacts/remove/"+who.name) &#x274c;
diff --git a/views/forum_view.pug b/views/forum_view.pug
index c82a2b4..017e49a 100644
--- a/views/forum_view.pug
+++ b/views/forum_view.pug
@@ -29,7 +29,7 @@ html
td
a.black(href="/forum/thread/"+row.thread_id)= row.subject
td.r= row.count
- td.w= row.mtime
+ td.w= human_date(row.mtime)
tfoot
tr
td(colspan=4)
diff --git a/views/games_active.pug b/views/games_active.pug
index eaa1076..f47ae6e 100644
--- a/views/games_active.pug
+++ b/views/games_active.pug
@@ -5,7 +5,7 @@
- let move_games = games.filter(game => game.status === 1 && game.is_opposed && game.your_turn)
- let solo_games = games.filter(game => game.status === 1 && !game.is_opposed)
- let finished_games = games.filter(game => game.status === 2)
-- move_games.sort((a,b)=>a.time_left-b.time_left)
+- move_games.sort((a,b)=> a.mtime < b.mtime ? -1 : a.mtime > b.mtime ? 1 : 0)
doctype html
html
head
diff --git a/views/head.pug b/views/head.pug
index 66e3f58..d9da995 100644
--- a/views/head.pug
+++ b/views/head.pug
@@ -28,10 +28,10 @@ mixin forumpost(row,show_buttons)
.post(id=row.post_id)
.head
.from: b: a.black(href="/user/"+row.author_name)= row.author_name
- .time= row.ctime
+ .time= human_date(row.ctime)
if row.edited
|
- | (edited #{row.mtime})
+ | (edited #{human_date(row.mtime)})
.body!= row.body
if show_buttons && user
.edit
@@ -120,9 +120,9 @@ mixin gamelist(list,hide_title=0)
div Players: <span class="error">Nobody</span>
case item.status
when 0
- div Created: #{item.ctime}
+ div Created: #{human_date(item.ctime)}
when 1
- div Last move: #{item.mtime}
+ div Last move: #{human_date(item.mtime)}
if item.your_turn
if item.time_left <= 0
div Time left: none.
@@ -131,10 +131,10 @@ mixin gamelist(list,hide_title=0)
else if item.time_left <= 5
div Time left: #{ item.time_left | 0 } days
when 2
- div Finished: #{item.mtime}
+ div Finished: #{human_date(item.mtime)}
div Result: !{item.result}
when 3
- div Finished: #{item.mtime}
+ div Finished: #{human_date(item.mtime)}
div Result: !{item.result}
unless hide_title
a(href=`/${item.title_id}`)
diff --git a/views/message_inbox.pug b/views/message_inbox.pug
index 4f02790..d8b6bc1 100644
--- a/views/message_inbox.pug
+++ b/views/message_inbox.pug
@@ -32,7 +32,7 @@ html
tr(class=row.is_read?"read":"unread")
td: a.black(href="/user/"+row.from_name)= row.from_name
td: a.black(href="/message/read/"+row.message_id)= subject
- td.w= row.time
+ td.w= human_date(row.time)
else
tr
td(colspan=3) No messages.
diff --git a/views/message_outbox.pug b/views/message_outbox.pug
index f42ef7f..40cc59d 100644
--- a/views/message_outbox.pug
+++ b/views/message_outbox.pug
@@ -35,7 +35,7 @@ html
tr
td: a.black(href="/user/"+row.to_name)= row.to_name
td.e: a.black(href="/message/read/"+row.message_id)= row.subject
- td.w= row.time
+ td.w= human_date(row.time)
else
tr
td(colspan=3) No messages.
diff --git a/views/message_read.pug b/views/message_read.pug
index f02c2f7..f429f86 100644
--- a/views/message_read.pug
+++ b/views/message_read.pug
@@ -25,7 +25,7 @@ html
div.
From: #[a(href="/user/"+message.from_name)= message.from_name]
To: #[a(href="/user/"+message.to_name)= message.to_name]
- div= message.time
+ div= human_date(message.time)
div.body!= message.body
p
diff --git a/views/search_user.pug b/views/search_user.pug
index bc67cf6..308cc41 100644
--- a/views/search_user.pug
+++ b/views/search_user.pug
@@ -22,7 +22,7 @@ html
tr
td
a.black(href="/user/"+who.name)= who.name
- td.w= who.atime
+ td.w= human_date(who.atime)
else
p.error Nobody found matching "#{search}".
diff --git a/views/user.pug b/views/user.pug
index 06fa91d..f3a30f0 100644
--- a/views/user.pug
+++ b/views/user.pug
@@ -26,8 +26,8 @@ html
if who.about
p.about= who.about
- p Member since #{who.ctime}.
- p Last seen #{who.atime}.
+ p Member since #{human_date(who.ctime)}.
+ p Last seen #{human_date(who.atime)}.
if user && (who.user_id !== user.user_id)
p