more "complete" solution pages, a basic css theme, and a todo

master
dzwdz 2021-03-28 14:14:48 +00:00
parent bfe7c56bcf
commit e0307eb7e0
4 changed files with 79 additions and 3 deletions

View File

@ -3,6 +3,8 @@
$PAGE_BASE = "http://tilde.town/~dzwdz/golf"
$LOCAL_BASE = "/home/dzwdz/public_html/golf"
$HTML_HEAD, $HTML_FOOT = File.read('template.html').split('/snip/')
def all_files(event)
`ls -d /home/*/golf/#{event}/*`
.lines
@ -40,11 +42,24 @@ def challenge_page(event)
p_map[user] += [path]
end
file = File.new("#{$LOCAL_BASE}/#{event}/index.html", 'w')
# temporary
p_map["dzwdz1"] = p_map["dzwdz"]
p_map["dzwdz2"] = p_map["dzwdz"]
p_map["dzwdz3"] = p_map["dzwdz"]
file = File.new("#{$LOCAL_BASE}/#{event}/index.html", 'w')
file.write $HTML_HEAD
# challenge info
file.write "<div id=\"challenge_header\">"
file.write "<h1>firstone</h1><p>this is temporary aaa</p>"
file.write "</div>"
# solutions
file.write "<div id=\"solutions\">"
p_map.each do
|user, submissions|
file.print "<div class=\"user\"><h2>#{user}</h2><ul>"
file.print "<div class=\"card\"><h2>#{user}</h2><ul>"
submissions.each do
|path|
name = path.split('/')[5]
@ -53,13 +68,23 @@ def challenge_page(event)
# also it's a mess
file.print "<a href=\"#{$PAGE_BASE}/#{event}/mirror/#{user}/#{name}\">"
file.print "#{name}"
file.print "</a></li>"
file.print "</a> (#{File.size path}b)"
hint = path + '.hint'
# speaking of messes
if File.exists? hint
file.print "<a class=\"hint\" href=\"#{$PAGE_BASE}/#{event}/mirror/#{user}/#{name}.hint\">hint</a>"
end
file.print "</li>"
end
file.print "</ul></div>\n"
end
file.write "</div>"
file.write $HTML_FOOT
file.close
end
`cp style.css #{$LOCAL_BASE}/`
mirror 'firstone'
challenge_page 'firstone'

33
style.css 100644
View File

@ -0,0 +1,33 @@
/* i stole the colors from gruvbox */
body {
font-family: mono;
background: #32302f;
color: #f2e5bc;
}
a { color: #83a598 }
#solutions {
display: grid;
align-items: center;
grid-template-columns: repeat(auto-fit, minmax(25em, 1fr));
}
.card {
margin: .5em;
background: #504945;
padding: .3em;
}
.card ul {
padding: 0 1em 0 1em;
}
h2 {
margin: 0;
background: #b16286;
}
.hint {float: right}

12
template.html 100644
View File

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>~town golf</title>
<link rel="stylesheet" href="http://tilde.town/~dzwdz/golf/style.css">
</head>
<body>
/snip/
</body>
</html>

6
todo.txt 100644
View File

@ -0,0 +1,6 @@
for the submission page:
filter by language
highlight the winners
create the main page
create a page explaining how to join