Changed the templating engine to a custom one. First bugged working example

This commit is contained in:
Jonas Hahn
2025-08-23 10:43:06 +02:00
parent 19e4834a9e
commit c9a3196ccb
15 changed files with 215 additions and 125 deletions

View File

@@ -11,96 +11,7 @@
<link rel="apple-touch-icon" href="/assets/favicon.ico">
<link rel="shortcut icon" href="/assets/favicon.ico">
<style>
body {
font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;
margin: 0;
padding: 0;
background: #f7f7f9;
color: #111
}
.container {
max-width: 800px;
margin: 0 auto;
padding: 16px
}
.card {
background: #fff;
border-radius: 12px;
padding: 16px;
margin: 12px 0;
box-shadow: 0 2px 6px rgba(0, 0, 0, .06)
}
.row {
display: flex;
gap: 8px;
flex-wrap: wrap
}
.btn {
display: inline-block;
padding: 10px 14px;
border-radius: 10px;
border: 1px solid #ddd;
background: #fafafa;
text-decoration: none
}
.btn-primary {
background: #111;
color: #fff;
border-color: #111
}
.input {
width: 100%;
padding: 10px;
border-radius: 10px;
border: 1px solid #ddd
}
.label {
font-size: 12px;
color: #444;
margin-bottom: 6px;
display: block
}
.header {
padding: 12px 16px;
background: #fff;
position: sticky;
top: 0;
border-bottom: 1px solid #eee
}
.nav a {
margin-right: 12px;
text-decoration: none;
color: #111
}
.small {
font-size: 12px;
color: #666
}
.list li {
padding: 8px 0;
border-bottom: 1px solid #f0f0f0
}
.badge {
display: inline-block;
padding: 2px 8px;
border-radius: 999px;
background: #eee;
font-size: 12px
}
</style>
<link rel="stylesheet" href="/assets/styles.css">
</head>
<body>
@@ -122,6 +33,7 @@
</div>
</div>
<div class="container">
<!-- This is shorthand for a define along with a template -->
{{block "content" .}}{{end}}
</div>
</body>

View File

@@ -1,4 +1,4 @@
{{define "enter"}}{{template "base" .}}{{end}}
{{define "title"}}Enter scores - QRank{{end}}
{{define "content"}}
<div class="card">
<h2>Enter a game</h2>

View File

@@ -1,4 +1,3 @@
{{define "history"}}{{template "base" .}}{{end}}
{{define "content"}}
<div class="card">
<h2>Global history</h2>

View File

@@ -1,4 +1,3 @@
{{define "leaderboard"}}{{template "base" .}}{{end}}
{{define "content"}}
<div class="card">
<h2>Leaderboard (by wins)</h2>

View File

@@ -1,4 +1,3 @@
{{define "login"}}{{template "base" .}}{{end}}
{{define "content"}}
<div class="card">
<h2>Sign in with your email</h2>

View File

@@ -1,4 +1,3 @@
{{define "sent"}}{{template "base" .}}{{end}}
{{define "content"}}
<div class="card">
<h2>Check the server logs</h2>

View File

@@ -1,4 +1,3 @@
{{define "user"}}{{template "base" .}}{{end}}
{{define "content"}}
<div class="card">
<h2>@{{.Viewed.Username}}</h2>