create basic frontend

This commit is contained in:
sentriz
2019-04-15 23:59:04 +01:00
parent 87efb3b3c5
commit 64fb0fdf82
17 changed files with 372 additions and 22 deletions

View File

@@ -0,0 +1,12 @@
{{ define "title" }}home{{ end }}
{{ define "user" }}
<div class="padded box mono">
<div>
<span><u>create new user</u></span>
</div>
<div class="right">
<span class="pre">howdy</span><br/>
</div>
</div>
{{ end }}

34
templates/admin/home.tmpl Normal file
View File

@@ -0,0 +1,34 @@
{{ define "title" }}home{{ end }}
{{ define "user" }}
<div class="padded box mono">
<div>
<span><u>stats</u></span>
</div>
<div class="right">
<span class="pre">artists: {{ printf "%7v" .ArtistCount }}</span><br/>
<span class="pre">albums: {{ printf "%7v" .AlbumCount }}</span><br/>
<span class="pre">tracks: {{ printf "%7v" .TrackCount }}</span>
</div>
</div>
<div class="padded box mono">
<div>
<span><u>last.fm</u></span>
</div>
<div class="right">
<span class="pre">unlinked</span><br/>
</div>
</div>
<div class="padded box mono">
<div>
<span><u>users</u></span>
</div>
<div class="right">
{{ range $user := .Users }}
<span class="pre">{{ $user.Name }} <span class="light">created</span> <u>{{ $user.CreatedAt.Format "Jan 02, 2006" }}</u> <a href="/admin/change_password">change password</a></span><br/>
{{ end }}
<br>
<a href="/admin/create_user" class="button">create new</a>
</div>
</div>
{{ end }}

View File

@@ -0,0 +1,12 @@
{{ define "title" }}gonic{{ end }}
{{ define "content" }}
<div class="light">
<span>login</span>
</div>
<form id="login-form" action="/admin/authenticate" method="post">
<input type="text" id="username" name="username" placeholder="username">
<input type="password" id="password" name="password" placeholder="password">
<input type="submit" value="login">
</form>
{{ end }}

30
templates/layout.tmpl Normal file
View File

@@ -0,0 +1,30 @@
{{ define "layout" }}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>{{ template "title" }}</title>
<link rel="stylesheet" href="/admin/static/stylesheets/awsm.css">
<link rel="stylesheet" href="/admin/static/stylesheets/main.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div>
<div id="header">
<img src="/admin/static/images/gonic.png">
</div>
<div id="content">
{{ if .Flashes }}
<div id="flashes">
<p><b>warning:</b> {{ index .Flashes 0 }}</p>
</div>
{{ end }}
{{ template "content" . }}
</div>
</div>
<div id="footer" class="padded">
<p>senan kelly, 2019 &#124; <a href="https://github.com/sentriz/gonic">github</a></p>
</div>
</body>
</html>
{{ end }}

8
templates/user.tmpl Normal file
View File

@@ -0,0 +1,8 @@
{{ define "title" }}home{{ end }}
{{ define "content" }}
<div class="light right">
<span>welcome <u>{{ .Username }}</u> &#124; <a href="/admin/logout">logout</a></span>
</div>
{{ template "user" . }}
{{ end }}