From d4728fafafdd1d9a54d9337c7bddac086d58579c Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 19 Feb 2014 14:49:08 -0500 Subject: [PATCH] Able to config app name --- templates/base/head.tmpl | 2 +- web.go | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl index 9e48040f21..ac0b9594e6 100644 --- a/templates/base/head.tmpl +++ b/templates/base/head.tmpl @@ -16,7 +16,7 @@ - {{.Title}} | Gogs - Go Git Service + {{.Title}} | {{AppName}} \ No newline at end of file diff --git a/web.go b/web.go index f0bad8abd2..17e7cbfea1 100644 --- a/web.go +++ b/web.go @@ -6,6 +6,7 @@ package main import ( "fmt" + "html/template" "net/http" "github.com/codegangsta/cli" @@ -30,13 +31,19 @@ gogs web`, }, } +var AppHelpers template.FuncMap = map[string]interface{}{ + "AppName": func() string { + return utils.Cfg.MustValue("", "APP_NAME") + }, +} + func runWeb(*cli.Context) { log.Info("%s %s", utils.Cfg.MustValue("", "APP_NAME"), APP_VER) m := martini.Classic() // Middleware. - m.Use(render.Renderer()) + m.Use(render.Renderer(render.Options{Funcs: []template.FuncMap{AppHelpers}})) // Routers. m.Get("/", routers.Dashboard)