111 lines
4.0 KiB
HTML
111 lines
4.0 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
<title>transmet</title>
|
|
|
|
<!-- Bootstrap -->
|
|
<link href="/css/bootstrap.min.css" rel="stylesheet">
|
|
<link href="/css/sticky-footer-navbar.css" rel="stylesheet">
|
|
<link href="/css/jquery-ui.min.css" rel="stylesheet">
|
|
<link href="/css/template.css" rel="stylesheet">
|
|
<link href="/css/signin.css" rel="stylesheet">
|
|
|
|
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
|
|
|
|
</head>
|
|
<body>
|
|
|
|
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
|
|
<div class="container">
|
|
<div class="navbar-header">
|
|
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
|
|
<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="/">transmet</a>
|
|
</div>
|
|
<div class="collapse navbar-collapse">
|
|
<ul class="nav navbar-nav">
|
|
{{if .user}}
|
|
<li><a href="/news/add">add</a></li>
|
|
<li><a href="/news/export">export</a></li>
|
|
<li><a href="/categories">categories</a></li>
|
|
{{end}}
|
|
</ul>
|
|
<ul class="nav navbar-nav navbar-right">
|
|
{{if .user}}
|
|
<li><a href="">{{.user.Username}}</a></li>
|
|
<li><form method="POST" action="/logout">{{ .csrfField }}<input type="submit" value="Logout" class="btn-sm btn-primary btn-block" /></form></li>
|
|
{{else}}
|
|
<li><a href="/login">Log in</a></li>
|
|
{{end}}
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
<div class="container">
|
|
{{template "body" .}}
|
|
</div>
|
|
|
|
<footer class="footer">
|
|
<div class="container">
|
|
<p class="text-muted">Powered by <a href="https://github.com/dballard/transmet">transmet</a> <img src="/favicon.ico" />
|
|
</div>
|
|
</footer>
|
|
|
|
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
|
|
<script src="/js/jquery.min.js"></script>
|
|
<!-- Include all compiled plugins (below), or include individual files as needed -->
|
|
<script src="/js/bootstrap.min.js"></script>
|
|
<script src="/js/jquery.confirm.min.js"></script>
|
|
<script src="/js/jquery-ui.min.js"></script>
|
|
<script src="/js/funcs.js"></script>
|
|
</body>
|
|
</html>
|
|
|
|
{{define "flashes"}}
|
|
<div class="messages">
|
|
{{range .flashes.info}}
|
|
<div class="alert alert-success" role="alert">Info: {{.}}</div>
|
|
{{end}}
|
|
{{range .flashes.error}}
|
|
<div class="alert alert-danger" role="alert">Error: {{.}}</div>
|
|
{{end}}
|
|
</div>
|
|
{{end}}
|
|
|
|
|
|
<!-- reused widgets -->
|
|
|
|
<!--
|
|
Print a full <select> of categories with one selected
|
|
categories: a flat map of categories ordered by parent
|
|
id: the category id that should be selected (or -1 for none)
|
|
fieldName: the html form field name
|
|
-->
|
|
{{define "select-category"}}
|
|
<select class="form-control add-category category-change-parent filter-category" name="{{ .fieldName }}" >
|
|
<option value="none" {{if not .category.Parent.Valid}} selected="true"{{end}}>-- None --</option>
|
|
{{range $category := .categories}}
|
|
{{template "option-category" dict "category" $category "id" $.id}}
|
|
{{end}}
|
|
</select>
|
|
{{end}}
|
|
<!--
|
|
print all the <option> inside a select for a category and its children
|
|
category: the category to print as an option (and it's nested children)
|
|
id: the category id that should be selected
|
|
-->
|
|
{{define "option-category"}}
|
|
<option value="{{.category.Id}}" {{if eq .id .category.Id}}selected="true"{{end}}>{{.category.ToString}}</option>
|
|
{{range $child := .category.Children}}
|
|
{{template "option-category" dict "category" $child "id" $.id}}
|
|
{{end}}
|
|
{{end}} |