Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // BasePage is the main page template. BasePage = template.Must(template.New("BasePage").Parse(`<!DOCTYPE HTML> <html> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <meta charset="utf8" /> <link rel="stylesheet" href="/assets/style.css" /> <link rel="author" href="/humans.txt" /> <title>{{.Title}}</title> <script type="text/javascript" nonce="{{.Nonce}}"> window.CSRF_TOKEN = "{{.CSRFToken}}"; </script> </head> <body> <header> <nav> <ul> <li class="home"><a href="/">Home</a></li> <li class="posts"><a href="/posts">Posts</a></li> {{if .LoggedIn}} <li class="logout"><a href="/logout?token={{.CSRFToken}}">Logout</a></li> {{else}} <li class="login"><a href="/login">Log In</a></li> <li class="register"><a href="/register">Register</a></li> {{end}} </ul> </nav> </header> <div id="body">{{block "body" .Body}}{{end}}</div> </body> </html> {{define "secondary-menu"}} <nav> <ul> {{block "secondary-menu-items" .}}{{end}} </ul> </nav> {{end}} `)) )
Functions ¶
func EntityLoaderMiddleware ¶
func EntityLoaderMiddleware(loader EntityLoader) negroni.Handler
EntityLoaderMiddleware creates a middleware that loads an entity from the URL.
Types ¶
type AccessChecker ¶
AccessChecker checks if the current account has a permission.
type Data ¶
type Data struct { Title string Nonce string CSRFToken string LoggedIn bool Access AccessChecker Body interface{} }
Data is the page data for BasePage.
type EntityLoader ¶
EntityLoader loads an entity.
Click to show internal directories.
Click to hide internal directories.