From fee06a23bd74fcb537e4122efbbd78d3f9c8ee32 Mon Sep 17 00:00:00 2001 From: saturn4er Date: Sun, 3 Jul 2016 14:44:11 +0300 Subject: [PATCH 1/2] Add template prefix field to controller --- controller.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/controller.go b/controller.go index 85894275..df186731 100644 --- a/controller.go +++ b/controller.go @@ -71,6 +71,7 @@ type Controller struct { TplName string Layout string LayoutSections map[string]string // the key is the section name and the value is the template name + TplPrefix string TplExt string EnableRender bool @@ -226,6 +227,9 @@ func (c *Controller) renderTemplate() (bytes.Buffer, error) { var buf bytes.Buffer if c.TplName == "" { c.TplName = strings.ToLower(c.controllerName) + "/" + strings.ToLower(c.actionName) + "." + c.TplExt + if c.TplPrefix != "" { + c.TplName = c.TplPrefix + c.TplName + } } if BConfig.RunMode == DEV { buildFiles := []string{c.TplName} From 0943ef9e7403357288ef9d864a3d353748e9b35c Mon Sep 17 00:00:00 2001 From: saturn4er Date: Thu, 14 Jul 2016 11:48:49 +0300 Subject: [PATCH 2/2] Add TplPrefix to TplName also. --- controller.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/controller.go b/controller.go index df186731..4cfbf5be 100644 --- a/controller.go +++ b/controller.go @@ -227,9 +227,9 @@ func (c *Controller) renderTemplate() (bytes.Buffer, error) { var buf bytes.Buffer if c.TplName == "" { c.TplName = strings.ToLower(c.controllerName) + "/" + strings.ToLower(c.actionName) + "." + c.TplExt - if c.TplPrefix != "" { - c.TplName = c.TplPrefix + c.TplName - } + } + if c.TplPrefix != "" { + c.TplName = c.TplPrefix + c.TplName } if BConfig.RunMode == DEV { buildFiles := []string{c.TplName}