From 4d07761bd5c33cff496dc8e51769b525a6b1e359 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Mon, 14 Sep 2015 14:54:58 +0100 Subject: [PATCH] minimal template introducing --- page/page.go | 2 +- templates/{header.tmpl => base_full.tmpl} | 8 ++++++-- templates/base_minimal.tmpl | 1 + templates/footer.tmpl | 5 ----- templates/settings.tmpl | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) rename templates/{header.tmpl => base_full.tmpl} (92%) create mode 100644 templates/base_minimal.tmpl delete mode 100644 templates/footer.tmpl diff --git a/page/page.go b/page/page.go index 585b7c61..c8be31cc 100644 --- a/page/page.go +++ b/page/page.go @@ -25,7 +25,7 @@ type Page struct { // Render the page 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 for i, t := range templates { diff --git a/templates/header.tmpl b/templates/base_full.tmpl similarity index 92% rename from templates/header.tmpl rename to templates/base_full.tmpl index e94b6ea1..8ffdf5d0 100644 --- a/templates/header.tmpl +++ b/templates/base_full.tmpl @@ -1,4 +1,3 @@ -{{ define "header" }} @@ -21,4 +20,9 @@ -{{ end }} + +{{ template "content" . }} + + + + diff --git a/templates/base_minimal.tmpl b/templates/base_minimal.tmpl new file mode 100644 index 00000000..66e0068d --- /dev/null +++ b/templates/base_minimal.tmpl @@ -0,0 +1 @@ +{{ template "content" . }} diff --git a/templates/footer.tmpl b/templates/footer.tmpl deleted file mode 100644 index e2692fc3..00000000 --- a/templates/footer.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -{{ define "footer" }} - - - -{{ end }} diff --git a/templates/settings.tmpl b/templates/settings.tmpl index de3b9419..7dc8c79f 100644 --- a/templates/settings.tmpl +++ b/templates/settings.tmpl @@ -1,4 +1,4 @@ -{{ template "header" . }} +{{ define "content" }} {{ with .Body }}
@@ -9,4 +9,4 @@
{{ end }} -{{ template "footer" . }} +{{ end }}