diff --git a/integrations/branches_test.go b/integrations/branches_test.go index b2230e7031..aa4df6ac6a 100644 --- a/integrations/branches_test.go +++ b/integrations/branches_test.go @@ -9,7 +9,6 @@ import ( "net/url" "testing" - "github.com/PuerkitoBio/goquery" "github.com/stretchr/testify/assert" "github.com/unknwon/i18n" ) @@ -62,7 +61,7 @@ func branchAction(t *testing.T, button string) (*HTMLDoc, string) { } req = NewRequestWithValues(t, "POST", link, map[string]string{ - "_csrf": getCsrf(t, htmlDoc.doc), + "_csrf": htmlDoc.GetCSRF(), }) session.MakeRequest(t, req, http.StatusOK) @@ -73,9 +72,3 @@ func branchAction(t *testing.T, button string) (*HTMLDoc, string) { return NewHTMLParser(t, resp.Body), url.Query().Get("name") } - -func getCsrf(t *testing.T, doc *goquery.Document) string { - csrf, exists := doc.Find("meta[name=\"_csrf\"]").Attr("content") - assert.True(t, exists) - return csrf -} diff --git a/integrations/html_helper.go b/integrations/html_helper.go index 6dc806a76e..001fc9a05b 100644 --- a/integrations/html_helper.go +++ b/integrations/html_helper.go @@ -44,7 +44,7 @@ func (doc *HTMLDoc) Find(selector string) *goquery.Selection { return doc.doc.Find(selector) } -// GetCSRF for get CSRC token value from input +// GetCSRF for getting CSRF token value from input func (doc *HTMLDoc) GetCSRF() string { return doc.GetInputValueByName("_csrf") } diff --git a/integrations/pull_create_test.go b/integrations/pull_create_test.go index 5a0a3eda08..948c0b9ce2 100644 --- a/integrations/pull_create_test.go +++ b/integrations/pull_create_test.go @@ -114,7 +114,7 @@ func testUIDeleteBranch(t *testing.T, session *TestSession, ownerName, repoName, htmlDoc := NewHTMLParser(t, resp.Body) req = NewRequestWithValues(t, "POST", relURL+"/delete", map[string]string{ - "_csrf": getCsrf(t, htmlDoc.doc), + "_csrf": htmlDoc.GetCSRF(), "name": branchName, }) session.MakeRequest(t, req, http.StatusOK) @@ -127,7 +127,7 @@ func testDeleteRepository(t *testing.T, session *TestSession, ownerName, repoNam htmlDoc := NewHTMLParser(t, resp.Body) req = NewRequestWithValues(t, "POST", relURL+"?action=delete", map[string]string{ - "_csrf": getCsrf(t, htmlDoc.doc), + "_csrf": htmlDoc.GetCSRF(), "repo_name": repoName, }) session.MakeRequest(t, req, http.StatusFound) diff --git a/modules/context/context.go b/modules/context/context.go index 383a69ad63..f652d3845a 100644 --- a/modules/context/context.go +++ b/modules/context/context.go @@ -645,7 +645,7 @@ func Contexter() func(next http.Handler) http.Handler { "CurrentURL": setting.AppSubURL + req.URL.RequestURI(), "PageStartTime": startTime, "Link": link, - "IsProd": setting.IsProd, + "RunModeIsProd": setting.IsProd, }, } // PageData is passed by reference, and it will be rendered to `window.config.pageData` in `head.tmpl` for JavaScript modules diff --git a/routers/web/repo/projects.go b/routers/web/repo/projects.go index 2490efc923..e98d189c1a 100644 --- a/routers/web/repo/projects.go +++ b/routers/web/repo/projects.go @@ -205,7 +205,6 @@ func DeleteProject(ctx *context.Context) { // EditProject allows a project to be edited func EditProject(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.projects.edit") - ctx.Data["PageIsProjects"] = true ctx.Data["PageIsEditProjects"] = true ctx.Data["CanWriteProjects"] = ctx.Repo.Permission.CanWrite(models.UnitTypeProjects) @@ -233,7 +232,6 @@ func EditProject(ctx *context.Context) { func EditProjectPost(ctx *context.Context) { form := web.GetForm(ctx).(*forms.CreateProjectForm) ctx.Data["Title"] = ctx.Tr("repo.projects.edit") - ctx.Data["PageIsProjects"] = true ctx.Data["PageIsEditProjects"] = true ctx.Data["CanWriteProjects"] = ctx.Repo.Permission.CanWrite(models.UnitTypeProjects) @@ -335,8 +333,6 @@ func ViewProject(ctx *context.Context) { ctx.Data["CanWriteProjects"] = ctx.Repo.Permission.CanWrite(models.UnitTypeProjects) ctx.Data["Project"] = project ctx.Data["Boards"] = boards - ctx.Data["PageIsProjects"] = true - ctx.Data["RequiresDraggable"] = true ctx.HTML(http.StatusOK, tplProjectsView) } diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl index 80bb121c6b..23d1190d94 100644 --- a/templates/base/head.tmpl +++ b/templates/base/head.tmpl @@ -3,7 +3,7 @@ - {{if .Title}}{{.Title | RenderEmojiPlain}} - {{end}} {{if .Repository.Name}}{{.Repository.Name}} - {{end}}{{AppName}} + {{if .Title}}{{.Title | RenderEmojiPlain}} - {{end}} {{if .Repository.Name}}{{.Repository.Name}} - {{end}}{{AppName}} @@ -11,7 +11,6 @@ - {{if .GoGetImport}} @@ -19,25 +18,17 @@ diff --git a/templates/repo/projects/list.tmpl b/templates/repo/projects/list.tmpl index ec7370709f..f152d20915 100644 --- a/templates/repo/projects/list.tmpl +++ b/templates/repo/projects/list.tmpl @@ -1,5 +1,5 @@ {{template "base/head" .}} -
+
{{template "repo/header" .}}