Make Application name configurable
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<nav class="navbar navbar-default">
|
||||
<div class="container-fluid">
|
||||
<!-- Brand and toggle get grouped for better mobile display -->
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="/">Kalorienmanager</a>
|
||||
</div>
|
||||
|
||||
<!-- Collect the nav links, forms, and other content for toggling -->
|
||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
{{ if .is_logged_in }}
|
||||
<li><a href="/data">Data</a></li>
|
||||
<li><a href="/menu">Menu</a></li>
|
||||
{{end}}
|
||||
{{ if not .is_logged_in }}
|
||||
<li><a href="/user/login"><span class="glyphicon glyphicon-off" aria-hidden="true"></span></a></li>
|
||||
{{end}}
|
||||
{{ if .is_logged_in }}
|
||||
<li class="active"><a href="/admin/">Admin<span class="sr-only">(current)</a></li>
|
||||
<li><a href="/user/logout"><span class="glyphicon glyphicon-off" aria-hidden="true"></span></a></li>
|
||||
{{end}}
|
||||
</ul>
|
||||
</div><!-- /.navbar-collapse -->
|
||||
</div><!-- /.container-fluid -->
|
||||
</nav>
|
||||
@@ -0,0 +1,11 @@
|
||||
<!--admin.html-->
|
||||
{{ define "kalorienmanager/admin.html" }}
|
||||
{{ template "header.html" .}}
|
||||
{{ template "admin-menu.html" .}}
|
||||
<ul class="nav nav-tabs">
|
||||
<li role="presentation" class="active"><a href="/admin/user">User</a></li>
|
||||
<li role="presentation"><a href="/admin/data">Data</a></li>
|
||||
</ul>
|
||||
|
||||
{{ template "footer.html" .}}
|
||||
{{ end }}
|
||||
@@ -0,0 +1,40 @@
|
||||
{{ define "kalorienmanager/create-user.html" }}
|
||||
{{ template "header.html" .}}
|
||||
{{ template "admin-menu.html" .}}
|
||||
<ul class="nav nav-tabs">
|
||||
<li role="presentation" class="active"><a href="/admin/user">User</a></li>
|
||||
<li role="presentation"><a href="/admin/data">Data</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="panel panel-default col-sm-6">
|
||||
<div class="panel-body">
|
||||
<!--If there's an error, display the error-->
|
||||
{{ if .ErrorTitle}}
|
||||
<p class="bg-danger">
|
||||
{{.ErrorTitle}}: {{.ErrorMessage}}
|
||||
</p>
|
||||
{{end}}
|
||||
<!--Create a form that POSTs to the `/u/register` route-->
|
||||
<form class="form" action="/admin/user/create" method="POST">
|
||||
<div class="form-group">
|
||||
<label for="username">Username</label>
|
||||
<input type="text" class="form-control" id="username" name="username" placeholder="Username">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="firstname">First Name</label>
|
||||
<input type="text" class="form-control" id="firstname" name="firstname" placeholder="First Name">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password">Password</label>
|
||||
<input type="password" name="password" class="form-control" id="password" placeholder="Password">
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input type="checkbox" class="form-check-input" id="admin">
|
||||
<label class="form-check-label" for="admin">Administrator</label>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Add</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{{ template "footer.html" .}}
|
||||
{{end}}
|
||||
@@ -0,0 +1,26 @@
|
||||
<!--footer.html-->
|
||||
|
||||
|
||||
<nav class="navbar navbar-default navbar-fixed-bottom">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<p class="col-lg-12">
|
||||
<ul class="list-inline">
|
||||
|
||||
<li><a href="/">Kalorienmanager</a></li>
|
||||
<li class="footer-menu-divider">⋅</li>
|
||||
{{ if not .is_logged_in }}
|
||||
<li><a href="/user/login">Login</a></li>
|
||||
{{end}}
|
||||
{{ if .is_logged_in }}
|
||||
<li><a href="/user/logout">Logout</a></li>
|
||||
{{end}}
|
||||
</ul>
|
||||
<p class="copyright text-muted small">Version {{ .version }} Copyright © 2018. All Rights Reserved</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,18 @@
|
||||
<!--header.html-->
|
||||
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<!--Use the `title` variable to set the title of the page-->
|
||||
<title>{{ .title }}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta charset="UTF-8">
|
||||
|
||||
<!--Use bootstrap to make the application look decent-->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
|
||||
<script async src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
|
||||
</head>
|
||||
|
||||
<body class="container">
|
||||
@@ -0,0 +1,17 @@
|
||||
<!--index.html-->
|
||||
{{ define "kalorienmanager/index.html" }}
|
||||
<!--Embed the header.html template at this location-->
|
||||
{{ template "header.html" .}}
|
||||
<!--Embed the menu.html template at this location-->
|
||||
{{ template "menu.html" . }}
|
||||
|
||||
<div>
|
||||
{{ if .InfoMessage}}
|
||||
<p class="bg-info">{{.InfoMessage}}</p>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
<!--Embed the footer.html template at this location-->
|
||||
{{ template "footer.html" .}}
|
||||
|
||||
{{ end }}
|
||||
@@ -0,0 +1,12 @@
|
||||
<!--login-successful.html-->
|
||||
|
||||
<!--Embed the header.html template at this location-->
|
||||
{{ template "header.html" .}}
|
||||
{{ template "menu.html" . }}
|
||||
|
||||
<div>
|
||||
You have successfully logged in.
|
||||
</div>
|
||||
|
||||
<!--Embed the footer.html template at this location-->
|
||||
{{ template "footer.html" .}}
|
||||
@@ -0,0 +1,35 @@
|
||||
<!--login.html-->
|
||||
|
||||
<!--Embed the header.html template at this location-->
|
||||
{{ template "header.html" .}}
|
||||
{{ template "menu.html" . }}
|
||||
|
||||
<h1>Login</h1>
|
||||
|
||||
|
||||
<div class="panel panel-default col-sm-6">
|
||||
<div class="panel-body">
|
||||
<!--If there's an error, display the error-->
|
||||
{{ if .ErrorTitle}}
|
||||
<p class="bg-danger">
|
||||
{{.ErrorTitle}}: {{.ErrorMessage}}
|
||||
</p>
|
||||
{{end}}
|
||||
<!--Create a form that POSTs to the `/u/login` route-->
|
||||
<form class="form" action="/user/login" method="POST">
|
||||
<div class="form-group">
|
||||
<label for="username">Username</label>
|
||||
<input type="text" class="form-control" id="username" name="username" placeholder="Username">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password">Password</label>
|
||||
<input type="password" class="form-control" id="password" name="password" placeholder="Password">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Login</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!--Embed the footer.html template at this location-->
|
||||
{{ template "footer.html" .}}
|
||||
@@ -0,0 +1,33 @@
|
||||
<nav class="navbar navbar-default">
|
||||
<div class="container-fluid">
|
||||
<!-- Brand and toggle get grouped for better mobile display -->
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="/">Kalorienmanager</a>
|
||||
</div>
|
||||
|
||||
<!-- Collect the nav links, forms, and other content for toggling -->
|
||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
{{ if .is_logged_in }}
|
||||
<li><a href="/data">Data</a></li>
|
||||
<li><a href="/menu">Menu</a></li>
|
||||
{{end}}
|
||||
{{ if not .is_logged_in }}
|
||||
<li><a href="/user/login"><span class="glyphicon glyphicon-off" aria-hidden="true"></span></a></li>
|
||||
{{end}}
|
||||
{{ if .is_admin }}
|
||||
<li><a href="/admin/">Admin</a></li>
|
||||
{{end}}
|
||||
{{ if .is_logged_in }}
|
||||
<li><a href="/user/logout"><span class="glyphicon glyphicon-off" aria-hidden="true"></span></a></li>
|
||||
{{end}}
|
||||
</ul>
|
||||
</div><!-- /.navbar-collapse -->
|
||||
</div><!-- /.container-fluid -->
|
||||
</nav>
|
||||
@@ -0,0 +1,63 @@
|
||||
{{ define "kalorienmanager/user-detail.html" }}
|
||||
{{ template "header.html" .}}
|
||||
{{ template "admin-menu.html" .}}
|
||||
<ul class="nav nav-tabs">
|
||||
<li role="presentation" class="active"><a href="/admin/user">User</a></li>
|
||||
<li role="presentation"><a href="/admin/data">Data</a></li>
|
||||
</ul>
|
||||
|
||||
<!--<div class="panel panel-default col-sm-6">-->
|
||||
<div class="panel-body">
|
||||
<!--If there's an error, display the error-->
|
||||
{{ if .ErrorTitle}}
|
||||
<p class="bg-danger">
|
||||
{{.ErrorTitle}}: {{.ErrorMessage}}
|
||||
</p>
|
||||
{{end}}
|
||||
<!--Create a form that POSTs to the `/u/register` route-->
|
||||
<!--<form class="form" action="/admin/user/view" method="POST">-->
|
||||
<form action="/admin/user/view" method="POST">
|
||||
<div class="form-group">
|
||||
<label for="username">Username</label>
|
||||
{{ if .payload.Username }}
|
||||
<input type="text" class="form-control" id="username" name="username" value={{.payload.Username}}>
|
||||
{{ else }}
|
||||
<input type="text" class="form-control" id="username" name="username" placeholder="Username">
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="firstname">First Name</label>
|
||||
{{ if .payload.Firstname }}
|
||||
<input type="text" class="form-control" id="firstname" name="firstname" value={{.payload.Firstname}}>
|
||||
{{ else }}
|
||||
<input type="text" class="form-control" id="firstname" name="firstname" placeholder="First Name">
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="lastname">Last Name</label>
|
||||
{{ if .payload.Lastname }}
|
||||
<input type="text" class="form-control" id="lastname" name="lastname" value={{.payload.Lastname}}>
|
||||
{{ else }}
|
||||
<input type="text" class="form-control" id="lastname" name="lastname" placeholder="Last Name">
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password">Password</label>
|
||||
<input type="password" name="password" class="form-control" id="password" placeholder="Password">
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input type="checkbox" class="form-check-input" value="true" name="admin" id="admin" {{ if .payload.IsAdmin }}checked{{end}}>
|
||||
<label class="form-check-label" for="admin">Administrator</label>
|
||||
</div>
|
||||
<input type="hidden" name="userid" id="userid" value={{.payload.ID.Hex}}>
|
||||
<button type="submit" class="btn btn-primary" name="action" value={{.action}}>{{.action}}</button>
|
||||
{{ if eq .action "Save" }}
|
||||
<button type="submit" class="btn btn-primary" name="action" value="Delete">Delete</button>
|
||||
{{ end }}
|
||||
</form>
|
||||
</div>
|
||||
<!--</div>-->
|
||||
{{ template "footer.html" .}}
|
||||
{{end}}
|
||||
@@ -0,0 +1,32 @@
|
||||
{{ define "kalorienmanager/users.html" }}
|
||||
{{ template "header.html" .}}
|
||||
{{ template "admin-menu.html" .}}
|
||||
<ul class="nav nav-tabs">
|
||||
<li role="presentation" class="active"><a href="/admin/user">User</a></li>
|
||||
<li role="presentation"><a href="/admin/data">Data</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="panel panel-default container">
|
||||
<table class="table">
|
||||
<tr><th>Username</th><th>First Name</th><th>Last Name</th><th>Administrator</th></tr>
|
||||
{{range .payload }}
|
||||
<tr>
|
||||
<td><a href="/admin/user/view/{{.ID.Hex}}">{{.Username}}</a></td>
|
||||
<td>{{.Firstname}}</td>
|
||||
<td>{{.Lastname}}</td>
|
||||
{{ if .IsAdmin}}
|
||||
<td><span class="glyphicon glyphicon-ok" aria-hidden="true"></span></td>
|
||||
{{end}}
|
||||
{{ if not .IsAdmin }}
|
||||
<td><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></td>
|
||||
{{end}}
|
||||
</tr>
|
||||
{{end}}
|
||||
</table>
|
||||
<div class="panel-body">
|
||||
<a href="/admin/user/create">Add entry</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ template "footer.html" .}}
|
||||
{{end}}
|
||||
Reference in New Issue
Block a user