minimal template introducing

This commit is contained in:
Henrique Dias 2015-09-14 14:54:58 +01:00
parent 0bf1182c91
commit 4d07761bd5
5 changed files with 10 additions and 10 deletions

View File

@ -25,7 +25,7 @@ type Page struct {
// Render the page // Render the page
func (p *Page) Render(w http.ResponseWriter, templates ...string) (int, error) { func (p *Page) Render(w http.ResponseWriter, templates ...string) (int, error) {
templates = append(templates, "header", "footer") templates = append(templates, "base_full")
var tpl *template.Template var tpl *template.Template
for i, t := range templates { for i, t := range templates {

View File

@ -1,4 +1,3 @@
{{ define "header" }}
<!DOCTYPE html> <!DOCTYPE html>
<html class="no-js" lang="en"> <html class="no-js" lang="en">
<head> <head>
@ -21,4 +20,9 @@
<header class="site-header"> <header class="site-header">
Admin Admin
</header> </header>
{{ end }}
{{ template "content" . }}
<footer></footer>
</body>
</html>

View File

@ -0,0 +1 @@
{{ template "content" . }}

View File

@ -1,5 +0,0 @@
{{ define "footer" }}
<footer></footer>
</body>
</html>
{{ end }}

View File

@ -1,4 +1,4 @@
{{ template "header" . }} {{ define "content" }}
{{ with .Body }} {{ with .Body }}
<div class="content"> <div class="content">
@ -9,4 +9,4 @@
</div> </div>
{{ end }} {{ end }}
{{ template "footer" . }} {{ end }}