From d924b577d1d5bbaebeb2ddcc87d06ea99be79d3d Mon Sep 17 00:00:00 2001 From: Las Zenow Date: Wed, 15 Aug 2012 15:11:52 +0200 Subject: [PATCH] Move templates --- LICENSE | 13 +++++++++++++ template.go | 12 +++++++++++- about.html => templates/about.html | 0 book.html => templates/book.html | 0 footer.html => templates/footer.html | 0 header.html => templates/header.html | 0 index.html => templates/index.html | 0 search.html => templates/search.html | 0 upload.html => templates/upload.html | 0 9 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 LICENSE rename about.html => templates/about.html (100%) rename book.html => templates/book.html (100%) rename footer.html => templates/footer.html (100%) rename header.html => templates/header.html (100%) rename index.html => templates/index.html (100%) rename search.html => templates/search.html (100%) rename upload.html => templates/upload.html (100%) diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..5c93f45 --- /dev/null +++ b/LICENSE @@ -0,0 +1,13 @@ + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + + Copyright (C) 2004 Sam Hocevar + + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. You just DO WHAT THE FUCK YOU WANT TO. diff --git a/template.go b/template.go index 358a1b2..ab0b5e1 100644 --- a/template.go +++ b/template.go @@ -5,9 +5,19 @@ import ( "net/http" ) +const ( + TEMPLATE_DIR = "templates/" +) + func loadTemplate(w http.ResponseWriter, tmpl string, data interface{}) { // TODO: when finish devel conver to global: - var templates = template.Must(template.ParseFiles("header.html", "footer.html", "index.html", "about.html", "book.html", "search.html", "upload.html")) + var templates = template.Must(template.ParseFiles(TEMPLATE_DIR + "header.html", + TEMPLATE_DIR + "footer.html", + TEMPLATE_DIR + "index.html", + TEMPLATE_DIR + "about.html", + TEMPLATE_DIR + "book.html", + TEMPLATE_DIR + "search.html", + TEMPLATE_DIR + "upload.html")) err := templates.ExecuteTemplate(w, tmpl+".html", data) if err != nil { diff --git a/about.html b/templates/about.html similarity index 100% rename from about.html rename to templates/about.html diff --git a/book.html b/templates/book.html similarity index 100% rename from book.html rename to templates/book.html diff --git a/footer.html b/templates/footer.html similarity index 100% rename from footer.html rename to templates/footer.html diff --git a/header.html b/templates/header.html similarity index 100% rename from header.html rename to templates/header.html diff --git a/index.html b/templates/index.html similarity index 100% rename from index.html rename to templates/index.html diff --git a/search.html b/templates/search.html similarity index 100% rename from search.html rename to templates/search.html diff --git a/upload.html b/templates/upload.html similarity index 100% rename from upload.html rename to templates/upload.html