summaryrefslogtreecommitdiff
path: root/views/head.pug
blob: 294a911e71e9475daa92c7757365a4e2a865c575 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
//- vim:ts=4:sw=4:

meta(name="viewport" content="width=device-width,height=device-height,initial-scale=1")
link(rel="icon" type="image/svg+xml" href="/favicon.svg")
link(rel="stylesheet" href="/fonts/fonts.css")
link(rel="stylesheet" href="/style.css")

link(rel="preload" as="font" type="font/woff2" crossorigin href="/fonts/SourceSerif4-Regular.woff2")
link(rel="preload" as="font" type="font/woff2" crossorigin href="/fonts/SourceSerif4-Semibold.woff2")
link(rel="preload" as="font" type="font/woff2" crossorigin href="/fonts/SourceSerif4-It.woff2")
link(rel="preload" as="font" type="font/woff2" crossorigin href="/fonts/SourceSans3-Regular.woff2")
//- link(rel="preload" as="font" type="font/woff2" crossorigin href="/fonts/Dingbats.woff2")
//- link(rel="preload" as="font" type="font/woff2" crossorigin href="/fonts/NotoEmoji.woff2")

mixin forumpost(row,show_buttons)
	.post
		.head
			.from: a(href="/user/"+row.author_name)= row.author_name
			.time= row.ctime
				if row.edited
					|
					| (edited #{row.mtime})
		.body!= row.body
	if show_buttons && user
		.edit
			if row.author_id === user.user_id
				| #[a(href="/forum/edit/"+row.post_id) Edit]
				|
			| #[a(href="/forum/reply/"+row.post_id) Reply]

mixin gametable(status,table,hide_title=0)
	table
		tr
			th ID
			unless hide_title
				th Title
			th Scenario
			th Players
			th Description
			case status
				when 0
					th Created
				when 1
					th Changed
					th Turn
				when 2
					th Finished
					th Result
			th
		each row in table
			tr
				td= row.game_id
				unless hide_title
					td.w: a(href="/info/"+row.title_id)= row.title_name
				td.w= row.scenario
				td!= row.player_names
				td= row.description
				case status
					when 0
						td.w= row.ctime
					when 1
						td.w= row.mtime
						if (row.is_active)
							td.is_active= row.active
						else
							td= row.active
					when 2
						td.w= row.mtime
						td= row.result
				td.command
					if status === 0
						a(href="/join/"+row.game_id) Join
					else
						- let cmd = status === 1 ? "Play" : "View"
						if row.is_yours
							if row.is_shared
								a(href="/join/"+row.game_id)= cmd
							else
								a(href=`/${row.title_id}/play:${row.game_id}:${row.your_role}`)= cmd
						else
							a(href=`/${row.title_id}/play:${row.game_id}`) View
		else
			tr
				case status
					when 0
						td(colspan=7-hide_title) No open games.
					when 1
						td(colspan=8-hide_title) No active games.
					when 2
						td(colspan=8-hide_title) No finished games.