From 91cd350b631f721d1d6dd38bbafd3cac612e53c6 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Fri, 7 Apr 2017 21:44:55 -0400 Subject: repo/editor: fix wrong context for subdirectory (#4368) --- pkg/context/context.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'pkg/context/context.go') diff --git a/pkg/context/context.go b/pkg/context/context.go index 1457deec..abf4aaec 100644 --- a/pkg/context/context.go +++ b/pkg/context/context.go @@ -51,6 +51,19 @@ func (c *Context) PageIs(name string) { c.Data["PageIs"+name] = true } +// Require sets "Requirexxx" field in template data. +func (c *Context) Require(name string) { + c.Data["Require"+name] = true +} + +func (c *Context) RequireHighlightJS() { + c.Require("HighlightJS") +} + +func (c *Context) RequireSimpleMDE() { + c.Require("SimpleMDE") +} + // FormErr sets "Err_xxx" field in template data. func (c *Context) FormErr(names ...string) { for i := range names { -- cgit v1.2.3