From 210c7b6c0eb4dac9bd7cbd9025dcb8032320dbde Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Sat, 21 Sep 2013 12:01:51 +0200 Subject: Added index page --- main.go | 6 ++++++ tpls.go | 2 ++ tpls/index.tpl | 7 +++++++ tpls/master.tpl | 5 +++-- 4 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 tpls/index.tpl diff --git a/main.go b/main.go index 503453f..b44e7e5 100644 --- a/main.go +++ b/main.go @@ -7,6 +7,7 @@ import ( "github.com/gorilla/mux" "github.com/gorilla/sessions" "github.com/kch42/mailremind/confhelper" + "github.com/kch42/mailremind/model" _ "github.com/kch42/mailremind/model/mysql" "github.com/kch42/simpleconf" "log" @@ -82,6 +83,7 @@ func main() { router.HandleFunc("/jobedit", mkHttpHandler(jobedit, tplJobedit)) router.HandleFunc("/jobedit/{ID}", mkHttpHandler(jobedit, tplJobedit)) router.HandleFunc("/settings", mkHttpHandler(settings, tplSettings)) + router.HandleFunc("/", mkHttpHandler(index, tplIndex)) http.Handle("/", router) @@ -89,3 +91,7 @@ func main() { log.Fatalf("Could not ListenAndServe: %s", err) } } + +func index(user model.User, sess *sessions.Session, req *http.Request) (interface{}, model.User) { + return nil, user +} diff --git a/tpls.go b/tpls.go index 92cbeb0..a861664 100644 --- a/tpls.go +++ b/tpls.go @@ -27,6 +27,7 @@ var ( tplJobs *template.Template tplJobedit *template.Template tplSettings *template.Template + tplIndex *template.Template ) func initTpls() { @@ -41,6 +42,7 @@ func initTpls() { tplJobs = loadTpl(tplpath, "jobs") tplJobedit = loadTpl(tplpath, "jobedit") tplSettings = loadTpl(tplpath, "settings") + tplIndex = loadTpl(tplpath, "index") } type msgTpldata struct { diff --git a/tpls/index.tpl b/tpls/index.tpl new file mode 100644 index 0000000..af205de --- /dev/null +++ b/tpls/index.tpl @@ -0,0 +1,7 @@ +{{define "title"}}Start{{end}} + +{{define "content"}} +{{/* START EDITING HERE */}} + You should edit this start page to provide some info of your mailremind installation. Do so by editing the tpls/index.tpl template file. You need to restart mailremind to reload the template. +{{/* STOP EDITING HERE */}} +{{end}} \ No newline at end of file diff --git a/tpls/master.tpl b/tpls/master.tpl index 7d6a249..7fcd100 100644 --- a/tpls/master.tpl +++ b/tpls/master.tpl @@ -28,8 +28,9 @@ -- cgit v1.2.3-54-g00ecf