add a bunch of frontend stuff
This commit is contained in:
parent
2586161abd
commit
bc85b7c340
30 changed files with 1459 additions and 136 deletions
19
web/templates/auth/login.tpl
Normal file
19
web/templates/auth/login.tpl
Normal file
|
@ -0,0 +1,19 @@
|
|||
{% extends 'base.tpl' %}
|
||||
{% block title %}
|
||||
Log in
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<div class="auth">
|
||||
<form method="post">
|
||||
<p>
|
||||
<label for="username">Username</label>
|
||||
<input type="text" name="username" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="username">Password</label>
|
||||
<input type="password" name="password" />
|
||||
</p>
|
||||
<input type="submit" value="Log in" />
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
13
web/templates/base.tpl
Normal file
13
web/templates/base.tpl
Normal file
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/style.css" />
|
||||
<title>{% block title %}Mercury{% endblock %}</title>
|
||||
</head>
|
||||
<body>
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
</body>
|
||||
</html>
|
28
web/templates/templates.go
Normal file
28
web/templates/templates.go
Normal file
|
@ -0,0 +1,28 @@
|
|||
package templates
|
||||
|
||||
import (
|
||||
"embed"
|
||||
|
||||
"emperror.dev/errors"
|
||||
"github.com/flosch/pongo2/v6"
|
||||
)
|
||||
|
||||
//go:embed *
|
||||
var fs embed.FS
|
||||
|
||||
func New(dev bool) (*pongo2.TemplateSet, error) {
|
||||
if dev {
|
||||
loader, err := pongo2.NewLocalFileSystemLoader("web/templates")
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "creating filesystem loader")
|
||||
}
|
||||
|
||||
ts := pongo2.NewSet("web", loader)
|
||||
ts.Debug = true
|
||||
return ts, nil
|
||||
}
|
||||
|
||||
loader := pongo2.NewFSLoader(fs)
|
||||
ts := pongo2.NewSet("web", loader)
|
||||
return ts, nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue