瀏覽代碼

Merge branch 'master' of https://gitote.in/gitote/gitote

Yoginth 7 年之前
父節點
當前提交
c82f74c17f

+ 0 - 2
cmd/web.go

@@ -258,11 +258,9 @@ func runWeb(c *cli.Context) error {
 	m.Group("/admin", func() {
 		m.Get("", admin.Dashboard)
 		m.Get("/analytics", admin.Analytics)
-		m.Get("/api", admin.AdminAPI)
 		m.Get("/config", admin.Config)
 		m.Post("/config/test_mail", admin.SendTestMail)
 		m.Get("/monitor", admin.Monitor)
-		m.Get("/inbox", admin.Inbox)
 		
 		m.Group("/news", func() {
 			m.Get("", admin.News)

+ 1 - 1
gitote.go

@@ -29,7 +29,7 @@ import (
 )
 
 // AppVer represents the version of Gitote
-const AppVer = "1.0.1-prod-rc.18"
+const AppVer = "1.0.1-prod-rc.20"
 
 // APIVer represents the API version of Gitote
 const APIVer = "v1"

+ 16 - 16
models/user.go

@@ -166,22 +166,22 @@ func (u *User) IDStr() string {
 
 func (u *User) APIFormat() *api.User {
 	return &api.User{
-		ID:               u.ID,
-		UserName:         u.Name,
-		Login:            u.Name,
-		FullName:         u.FullName,
-		Website:          u.Website,
-		Company:          u.Company,
-		Location:         u.Location,
-		Description:      u.Description,
-		Email:            u.Email,
-		IsAdmin:          u.IsAdmin,
-		NumRepos:         u.NumRepos,
-		Created:          u.Created,
-		Updated:          u.Updated,
-		NumFollowing:     u.NumFollowing,
-		NumFollowers:     u.NumFollowers,
-		AvatarUrl:        u.AvatarLink(),
+		Login:        u.Name,
+		ID:           u.ID,
+		UserName:     u.Name,
+		FullName:     u.FullName,
+		Company:      u.Company,
+		Location:     u.Location,
+		Description:  u.Description,
+		Email:        u.Email,
+		Website:      u.Website,
+		AvatarUrl:    u.AvatarLink(),
+		IsAdmin:      u.IsAdmin,
+		NumRepos:     u.NumRepos,
+		NumFollowing: u.NumFollowing,
+		NumFollowers: u.NumFollowers,
+		Created:      u.Created,
+		Updated:      u.Updated,
 	}
 }
 

+ 12 - 22
routes/admin/admin.go

@@ -25,20 +25,17 @@ import (
 )
 
 const (
-	// DASHBOARD page template
-	DASHBOARD = "admin/dashboard"
+	// DashboardTPL page template
+	DashboardTPL = "admin/dashboard"
 
-	// ANALYTICS page template
-	ANALYTICS = "admin/analytics"
+	// AnalyticsTPL page template
+	AnalyticsTPL = "admin/analytics"
 
-	// API page template
-	API = "admin/api"
+	// ConfigTPL page template
+	ConfigTPL = "admin/config"
 
-	// CONFIG page template
-	CONFIG = "admin/config"
-
-	// MONITOR page template
-	MONITOR = "admin/monitor"
+	// MonitorTPL page template
+	MonitorTPL = "admin/monitor"
 )
 
 var (
@@ -197,7 +194,7 @@ func Dashboard(c *context.Context) {
 	updateSystemStatus()
 	c.Data["SysStatus"] = sysStatus
 	c.Data["GitVersion"] = setting.Git.Version
-	c.HTML(200, DASHBOARD)
+	c.HTML(200, DashboardTPL)
 }
 
 // SendTestMail send mail to verify the email
@@ -272,7 +269,7 @@ func Config(c *context.Context) {
 	}
 	c.Data["Loggers"] = loggers
 
-	c.HTML(200, CONFIG)
+	c.HTML(200, ConfigTPL)
 }
 
 // Monitor shows monitor page
@@ -282,19 +279,12 @@ func Monitor(c *context.Context) {
 	c.Data["PageIsAdminMonitor"] = true
 	c.Data["Processes"] = process.Processes
 	c.Data["Entries"] = cron.ListTasks()
-	c.HTML(200, MONITOR)
+	c.HTML(200, MonitorTPL)
 }
 
 // Analytics shows analytics page
 func Analytics(c *context.Context) {
 	c.Data["Title"] = "Analytics"
 	c.Data["PageIsAdminAnalytics"] = true
-	c.HTML(200, ANALYTICS)
-}
-
-// AdminAPI shows api configuration
-func AdminAPI(c *context.Context) {
-	c.Data["Title"] = "API"
-	c.Data["PageIsAdminAPI"] = true
-	c.HTML(200, API)
+	c.HTML(200, AnalyticsTPL)
 }

+ 12 - 12
routes/admin/auths.go

@@ -22,14 +22,14 @@ import (
 )
 
 const (
-	// AUTHS list page template
-	AUTHS = "admin/auth/list"
+	// AuthsTPL list page template
+	AuthsTPL = "admin/auth/list"
 
-	// AUTH_NEW page template
-	AUTH_NEW = "admin/auth/new"
+	// AuthNewTPL page template
+	AuthNewTPL = "admin/auth/new"
 
-	// AUTH_EDIT page template
-	AUTH_EDIT = "admin/auth/edit"
+	// AuthEditTPL page template
+	AuthEditTPL = "admin/auth/edit"
 )
 
 // Authentications shows authentication page
@@ -46,7 +46,7 @@ func Authentications(c *context.Context) {
 	}
 
 	c.Data["Total"] = models.CountLoginSources()
-	c.Success(AUTHS)
+	c.Success(AuthsTPL)
 }
 
 type dropdownItem struct {
@@ -84,7 +84,7 @@ func NewAuthSource(c *context.Context) {
 	c.Data["AuthSources"] = authSources
 	c.Data["SecurityProtocols"] = securityProtocols
 	c.Data["SMTPAuths"] = models.SMTPAuths
-	c.Success(AUTH_NEW)
+	c.Success(AuthNewTPL)
 }
 
 func parseLDAPConfig(f form.Authentication) *models.LDAPConfig {
@@ -161,7 +161,7 @@ func NewAuthSourcePost(c *context.Context, f form.Authentication) {
 	c.Data["HasTLS"] = hasTLS
 
 	if c.HasError() {
-		c.Success(AUTH_NEW)
+		c.Success(AuthNewTPL)
 		return
 	}
 
@@ -174,7 +174,7 @@ func NewAuthSourcePost(c *context.Context, f form.Authentication) {
 	}); err != nil {
 		if models.IsErrLoginSourceAlreadyExist(err) {
 			c.FormErr("Name")
-			c.RenderWithErr(c.Tr("admin.auths.login_source_exist", err.(models.ErrLoginSourceAlreadyExist).Name), AUTH_NEW, f)
+			c.RenderWithErr(c.Tr("admin.auths.login_source_exist", err.(models.ErrLoginSourceAlreadyExist).Name), AuthNewTPL, f)
 		} else {
 			c.ServerError("CreateSource", err)
 		}
@@ -204,7 +204,7 @@ func EditAuthSource(c *context.Context) {
 	c.Data["Source"] = source
 	c.Data["HasTLS"] = source.HasTLS()
 
-	c.Success(AUTH_EDIT)
+	c.Success(AuthEditTPL)
 }
 
 // EditAuthSourcePost edits an auth source
@@ -224,7 +224,7 @@ func EditAuthSourcePost(c *context.Context, f form.Authentication) {
 	c.Data["HasTLS"] = source.HasTLS()
 
 	if c.HasError() {
-		c.Success(AUTH_EDIT)
+		c.Success(AuthEditTPL)
 		return
 	}
 

+ 0 - 23
routes/admin/inbox.go

@@ -1,23 +0,0 @@
-// Copyright 2015 The Gogs Authors. All rights reserved.
-// Copyright 2018 Gitote. All rights reserved.
-//
-// This source code is licensed under the MIT license found in the
-// LICENSE file in the root directory of this source tree.
-
-package admin
-
-import (
-	"gitote/gitote/pkg/context"
-)
-
-const (
-	// INBOX page template
-	INBOX = "admin/inbox"
-)
-
-// Inbox shows admin inbox page
-func Inbox(c *context.Context) {
-	c.Data["Title"] = "Inbox"
-	c.Data["PageIsAdminInbox"] = true
-	c.HTML(200, INBOX)
-}

+ 9 - 9
routes/admin/news.go

@@ -11,33 +11,33 @@ import (
 )
 
 const (
-	// NEWS list page template
-	NEWS = "admin/news/list"
+	// NewsTPL list page template
+	NewsTPL = "admin/news/list"
 
-	// NEWS_NEW page template
-	NEWS_NEW = "admin/news/new"
+	// NewsNewTPL page template
+	NewsNewTPL = "admin/news/new"
 
-	// NEWS_EDIT page template
-	NEWS_EDIT = "admin/news/edit"
+	// NewsEditTPL page template
+	NewsEditTPL = "admin/news/edit"
 )
 
 // News shows news page
 func News(c *context.Context) {
 	c.Data["Title"] = "News"
 	c.Data["PageIsAdminNews"] = true
-	c.HTML(200, NEWS)
+	c.HTML(200, NewsTPL)
 }
 
 // News shows news page
 func NewsNew(c *context.Context) {
 	c.Data["Title"] = "News"
 	c.Data["PageIsAdminNews"] = true
-	c.HTML(200, NEWS_NEW)
+	c.HTML(200, NewsNewTPL)
 }
 
 // News shows news page
 func NewsEdit(c *context.Context) {
 	c.Data["Title"] = "News"
 	c.Data["PageIsAdminNews"] = true
-	c.HTML(200, NEWS_EDIT)
+	c.HTML(200, NewsEditTPL)
 }

+ 3 - 3
routes/admin/notice.go

@@ -17,8 +17,8 @@ import (
 )
 
 const (
-	// NOTICES page template
-	NOTICES = "admin/notice"
+	// NoticesTPL page template
+	NoticesTPL = "admin/notice"
 )
 
 // Notices shows admin notices page
@@ -42,7 +42,7 @@ func Notices(c *context.Context) {
 	c.Data["Notices"] = notices
 
 	c.Data["Total"] = total
-	c.HTML(200, NOTICES)
+	c.HTML(200, NoticesTPL)
 }
 
 // DeleteNotices deletes notices

+ 3 - 3
routes/admin/orgs.go

@@ -14,8 +14,8 @@ import (
 )
 
 const (
-	// ORGS list page template
-	ORGS = "admin/org/list"
+	// OrgsTPL list page template
+	OrgsTPL = "admin/org/list"
 )
 
 // Organizations shows organizations page
@@ -30,6 +30,6 @@ func Organizations(c *context.Context) {
 		Ranger:   models.Organizations,
 		PageSize: setting.UI.Admin.OrgPagingNum,
 		OrderBy:  "id ASC",
-		TplName:  ORGS,
+		TplName:  OrgsTPL,
 	})
 }

+ 3 - 3
routes/admin/repos.go

@@ -16,8 +16,8 @@ import (
 )
 
 const (
-	// REPOS list page template
-	REPOS = "admin/repo/list"
+	// ReposTPL list page template
+	ReposTPL = "admin/repo/list"
 )
 
 // Repos shows repositories page
@@ -68,7 +68,7 @@ func Repos(c *context.Context) {
 	}
 	c.Data["Repos"] = repos
 
-	c.HTML(200, REPOS)
+	c.HTML(200, ReposTPL)
 }
 
 // DeleteRepo deletes a repository

+ 16 - 16
routes/admin/users.go

@@ -20,14 +20,14 @@ import (
 )
 
 const (
-	// USERS list page template
-	USERS = "admin/user/list"
+	// UsersTPL list page template
+	UsersTPL = "admin/user/list"
 
-	// USER_NEW page template
-	USER_NEW = "admin/user/new"
+	// UserNewTPL page template
+	UserNewTPL = "admin/user/new"
 
-	// USER_EDIT page template
-	USER_EDIT = "admin/user/edit"
+	// UserEditTPL page template
+	UserEditTPL = "admin/user/edit"
 )
 
 // Users shows users page
@@ -42,7 +42,7 @@ func Users(c *context.Context) {
 		Ranger:   models.Users,
 		PageSize: setting.UI.Admin.UserPagingNum,
 		OrderBy:  "id ASC",
-		TplName:  USERS,
+		TplName:  UsersTPL,
 	})
 }
 
@@ -62,7 +62,7 @@ func NewUser(c *context.Context) {
 	c.Data["Sources"] = sources
 
 	c.Data["CanSendEmail"] = setting.MailService != nil
-	c.HTML(200, USER_NEW)
+	c.HTML(200, UserNewTPL)
 }
 
 // NewUserPost creates a new user
@@ -81,7 +81,7 @@ func NewUserPost(c *context.Context, f form.AdminCrateUser) {
 	c.Data["CanSendEmail"] = setting.MailService != nil
 
 	if c.HasError() {
-		c.HTML(200, USER_NEW)
+		c.HTML(200, UserNewTPL)
 		return
 	}
 
@@ -108,16 +108,16 @@ func NewUserPost(c *context.Context, f form.AdminCrateUser) {
 		switch {
 		case models.IsErrUserAlreadyExist(err):
 			c.Data["Err_UserName"] = true
-			c.RenderWithErr(c.Tr("form.username_been_taken"), USER_NEW, &f)
+			c.RenderWithErr(c.Tr("form.username_been_taken"), UserNewTPL, &f)
 		case models.IsErrEmailAlreadyUsed(err):
 			c.Data["Err_Email"] = true
-			c.RenderWithErr(c.Tr("form.email_been_used"), USER_NEW, &f)
+			c.RenderWithErr(c.Tr("form.email_been_used"), UserNewTPL, &f)
 		case models.IsErrNameReserved(err):
 			c.Data["Err_UserName"] = true
-			c.RenderWithErr(c.Tr("user.form.name_reserved", err.(models.ErrNameReserved).Name), USER_NEW, &f)
+			c.RenderWithErr(c.Tr("user.form.name_reserved", err.(models.ErrNameReserved).Name), UserNewTPL, &f)
 		case models.IsErrNamePatternNotAllowed(err):
 			c.Data["Err_UserName"] = true
-			c.RenderWithErr(c.Tr("user.form.name_pattern_not_allowed", err.(models.ErrNamePatternNotAllowed).Pattern), USER_NEW, &f)
+			c.RenderWithErr(c.Tr("user.form.name_pattern_not_allowed", err.(models.ErrNamePatternNotAllowed).Pattern), UserNewTPL, &f)
 		default:
 			c.Handle(500, "CreateUser", err)
 		}
@@ -174,7 +174,7 @@ func EditUser(c *context.Context) {
 		return
 	}
 
-	c.HTML(200, USER_EDIT)
+	c.HTML(200, UserEditTPL)
 }
 
 // EditUserPost edits an user
@@ -190,7 +190,7 @@ func EditUserPost(c *context.Context, f form.AdminEditUser) {
 	}
 
 	if c.HasError() {
-		c.HTML(200, USER_EDIT)
+		c.HTML(200, UserEditTPL)
 		return
 	}
 
@@ -252,7 +252,7 @@ func EditUserPost(c *context.Context, f form.AdminEditUser) {
 	if err := models.UpdateUser(u); err != nil {
 		if models.IsErrEmailAlreadyUsed(err) {
 			c.Data["Err_Email"] = true
-			c.RenderWithErr(c.Tr("form.email_been_used"), USER_EDIT, &f)
+			c.RenderWithErr(c.Tr("form.email_been_used"), UserEditTPL, &f)
 		} else {
 			c.Handle(500, "UpdateUser", err)
 		}

+ 15 - 15
routes/explore.go

@@ -15,20 +15,20 @@ import (
 )
 
 const (
-	// EXPLORE_HOME page template
-	EXPLORE = "explore/home"
+	// ExploreTPL page template
+	ExploreTPL = "explore/home"
 
-	// EXPLORE_REPOS page template
-	EXPLORE_REPOS = "explore/repos"
+	// ExploreReposTPL page template
+	ExploreReposTPL = "explore/repos"
 
-	// EXPLORE_USERS page template
-	EXPLORE_USERS = "explore/users"
+	// ExploreUsersTPL page template
+	ExploreUsersTPL = "explore/users"
 
-	// EXPLORE_TRENDING page template
-	EXPLORE_TRENDING = "explore/trending"
+	// ExploreTrendingTPL page template
+	ExploreTrendingTPL = "explore/trending"
 
-	// EXPLORE_ORGANIZATIONS page template
-	EXPLORE_ORGANIZATIONS = "explore/organizations"
+	// ExploreOrganizationsTPL page template
+	ExploreOrganizationsTPL = "explore/organizations"
 )
 
 // ExploreHome shows explore page
@@ -54,7 +54,7 @@ func Explore(c *context.Context) {
 	}
 	c.Data["Repos"] = repos
 
-	c.Success(EXPLORE)
+	c.Success(ExploreTPL)
 }
 
 // ExploreRepos shows explore repositories page
@@ -91,7 +91,7 @@ func ExploreRepos(c *context.Context) {
 	}
 	c.Data["Repos"] = repos
 
-	c.Success(EXPLORE_REPOS)
+	c.Success(ExploreReposTPL)
 }
 
 // ExploreTrending shows trending repositories page
@@ -116,7 +116,7 @@ func ExploreTrending(c *context.Context) {
 	}
 	c.Data["Repos"] = repos
 
-	c.Success(EXPLORE_TRENDING)
+	c.Success(ExploreTrendingTPL)
 }
 
 // UserSearchOptions is the structure of the options choosed by the user
@@ -183,7 +183,7 @@ func ExploreUsers(c *context.Context) {
 		Ranger:   models.Users,
 		PageSize: setting.UI.ExplorePagingNum,
 		OrderBy:  "updated_unix DESC",
-		TplName:  EXPLORE_USERS,
+		TplName:  ExploreUsersTPL,
 	})
 }
 
@@ -199,6 +199,6 @@ func ExploreOrganizations(c *context.Context) {
 		Ranger:   models.Organizations,
 		PageSize: setting.UI.ExplorePagingNum,
 		OrderBy:  "updated_unix DESC",
-		TplName:  EXPLORE_ORGANIZATIONS,
+		TplName:  ExploreOrganizationsTPL,
 	})
 }

+ 4 - 4
routes/home.go

@@ -13,8 +13,8 @@ import (
 )
 
 const (
-	// HOME page template
-	HOME = "home"
+	// HomeTPL page template
+	HomeTPL = "home"
 )
 
 // Home shows the home page
@@ -22,7 +22,7 @@ func Home(c *context.Context) {
 	if c.IsLogged {
 		if !c.User.IsActive && setting.Service.RegisterEmailConfirm {
 			c.Data["Title"] = c.Tr("auth.active_your_account")
-			c.Success(user.ACTIVATE)
+			c.Success(user.ActivateTPL)
 		} else {
 			user.Dashboard(c)
 		}
@@ -37,7 +37,7 @@ func Home(c *context.Context) {
 	}
 
 	c.Data["PageIsHome"] = true
-	c.Success(HOME)
+	c.Success(HomeTPL)
 }
 
 // NotFound renders 404 page if page not found

+ 19 - 19
routes/install.go

@@ -34,8 +34,8 @@ import (
 )
 
 const (
-	// INSTALL page template
-	INSTALL = "install"
+	// InstallTPL page template
+	InstallTPL = "install"
 )
 
 // checkRunMode check if it is runned or not in production
@@ -182,7 +182,7 @@ func Install(c *context.Context) {
 	f.RequireSignInView = setting.Service.RequireSignInView
 
 	form.Assign(f, c.Data)
-	c.Success(INSTALL)
+	c.Success(InstallTPL)
 }
 
 // InstallPost install gitote
@@ -199,12 +199,12 @@ func InstallPost(c *context.Context, f form.Install) {
 			c.FormErr("Admin")
 		}
 
-		c.Success(INSTALL)
+		c.Success(InstallTPL)
 		return
 	}
 
 	if _, err := exec.LookPath("git"); err != nil {
-		c.RenderWithErr(c.Tr("install.test_git_failed", err), INSTALL, &f)
+		c.RenderWithErr(c.Tr("install.test_git_failed", err), InstallTPL, &f)
 		return
 	}
 
@@ -221,7 +221,7 @@ func InstallPost(c *context.Context, f form.Install) {
 
 	if models.DbCfg.Type == "sqlite3" && len(models.DbCfg.Path) == 0 {
 		c.FormErr("DbPath")
-		c.RenderWithErr(c.Tr("install.err_empty_db_path"), INSTALL, &f)
+		c.RenderWithErr(c.Tr("install.err_empty_db_path"), InstallTPL, &f)
 		return
 	}
 
@@ -230,10 +230,10 @@ func InstallPost(c *context.Context, f form.Install) {
 	if err := models.NewTestEngine(x); err != nil {
 		if strings.Contains(err.Error(), `Unknown database type: sqlite3`) {
 			c.FormErr("DbType")
-			c.RenderWithErr(c.Tr("install.sqlite3_not_available", "https://gitote/docs/installation/install_from_binary.html"), INSTALL, &f)
+			c.RenderWithErr(c.Tr("install.sqlite3_not_available", "https://docs.gitote.in/docs/installation/install_from_binary.html"), InstallTPL, &f)
 		} else {
 			c.FormErr("DbSetting")
-			c.RenderWithErr(c.Tr("install.invalid_db_setting", err), INSTALL, &f)
+			c.RenderWithErr(c.Tr("install.invalid_db_setting", err), InstallTPL, &f)
 		}
 		return
 	}
@@ -242,7 +242,7 @@ func InstallPost(c *context.Context, f form.Install) {
 	f.RepoRootPath = strings.Replace(f.RepoRootPath, "\\", "/", -1)
 	if err := os.MkdirAll(f.RepoRootPath, os.ModePerm); err != nil {
 		c.FormErr("RepoRootPath")
-		c.RenderWithErr(c.Tr("install.invalid_repo_path", err), INSTALL, &f)
+		c.RenderWithErr(c.Tr("install.invalid_repo_path", err), InstallTPL, &f)
 		return
 	}
 
@@ -250,21 +250,21 @@ func InstallPost(c *context.Context, f form.Install) {
 	f.LogRootPath = strings.Replace(f.LogRootPath, "\\", "/", -1)
 	if err := os.MkdirAll(f.LogRootPath, os.ModePerm); err != nil {
 		c.FormErr("LogRootPath")
-		c.RenderWithErr(c.Tr("install.invalid_log_root_path", err), INSTALL, &f)
+		c.RenderWithErr(c.Tr("install.invalid_log_root_path", err), InstallTPL, &f)
 		return
 	}
 
 	currentUser, match := setting.IsRunUserMatchCurrentUser(f.RunUser)
 	if !match {
 		c.FormErr("RunUser")
-		c.RenderWithErr(c.Tr("install.run_user_not_match", f.RunUser, currentUser), INSTALL, &f)
+		c.RenderWithErr(c.Tr("install.run_user_not_match", f.RunUser, currentUser), InstallTPL, &f)
 		return
 	}
 
 	// Check host address and port
 	if len(f.SMTPHost) > 0 && !strings.Contains(f.SMTPHost, ":") {
 		c.FormErr("SMTP", "SMTPHost")
-		c.RenderWithErr(c.Tr("install.smtp_host_missing_port"), INSTALL, &f)
+		c.RenderWithErr(c.Tr("install.smtp_host_missing_port"), InstallTPL, &f)
 		return
 	}
 
@@ -273,7 +273,7 @@ func InstallPost(c *context.Context, f form.Install) {
 		_, err := mail.ParseAddress(f.SMTPFrom)
 		if err != nil {
 			c.FormErr("SMTP", "SMTPFrom")
-			c.RenderWithErr(c.Tr("install.invalid_smtp_from", err), INSTALL, &f)
+			c.RenderWithErr(c.Tr("install.invalid_smtp_from", err), InstallTPL, &f)
 			return
 		}
 	}
@@ -281,19 +281,19 @@ func InstallPost(c *context.Context, f form.Install) {
 	// Check logic loophole between disable self-registration and no admin account.
 	if f.DisableRegistration && len(f.AdminName) == 0 {
 		c.FormErr("Services", "Admin")
-		c.RenderWithErr(c.Tr("install.no_admin_and_disable_registration"), INSTALL, f)
+		c.RenderWithErr(c.Tr("install.no_admin_and_disable_registration"), InstallTPL, f)
 		return
 	}
 
 	// Check admin password.
 	if len(f.AdminName) > 0 && len(f.AdminPasswd) == 0 {
 		c.FormErr("Admin", "AdminPasswd")
-		c.RenderWithErr(c.Tr("install.err_empty_admin_password"), INSTALL, f)
+		c.RenderWithErr(c.Tr("install.err_empty_admin_password"), InstallTPL, f)
 		return
 	}
 	if f.AdminPasswd != f.AdminConfirmPasswd {
 		c.FormErr("Admin", "AdminPasswd")
-		c.RenderWithErr(c.Tr("form.password_not_match"), INSTALL, f)
+		c.RenderWithErr(c.Tr("form.password_not_match"), InstallTPL, f)
 		return
 	}
 
@@ -366,14 +366,14 @@ func InstallPost(c *context.Context, f form.Install) {
 	cfg.Section("security").Key("INSTALL_LOCK").SetValue("true")
 	secretKey, err := tool.RandomString(15)
 	if err != nil {
-		c.RenderWithErr(c.Tr("install.secret_key_failed", err), INSTALL, &f)
+		c.RenderWithErr(c.Tr("install.secret_key_failed", err), InstallTPL, &f)
 		return
 	}
 	cfg.Section("security").Key("SECRET_KEY").SetValue(secretKey)
 
 	os.MkdirAll(filepath.Dir(setting.CustomConf), os.ModePerm)
 	if err := cfg.SaveTo(setting.CustomConf); err != nil {
-		c.RenderWithErr(c.Tr("install.save_config_failed", err), INSTALL, &f)
+		c.RenderWithErr(c.Tr("install.save_config_failed", err), InstallTPL, &f)
 		return
 	}
 
@@ -392,7 +392,7 @@ func InstallPost(c *context.Context, f form.Install) {
 			if !models.IsErrUserAlreadyExist(err) {
 				setting.InstallLock = false
 				c.FormErr("AdminName", "AdminEmail")
-				c.RenderWithErr(c.Tr("install.invalid_admin_setting", err), INSTALL, &f)
+				c.RenderWithErr(c.Tr("install.invalid_admin_setting", err), InstallTPL, &f)
 				return
 			}
 			log.Info("Admin account already exist")

+ 6 - 6
routes/org/members.go

@@ -18,11 +18,11 @@ import (
 )
 
 const (
-	// MEMBERS page template
-	MEMBERS = "org/member/members"
+	// MembersTPL page template
+	MembersTPL = "org/member/members"
 
-	//MEMBER_INVITE page template
-	MEMBER_INVITE = "org/member/invite"
+	//MemberInviteTPL page template
+	MemberInviteTPL = "org/member/invite"
 )
 
 //Members shows organization members
@@ -37,7 +37,7 @@ func Members(c *context.Context) {
 	}
 	c.Data["Members"] = org.Members
 
-	c.HTML(200, MEMBERS)
+	c.HTML(200, MembersTPL)
 }
 
 // MembersAction handle the user actions
@@ -136,5 +136,5 @@ func Invitation(c *context.Context) {
 		return
 	}
 
-	c.HTML(200, MEMBER_INVITE)
+	c.HTML(200, MemberInviteTPL)
 }

+ 7 - 7
routes/org/org.go

@@ -16,14 +16,14 @@ import (
 )
 
 const (
-	// CREATE organization page template
-	CREATE = "org/create"
+	// CreateTPL organization page template
+	CreateTPL = "org/create"
 )
 
 // Create renders the page to create an organization
 func Create(c *context.Context) {
 	c.Data["Title"] = c.Tr("new_org")
-	c.HTML(200, CREATE)
+	c.HTML(200, CreateTPL)
 }
 
 // CreatePost creates an organization with the body fields
@@ -31,7 +31,7 @@ func CreatePost(c *context.Context, f form.CreateOrg) {
 	c.Data["Title"] = c.Tr("new_org")
 
 	if c.HasError() {
-		c.HTML(200, CREATE)
+		c.HTML(200, CreateTPL)
 		return
 	}
 
@@ -46,11 +46,11 @@ func CreatePost(c *context.Context, f form.CreateOrg) {
 		c.Data["Err_OrgName"] = true
 		switch {
 		case models.IsErrUserAlreadyExist(err):
-			c.RenderWithErr(c.Tr("form.org_name_been_taken"), CREATE, &f)
+			c.RenderWithErr(c.Tr("form.org_name_been_taken"), CreateTPL, &f)
 		case models.IsErrNameReserved(err):
-			c.RenderWithErr(c.Tr("org.form.name_reserved", err.(models.ErrNameReserved).Name), CREATE, &f)
+			c.RenderWithErr(c.Tr("org.form.name_reserved", err.(models.ErrNameReserved).Name), CreateTPL, &f)
 		case models.IsErrNamePatternNotAllowed(err):
-			c.RenderWithErr(c.Tr("org.form.name_pattern_not_allowed", err.(models.ErrNamePatternNotAllowed).Pattern), CREATE, &f)
+			c.RenderWithErr(c.Tr("org.form.name_pattern_not_allowed", err.(models.ErrNamePatternNotAllowed).Pattern), CreateTPL, &f)
 		default:
 			c.Handle(500, "CreateOrganization", err)
 		}

+ 14 - 14
routes/org/setting.go

@@ -19,21 +19,21 @@ import (
 )
 
 const (
-	// SETTINGS_OPTIONS page template
-	SETTINGS_OPTIONS = "org/settings/options"
+	// SettingsOptionsTPL page template
+	SettingsOptionsTPL = "org/settings/options"
 
-	// SETTINGS_DELETE page template
-	SETTINGS_DELETE = "org/settings/delete"
+	// SettingsDeleteTPL page template
+	SettingsDeleteTPL = "org/settings/delete"
 
-	// SETTINGS_WEBHOOKS page template
-	SETTINGS_WEBHOOKS = "org/settings/webhooks"
+	// SettingsWebhooksTPL page template
+	SettingsWebhooksTPL = "org/settings/webhooks"
 )
 
 // Settings shows the organization settings page
 func Settings(c *context.Context) {
 	c.Data["Title"] = c.Tr("org.settings")
 	c.Data["PageIsSettingsOptions"] = true
-	c.HTML(200, SETTINGS_OPTIONS)
+	c.HTML(200, SettingsOptionsTPL)
 }
 
 // SettingsPost updates organization settings with the body fields
@@ -42,7 +42,7 @@ func SettingsPost(c *context.Context, f form.UpdateOrgSetting) {
 	c.Data["PageIsSettingsOptions"] = true
 
 	if c.HasError() {
-		c.HTML(200, SETTINGS_OPTIONS)
+		c.HTML(200, SettingsOptionsTPL)
 		return
 	}
 
@@ -56,15 +56,15 @@ func SettingsPost(c *context.Context, f form.UpdateOrgSetting) {
 			return
 		} else if isExist {
 			c.Data["OrgName"] = true
-			c.RenderWithErr(c.Tr("form.username_been_taken"), SETTINGS_OPTIONS, &f)
+			c.RenderWithErr(c.Tr("form.username_been_taken"), SettingsOptionsTPL, &f)
 			return
 		} else if err = models.ChangeUserName(org, f.Name); err != nil {
 			c.Data["OrgName"] = true
 			switch {
 			case models.IsErrNameReserved(err):
-				c.RenderWithErr(c.Tr("user.form.name_reserved"), SETTINGS_OPTIONS, &f)
+				c.RenderWithErr(c.Tr("user.form.name_reserved"), SettingsOptionsTPL, &f)
 			case models.IsErrNamePatternNotAllowed(err):
-				c.RenderWithErr(c.Tr("user.form.name_pattern_not_allowed"), SETTINGS_OPTIONS, &f)
+				c.RenderWithErr(c.Tr("user.form.name_pattern_not_allowed"), SettingsOptionsTPL, &f)
 			default:
 				c.Handle(500, "ChangeUserName", err)
 			}
@@ -132,7 +132,7 @@ func SettingsDelete(c *context.Context) {
 		// Check if user is logged in
 		if _, err := models.UserLogin(c.User.Name, c.Query("password"), c.User.LoginSource); err != nil {
 			if errors.IsUserNotExist(err) {
-				c.RenderWithErr(c.Tr("form.enterred_invalid_password"), SETTINGS_DELETE, nil)
+				c.RenderWithErr(c.Tr("form.enterred_invalid_password"), SettingsDeleteTPL, nil)
 			} else {
 				c.ServerError("UserLogin", err)
 			}
@@ -154,7 +154,7 @@ func SettingsDelete(c *context.Context) {
 		return
 	}
 
-	c.Success(SETTINGS_DELETE)
+	c.Success(SettingsDeleteTPL)
 }
 
 // Webhooks shows organization webhooks settings
@@ -172,7 +172,7 @@ func Webhooks(c *context.Context) {
 	}
 
 	c.Data["Webhooks"] = ws
-	c.HTML(200, SETTINGS_WEBHOOKS)
+	c.HTML(200, SettingsWebhooksTPL)
 }
 
 // DeleteWbhook deletes an organization webhook

+ 18 - 18
routes/org/teams.go

@@ -19,17 +19,17 @@ import (
 )
 
 const (
-	// TEAMS page template
-	TEAMS = "org/team/teams"
+	// TeamsTPL page template
+	TeamsTPL = "org/team/teams"
 
-	// TEAM_NEW page template
-	TEAM_NEW = "org/team/new"
+	// TeamNewTPL page template
+	TeamNewTPL = "org/team/new"
 
-	// TEAM_MEMBERS page template
-	TEAM_MEMBERS = "org/team/members"
+	// TeamMembersTPL page template
+	TeamMembersTPL = "org/team/members"
 
-	// TEAM_REPOSITORIES page template
-	TEAM_REPOSITORIES = "org/team/repositories"
+	// TeamRepositoriesTPL page template
+	TeamRepositoriesTPL = "org/team/repositories"
 )
 
 // Teams shows team page
@@ -46,7 +46,7 @@ func Teams(c *context.Context) {
 	}
 	c.Data["Teams"] = org.Teams
 
-	c.HTML(200, TEAMS)
+	c.HTML(200, TeamsTPL)
 }
 
 // TeamsAction handle the user action
@@ -167,7 +167,7 @@ func NewTeam(c *context.Context) {
 	c.Data["PageIsOrgTeams"] = true
 	c.Data["PageIsOrgTeamsNew"] = true
 	c.Data["Team"] = &models.Team{}
-	c.HTML(200, TEAM_NEW)
+	c.HTML(200, TeamNewTPL)
 }
 
 // NewTeamPost creates an organization with the body fields
@@ -185,7 +185,7 @@ func NewTeamPost(c *context.Context, f form.CreateTeam) {
 	c.Data["Team"] = t
 
 	if c.HasError() {
-		c.HTML(200, TEAM_NEW)
+		c.HTML(200, TeamNewTPL)
 		return
 	}
 
@@ -194,9 +194,9 @@ func NewTeamPost(c *context.Context, f form.CreateTeam) {
 		c.Data["Err_TeamName"] = true
 		switch {
 		case models.IsErrTeamAlreadyExist(err):
-			c.RenderWithErr(c.Tr("form.team_name_been_taken"), TEAM_NEW, &f)
+			c.RenderWithErr(c.Tr("form.team_name_been_taken"), TeamNewTPL, &f)
 		case models.IsErrNameReserved(err):
-			c.RenderWithErr(c.Tr("org.form.team_name_reserved", err.(models.ErrNameReserved).Name), TEAM_NEW, &f)
+			c.RenderWithErr(c.Tr("org.form.team_name_reserved", err.(models.ErrNameReserved).Name), TeamNewTPL, &f)
 		default:
 			c.Handle(500, "NewTeam", err)
 		}
@@ -214,7 +214,7 @@ func TeamMembers(c *context.Context) {
 		c.Handle(500, "GetMembers", err)
 		return
 	}
-	c.HTML(200, TEAM_MEMBERS)
+	c.HTML(200, TeamMembersTPL)
 }
 
 // TeamRepositories shows team repositoies page
@@ -225,7 +225,7 @@ func TeamRepositories(c *context.Context) {
 		c.Handle(500, "GetRepositories", err)
 		return
 	}
-	c.HTML(200, TEAM_REPOSITORIES)
+	c.HTML(200, TeamRepositoriesTPL)
 }
 
 // EditTeam shows edit team page
@@ -234,7 +234,7 @@ func EditTeam(c *context.Context) {
 	c.Data["PageIsOrgTeams"] = true
 	c.Data["team_name"] = c.Org.Team.Name
 	c.Data["desc"] = c.Org.Team.Description
-	c.HTML(200, TEAM_NEW)
+	c.HTML(200, TeamNewTPL)
 }
 
 // EditTeamPost edit team with the body fields
@@ -245,7 +245,7 @@ func EditTeamPost(c *context.Context, f form.CreateTeam) {
 	c.Data["Team"] = t
 
 	if c.HasError() {
-		c.HTML(200, TEAM_NEW)
+		c.HTML(200, TeamNewTPL)
 		return
 	}
 
@@ -277,7 +277,7 @@ func EditTeamPost(c *context.Context, f form.CreateTeam) {
 		c.Data["Err_TeamName"] = true
 		switch {
 		case models.IsErrTeamAlreadyExist(err):
-			c.RenderWithErr(c.Tr("form.team_name_been_taken"), TEAM_NEW, &f)
+			c.RenderWithErr(c.Tr("form.team_name_been_taken"), TeamNewTPL, &f)
 		default:
 			c.Handle(500, "UpdateTeam", err)
 		}

+ 44 - 44
routes/pages/pages.go

@@ -11,85 +11,85 @@ import (
 )
 
 const (
-	// ABOUT page template
-	ABOUT = "pages/about"
+	// AboutTPL page template
+	AboutTPL = "pages/about"
 
-	// FAQ page template
-	FAQ = "pages/faq"
+	// FaqTPL page template
+	FaqTPL = "pages/faq"
 
-	// PRIVACY page template
-	PRIVACY = "pages/privacy"
+	// PrivacyTPL page template
+	PrivacyTPL = "pages/privacy"
 
-	// TOS page template
-	TOS = "pages/tos"
+	// TosTPL page template
+	TosTPL = "pages/tos"
 
-	// BRAND page template
-	BRAND = "pages/brand"
+	// BrandTPL page template
+	BrandTPL = "pages/brand"
 
-	// CONTACT page template
-	CONTACT = "pages/contact"
+	// ContactTPL page template
+	ContactTPL = "pages/contact"
 
-	// CONTRIBUTE page template
-	CONTRIBUTE = "pages/contribute"
+	// ContributeTPL page template
+	ContributeTPL = "pages/contribute"
 
-	// SECURITY page template
-	SECURITY = "pages/security"
+	// SecurityTPL page template
+	SecurityTPL = "pages/security"
 
-	// VERIFIED page template
-	VERIFIED = "pages/verified"
+	// VerifiedTPL page template
+	VerifiedTPL = "pages/verified"
 
-	// MAKERS page template
-	MAKERS = "pages/makers"
+	// MakersTPL page template
+	MakersTPL = "pages/makers"
 
-	// HELP page template
-	HELP = "pages/help"
+	// HelpTPL page template
+	HelpTPL = "pages/help"
 
-	// FEATURES page template
-	FEATURES = "pages/features"
+	// FeaturesTPL page template
+	FeaturesTPL = "pages/features"
 
-	// FEATUREREQUEST page template
-	FEATUREREQUEST = "pages/request"
+	// FeatureRequestTPL page template
+	FeatureRequestTPL = "pages/request"
 
-	// SPONSORSHIP page template
-	SPONSORSHIP = "pages/sponsorship"
+	// SponsorshipTPL page template
+	SponsorshipTPL = "pages/sponsorship"
 
-	// SITEMAP page template
-	SITEMAP = "pages/sitemap"
+	// SitemapTPL page template
+	SitemapTPL = "pages/sitemap"
 )
 
 // About shows about page
 func About(c *context.Context) {
 	c.Data["Title"] = "About"
 
-	c.HTML(200, ABOUT)
+	c.HTML(200, AboutTPL)
 }
 
 // Faq shows faq page
 func Faq(c *context.Context) {
 	c.Data["Title"] = "FAQ"
 
-	c.HTML(200, FAQ)
+	c.HTML(200, FaqTPL)
 }
 
 // Privacy shows privacy page
 func Privacy(c *context.Context) {
 	c.Data["Title"] = "Privacy Policy"
 
-	c.HTML(200, PRIVACY)
+	c.HTML(200, PrivacyTPL)
 }
 
 // Tos shows tos page
 func Tos(c *context.Context) {
 	c.Data["Title"] = "Terms of Service"
 
-	c.HTML(200, TOS)
+	c.HTML(200, TosTPL)
 }
 
 // Brand shows brand page
 func Brand(c *context.Context) {
 	c.Data["Title"] = "Gitote Brand"
 
-	c.HTML(200, BRAND)
+	c.HTML(200, BrandTPL)
 }
 
 // Contribute shows contribute page
@@ -97,28 +97,28 @@ func Contribute(c *context.Context) {
 	c.Data["PageIsContribute"] = true
 	c.Data["Title"] = "Contribute"
 
-	c.HTML(200, CONTRIBUTE)
+	c.HTML(200, ContributeTPL)
 }
 
 // Security shows security page
 func Security(c *context.Context) {
 	c.Data["Title"] = "Security"
 
-	c.HTML(200, SECURITY)
+	c.HTML(200, SecurityTPL)
 }
 
 // Verified shows verified page
 func Verified(c *context.Context) {
 	c.Data["Title"] = "Verified"
 
-	c.HTML(200, VERIFIED)
+	c.HTML(200, VerifiedTPL)
 }
 
 // Makers shows maker page
 func Makers(c *context.Context) {
 	c.Data["Title"] = "Makers"
 
-	c.HTML(200, MAKERS)
+	c.HTML(200, MakersTPL)
 }
 
 // Help shows help page
@@ -126,14 +126,14 @@ func Help(c *context.Context) {
 	c.Data["Title"] = "Help"
 	c.Data["PageIsHelp"] = true
 
-	c.HTML(200, HELP)
+	c.HTML(200, HelpTPL)
 }
 
 // Contact shows contact page
 func Contact(c *context.Context) {
 	c.Data["Title"] = "Contact"
 
-	c.HTML(200, CONTACT)
+	c.HTML(200, ContactTPL)
 }
 
 // Features shows features page
@@ -141,19 +141,19 @@ func Features(c *context.Context) {
 	c.Data["Title"] = "Features"
 	c.Data["PageIsFeatures"] = true
 
-	c.HTML(200, FEATURES)
+	c.HTML(200, FeaturesTPL)
 }
 
 // FeatureRequest shows feature request page
 func FeatureRequest(c *context.Context) {
 	c.Data["Title"] = "Feature Request"
 
-	c.HTML(200, FEATUREREQUEST)
+	c.HTML(200, FeatureRequestTPL)
 }
 
 // Sponsorship shows sponsorship page
 func Sponsorship(c *context.Context) {
 	c.Data["Title"] = "Sponsorship"
 
-	c.HTML(200, SPONSORSHIP)
+	c.HTML(200, SponsorshipTPL)
 }

+ 11 - 4
routes/repo/branch.go

@@ -19,10 +19,14 @@ import (
 )
 
 const (
-	BRANCHES_OVERVIEW = "repo/branches/overview"
-	BRANCHES_ALL      = "repo/branches/all"
+	// BranchesOverviewTPL page template
+	BranchesOverviewTPL = "repo/branches/overview"
+
+	// BranchesAllTPL page template
+	BranchesAllTPL = "repo/branches/all"
 )
 
+// Branch contains the branch information
 type Branch struct {
 	Name        string
 	Commit      *git.Commit
@@ -67,6 +71,7 @@ func loadBranches(c *context.Context) []*Branch {
 	return branches
 }
 
+// Branches shows branches page
 func Branches(c *context.Context) {
 	c.Data["Title"] = c.Tr("repo.git_branches")
 	c.Data["PageIsBranchesOverview"] = true
@@ -92,9 +97,10 @@ func Branches(c *context.Context) {
 
 	c.Data["ActiveBranches"] = activeBranches
 	c.Data["StaleBranches"] = staleBranches
-	c.HTML(200, BRANCHES_OVERVIEW)
+	c.HTML(200, BranchesOverviewTPL)
 }
 
+// AllBranches shows all branches page
 func AllBranches(c *context.Context) {
 	c.Data["Title"] = c.Tr("repo.git_branches")
 	c.Data["PageIsBranchesAll"] = true
@@ -105,9 +111,10 @@ func AllBranches(c *context.Context) {
 	}
 	c.Data["Branches"] = branches
 
-	c.HTML(200, BRANCHES_ALL)
+	c.HTML(200, BranchesAllTPL)
 }
 
+// DeleteBranchPost deletes a branch
 func DeleteBranchPost(c *context.Context) {
 	branchName := c.Params("*")
 	commitID := c.Query("commit")

+ 12 - 6
routes/repo/commit.go

@@ -18,8 +18,11 @@ import (
 )
 
 const (
-	COMMITS = "repo/commits"
-	DIFF    = "repo/diff/page"
+	// CommitsTPL page template
+	CommitsTPL = "repo/commits"
+
+	// DiffTPL page template
+	DiffTPL = "repo/diff/page"
 )
 
 func RefCommits(c *context.Context) {
@@ -43,6 +46,7 @@ func RenderIssueLinks(oldCommits *list.List, repoLink string) *list.List {
 	return newCommits
 }
 
+// renderCommits shows commits page
 func renderCommits(c *context.Context, filename string) {
 	c.Data["Title"] = c.Tr("repo.commits.commit_history") + " · " + c.Repo.Repository.FullName()
 	c.Data["PageIsCommits"] = true
@@ -85,13 +89,14 @@ func renderCommits(c *context.Context, filename string) {
 
 	c.Data["Username"] = c.Repo.Owner.Name
 	c.Data["Reponame"] = c.Repo.Repository.Name
-	c.HTML(200, COMMITS)
+	c.HTML(200, CommitsTPL)
 }
 
 func Commits(c *context.Context) {
 	renderCommits(c, "")
 }
 
+// SearchCommits shows search commits page
 func SearchCommits(c *context.Context) {
 	c.Data["PageIsCommits"] = true
 
@@ -114,13 +119,14 @@ func SearchCommits(c *context.Context) {
 	c.Data["Username"] = c.Repo.Owner.Name
 	c.Data["Reponame"] = c.Repo.Repository.Name
 	c.Data["Branch"] = c.Repo.BranchName
-	c.HTML(200, COMMITS)
+	c.HTML(200, CommitsTPL)
 }
 
 func FileHistory(c *context.Context) {
 	renderCommits(c, c.Repo.TreePath)
 }
 
+// Diff shows diff page
 func Diff(c *context.Context) {
 	c.RequireHighlightJS()
 	c.RequireHighlightJS()
@@ -173,7 +179,7 @@ func Diff(c *context.Context) {
 		c.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", parents[0])
 	}
 	c.Data["RawPath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "raw", commitID)
-	c.Success(DIFF)
+	c.Success(DiffTPL)
 }
 
 func RawDiff(c *context.Context) {
@@ -232,5 +238,5 @@ func CompareDiff(c *context.Context) {
 	c.Data["SourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", afterCommitID)
 	c.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", beforeCommitID)
 	c.Data["RawPath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "raw", afterCommitID)
-	c.HTML(200, DIFF)
+	c.HTML(200, DiffTPL)
 }

+ 41 - 24
routes/repo/editor.go

@@ -25,10 +25,17 @@ import (
 )
 
 const (
-	EDIT_FILE         = "repo/editor/edit"
-	EDIT_DIFF_PREVIEW = "repo/editor/diff_preview"
-	DELETE_FILE       = "repo/editor/delete"
-	UPLOAD_FILE       = "repo/editor/upload"
+	// EditFileTPL page template
+	EditFileTPL = "repo/editor/edit"
+
+	// EditDiffPreviewTPL page template
+	EditDiffPreviewTPL = "repo/editor/diff_preview"
+
+	// DeleteFileTPL page template
+	DeleteFileTPL = "repo/editor/delete"
+
+	// UploadFileTPL page template
+	UploadFileTPL = "repo/editor/upload"
 )
 
 // getParentTreeFields returns list of parent tree names and corresponding tree paths
@@ -46,6 +53,7 @@ func getParentTreeFields(treePath string) (treeNames []string, treePaths []strin
 	return treeNames, treePaths
 }
 
+// editFile shows edit file page
 func editFile(c *context.Context, isNewFile bool) {
 	c.PageIs("Edit")
 	c.RequireHighlightJS()
@@ -116,13 +124,15 @@ func editFile(c *context.Context, isNewFile bool) {
 	c.Data["PreviewableFileModes"] = strings.Join(setting.Repository.Editor.PreviewableFileModes, ",")
 	c.Data["EditorconfigURLPrefix"] = fmt.Sprintf("%s/api/v1/repos/%s/editorconfig/", setting.AppSubURL, c.Repo.Repository.FullName())
 
-	c.Success(EDIT_FILE)
+	c.Success(EditFileTPL)
 }
 
+// EditFile shows edit file page
 func EditFile(c *context.Context) {
 	editFile(c, false)
 }
 
+// NewFile shows new file page
 func NewFile(c *context.Context) {
 	editFile(c, true)
 }
@@ -162,20 +172,20 @@ func editFilePost(c *context.Context, f form.EditRepoFile, isNewFile bool) {
 	c.Data["PreviewableFileModes"] = strings.Join(setting.Repository.Editor.PreviewableFileModes, ",")
 
 	if c.HasError() {
-		c.Success(EDIT_FILE)
+		c.Success(EditFileTPL)
 		return
 	}
 
 	if len(f.TreePath) == 0 {
 		c.FormErr("TreePath")
-		c.RenderWithErr(c.Tr("repo.editor.filename_cannot_be_empty"), EDIT_FILE, &f)
+		c.RenderWithErr(c.Tr("repo.editor.filename_cannot_be_empty"), EditFileTPL, &f)
 		return
 	}
 
 	if oldBranchName != branchName {
 		if _, err := c.Repo.Repository.GetBranch(branchName); err == nil {
 			c.FormErr("NewBranchName")
-			c.RenderWithErr(c.Tr("repo.editor.branch_already_exists", branchName), EDIT_FILE, &f)
+			c.RenderWithErr(c.Tr("repo.editor.branch_already_exists", branchName), EditFileTPL, &f)
 			return
 		}
 	}
@@ -196,17 +206,17 @@ func editFilePost(c *context.Context, f form.EditRepoFile, isNewFile bool) {
 		if index != len(treeNames)-1 {
 			if !entry.IsDir() {
 				c.FormErr("TreePath")
-				c.RenderWithErr(c.Tr("repo.editor.directory_is_a_file", part), EDIT_FILE, &f)
+				c.RenderWithErr(c.Tr("repo.editor.directory_is_a_file", part), EditFileTPL, &f)
 				return
 			}
 		} else {
 			if entry.IsLink() {
 				c.FormErr("TreePath")
-				c.RenderWithErr(c.Tr("repo.editor.file_is_a_symlink", part), EDIT_FILE, &f)
+				c.RenderWithErr(c.Tr("repo.editor.file_is_a_symlink", part), EditFileTPL, &f)
 				return
 			} else if entry.IsDir() {
 				c.FormErr("TreePath")
-				c.RenderWithErr(c.Tr("repo.editor.filename_is_a_directory", part), EDIT_FILE, &f)
+				c.RenderWithErr(c.Tr("repo.editor.filename_is_a_directory", part), EditFileTPL, &f)
 				return
 			}
 		}
@@ -217,7 +227,7 @@ func editFilePost(c *context.Context, f form.EditRepoFile, isNewFile bool) {
 		if err != nil {
 			if git.IsErrNotExist(err) {
 				c.FormErr("TreePath")
-				c.RenderWithErr(c.Tr("repo.editor.file_editing_no_longer_exists", oldTreePath), EDIT_FILE, &f)
+				c.RenderWithErr(c.Tr("repo.editor.file_editing_no_longer_exists", oldTreePath), EditFileTPL, &f)
 			} else {
 				c.ServerError("GetTreeEntryByPath", err)
 			}
@@ -232,7 +242,7 @@ func editFilePost(c *context.Context, f form.EditRepoFile, isNewFile bool) {
 
 			for _, file := range files {
 				if file == f.TreePath {
-					c.RenderWithErr(c.Tr("repo.editor.file_changed_while_editing", c.Repo.RepoLink+"/compare/"+lastCommit+"..."+c.Repo.CommitID), EDIT_FILE, &f)
+					c.RenderWithErr(c.Tr("repo.editor.file_changed_while_editing", c.Repo.RepoLink+"/compare/"+lastCommit+"..."+c.Repo.CommitID), EditFileTPL, &f)
 					return
 				}
 			}
@@ -250,7 +260,7 @@ func editFilePost(c *context.Context, f form.EditRepoFile, isNewFile bool) {
 		}
 		if entry != nil {
 			c.FormErr("TreePath")
-			c.RenderWithErr(c.Tr("repo.editor.file_already_exists", f.TreePath), EDIT_FILE, &f)
+			c.RenderWithErr(c.Tr("repo.editor.file_already_exists", f.TreePath), EditFileTPL, &f)
 			return
 		}
 	}
@@ -280,7 +290,7 @@ func editFilePost(c *context.Context, f form.EditRepoFile, isNewFile bool) {
 		IsNewFile:    isNewFile,
 	}); err != nil {
 		c.FormErr("TreePath")
-		c.RenderWithErr(c.Tr("repo.editor.fail_to_update_file", f.TreePath, err), EDIT_FILE, &f)
+		c.RenderWithErr(c.Tr("repo.editor.fail_to_update_file", f.TreePath, err), EditFileTPL, &f)
 		return
 	}
 
@@ -291,14 +301,17 @@ func editFilePost(c *context.Context, f form.EditRepoFile, isNewFile bool) {
 	}
 }
 
+// EditFilePost edits a file
 func EditFilePost(c *context.Context, f form.EditRepoFile) {
 	editFilePost(c, f, false)
 }
 
+// NewFilePost creates a new file
 func NewFilePost(c *context.Context, f form.EditRepoFile) {
 	editFilePost(c, f, true)
 }
 
+// DiffPreviewPost previews a diff
 func DiffPreviewPost(c *context.Context, f form.EditPreviewDiff) {
 	treePath := c.Repo.TreePath
 
@@ -323,9 +336,10 @@ func DiffPreviewPost(c *context.Context, f form.EditPreviewDiff) {
 	}
 	c.Data["File"] = diff.Files[0]
 
-	c.HTML(200, EDIT_DIFF_PREVIEW)
+	c.HTML(200, EditDiffPreviewTPL)
 }
 
+// DeleteFile shows delete file page
 func DeleteFile(c *context.Context) {
 	c.PageIs("Delete")
 	c.Data["BranchLink"] = c.Repo.RepoLink + "/src/" + c.Repo.BranchName
@@ -334,9 +348,10 @@ func DeleteFile(c *context.Context) {
 	c.Data["commit_message"] = ""
 	c.Data["commit_choice"] = "direct"
 	c.Data["new_branch_name"] = ""
-	c.Success(DELETE_FILE)
+	c.Success(DeleteFileTPL)
 }
 
+// DeleteFilePost deletes a file
 func DeleteFilePost(c *context.Context, f form.DeleteRepoFile) {
 	c.PageIs("Delete")
 	c.Data["BranchLink"] = c.Repo.RepoLink + "/src/" + c.Repo.BranchName
@@ -354,14 +369,14 @@ func DeleteFilePost(c *context.Context, f form.DeleteRepoFile) {
 	c.Data["new_branch_name"] = branchName
 
 	if c.HasError() {
-		c.Success(DELETE_FILE)
+		c.Success(DeleteFileTPL)
 		return
 	}
 
 	if oldBranchName != branchName {
 		if _, err := c.Repo.Repository.GetBranch(branchName); err == nil {
 			c.FormErr("NewBranchName")
-			c.RenderWithErr(c.Tr("repo.editor.branch_already_exists", branchName), DELETE_FILE, &f)
+			c.RenderWithErr(c.Tr("repo.editor.branch_already_exists", branchName), DeleteFileTPL, &f)
 			return
 		}
 	}
@@ -402,6 +417,7 @@ func renderUploadSettings(c *context.Context) {
 	c.Data["UploadMaxFiles"] = setting.Repository.Upload.MaxFiles
 }
 
+// UploadFile shows upload file page
 func UploadFile(c *context.Context) {
 	c.PageIs("Upload")
 	renderUploadSettings(c)
@@ -419,9 +435,10 @@ func UploadFile(c *context.Context) {
 	c.Data["commit_message"] = ""
 	c.Data["commit_choice"] = "direct"
 	c.Data["new_branch_name"] = ""
-	c.Success(UPLOAD_FILE)
+	c.Success(UploadFileTPL)
 }
 
+// UploadFilePost uploads a file
 func UploadFilePost(c *context.Context, f form.UploadRepoFile) {
 	c.PageIs("Upload")
 	renderUploadSettings(c)
@@ -450,14 +467,14 @@ func UploadFilePost(c *context.Context, f form.UploadRepoFile) {
 	c.Data["new_branch_name"] = branchName
 
 	if c.HasError() {
-		c.Success(UPLOAD_FILE)
+		c.Success(UploadFileTPL)
 		return
 	}
 
 	if oldBranchName != branchName {
 		if _, err := c.Repo.Repository.GetBranch(branchName); err == nil {
 			c.FormErr("NewBranchName")
-			c.RenderWithErr(c.Tr("repo.editor.branch_already_exists", branchName), UPLOAD_FILE, &f)
+			c.RenderWithErr(c.Tr("repo.editor.branch_already_exists", branchName), UploadFileTPL, &f)
 			return
 		}
 	}
@@ -479,7 +496,7 @@ func UploadFilePost(c *context.Context, f form.UploadRepoFile) {
 		// User can only upload files to a directory.
 		if !entry.IsDir() {
 			c.FormErr("TreePath")
-			c.RenderWithErr(c.Tr("repo.editor.directory_is_a_file", part), UPLOAD_FILE, &f)
+			c.RenderWithErr(c.Tr("repo.editor.directory_is_a_file", part), UploadFileTPL, &f)
 			return
 		}
 	}
@@ -503,7 +520,7 @@ func UploadFilePost(c *context.Context, f form.UploadRepoFile) {
 		Files:        f.Files,
 	}); err != nil {
 		c.FormErr("TreePath")
-		c.RenderWithErr(c.Tr("repo.editor.unable_to_upload_files", f.TreePath, err), UPLOAD_FILE, &f)
+		c.RenderWithErr(c.Tr("repo.editor.unable_to_upload_files", f.TreePath, err), UploadFileTPL, &f)
 		return
 	}
 

+ 1 - 0
routes/repo/http.go

@@ -29,6 +29,7 @@ import (
 	"gopkg.in/macaron.v1"
 )
 
+// HTTPContext contains the HTTP context information
 type HTTPContext struct {
 	*context.Context
 	OwnerName string

+ 36 - 21
routes/repo/issue.go

@@ -30,17 +30,29 @@ import (
 )
 
 const (
-	ISSUES     = "repo/issue/list"
-	ISSUE_NEW  = "repo/issue/new"
-	ISSUE_VIEW = "repo/issue/view"
+	// IssuesTPL page template
+	IssuesTPL = "repo/issue/list"
 
-	LABELS = "repo/issue/labels"
+	// IssuesNewTPL page template
+	IssuesNewTPL = "repo/issue/new"
 
-	MILESTONE      = "repo/issue/milestones"
-	MILESTONE_NEW  = "repo/issue/milestone_new"
-	MILESTONE_EDIT = "repo/issue/milestone_edit"
+	// IssuesViewTPL page template
+	IssuesViewTPL = "repo/issue/view"
 
-	ISSUE_TEMPLATE_KEY = "IssueTemplate"
+	// LabelsTPL page template
+	LabelsTPL = "repo/issue/labels"
+
+	// MilestoneTPL page template
+	MilestoneTPL = "repo/issue/milestones"
+
+	// MilestoneNewTPL page template
+	MilestoneNewTPL = "repo/issue/milestone_new"
+
+	// MilestoneEditTPL page template
+	MilestoneEditTPL = "repo/issue/milestone_edit"
+
+	// IssueTemplateKeyTPL page template
+	IssueTemplateKeyTPL = "IssueTemplate"
 )
 
 var (
@@ -249,7 +261,7 @@ func issues(c *context.Context, isPullList bool) {
 		c.Data["State"] = "open"
 	}
 	c.Data["Keyword"] = keyword
-	c.HTML(200, ISSUES)
+	c.HTML(200, IssuesTPL)
 }
 
 func Issues(c *context.Context) {
@@ -352,7 +364,7 @@ func NewIssue(c *context.Context) {
 	c.Data["RequireSimpleMDE"] = true
 	c.Data["title"] = c.Query("title")
 	c.Data["content"] = c.Query("body")
-	setTemplateIfExists(c, ISSUE_TEMPLATE_KEY, IssueTemplateCandidates)
+	setTemplateIfExists(c, IssueTemplateKeyTPL, IssueTemplateCandidates)
 	renderAttachmentSettings(c)
 
 	RetrieveRepoMetas(c, c.Repo.Repository)
@@ -360,7 +372,7 @@ func NewIssue(c *context.Context) {
 		return
 	}
 
-	c.HTML(200, ISSUE_NEW)
+	c.HTML(200, IssuesNewTPL)
 }
 
 func ValidateRepoMetas(c *context.Context, f form.NewIssue) ([]int64, int64, int64) {
@@ -417,6 +429,7 @@ func ValidateRepoMetas(c *context.Context, f form.NewIssue) ([]int64, int64, int
 	return labelIDs, milestoneID, assigneeID
 }
 
+// NewIssuePost creates a new issue
 func NewIssuePost(c *context.Context, f form.NewIssue) {
 	c.Data["Title"] = c.Tr("repo.issues.new")
 	c.Data["PageIsIssueList"] = true
@@ -430,7 +443,7 @@ func NewIssuePost(c *context.Context, f form.NewIssue) {
 	}
 
 	if c.HasError() {
-		c.HTML(200, ISSUE_NEW)
+		c.HTML(200, IssuesNewTPL)
 		return
 	}
 
@@ -674,7 +687,7 @@ func viewIssue(c *context.Context, isPullList bool) {
 	c.Data["Issue"] = issue
 	c.Data["IsIssueOwner"] = c.Repo.IsWriter() || (c.IsLogged && issue.IsPoster(c.User.ID))
 	c.Data["SignInLink"] = setting.AppSubURL + "/login?redirect_to=" + c.Data["Link"].(string)
-	c.HTML(200, ISSUE_VIEW)
+	c.HTML(200, IssuesViewTPL)
 }
 
 func ViewIssue(c *context.Context) {
@@ -992,7 +1005,7 @@ func Labels(c *context.Context) {
 	c.Data["PageIsLabels"] = true
 	c.Data["RequireMinicolors"] = true
 	c.Data["LabelTemplates"] = models.LabelTemplates
-	c.HTML(200, LABELS)
+	c.HTML(200, LabelsTPL)
 }
 
 func InitializeLabels(c *context.Context, f form.InitializeLabels) {
@@ -1123,7 +1136,7 @@ func Milestones(c *context.Context) {
 	}
 
 	c.Data["IsShowClosed"] = isShowClosed
-	c.HTML(200, MILESTONE)
+	c.HTML(200, MilestoneTPL)
 }
 
 func NewMilestone(c *context.Context) {
@@ -1132,9 +1145,10 @@ func NewMilestone(c *context.Context) {
 	c.Data["PageIsMilestones"] = true
 	c.Data["RequireDatetimepicker"] = true
 	c.Data["DateLang"] = setting.DateLang(c.Locale.Language())
-	c.HTML(200, MILESTONE_NEW)
+	c.HTML(200, MilestoneNewTPL)
 }
 
+// NewMilestonePost creates a new milestone
 func NewMilestonePost(c *context.Context, f form.CreateMilestone) {
 	c.Data["Title"] = c.Tr("repo.milestones.new")
 	c.Data["PageIsIssueList"] = true
@@ -1143,7 +1157,7 @@ func NewMilestonePost(c *context.Context, f form.CreateMilestone) {
 	c.Data["DateLang"] = setting.DateLang(c.Locale.Language())
 
 	if c.HasError() {
-		c.HTML(200, MILESTONE_NEW)
+		c.HTML(200, MilestoneNewTPL)
 		return
 	}
 
@@ -1153,7 +1167,7 @@ func NewMilestonePost(c *context.Context, f form.CreateMilestone) {
 	deadline, err := time.ParseInLocation("2006-01-02", f.Deadline, time.Local)
 	if err != nil {
 		c.Data["Err_Deadline"] = true
-		c.RenderWithErr(c.Tr("repo.milestones.invalid_due_date_format"), MILESTONE_NEW, &f)
+		c.RenderWithErr(c.Tr("repo.milestones.invalid_due_date_format"), MilestoneNewTPL, &f)
 		return
 	}
 
@@ -1192,9 +1206,10 @@ func EditMilestone(c *context.Context) {
 	if len(m.DeadlineString) > 0 {
 		c.Data["deadline"] = m.DeadlineString
 	}
-	c.HTML(200, MILESTONE_NEW)
+	c.HTML(200, MilestoneNewTPL)
 }
 
+// EditMilestonePost edits a milestone
 func EditMilestonePost(c *context.Context, f form.CreateMilestone) {
 	c.Data["Title"] = c.Tr("repo.milestones.edit")
 	c.Data["PageIsMilestones"] = true
@@ -1203,7 +1218,7 @@ func EditMilestonePost(c *context.Context, f form.CreateMilestone) {
 	c.Data["DateLang"] = setting.DateLang(c.Locale.Language())
 
 	if c.HasError() {
-		c.HTML(200, MILESTONE_NEW)
+		c.HTML(200, MilestoneNewTPL)
 		return
 	}
 
@@ -1213,7 +1228,7 @@ func EditMilestonePost(c *context.Context, f form.CreateMilestone) {
 	deadline, err := time.ParseInLocation("2006-01-02", f.Deadline, time.Local)
 	if err != nil {
 		c.Data["Err_Deadline"] = true
-		c.RenderWithErr(c.Tr("repo.milestones.invalid_due_date_format"), MILESTONE_NEW, &f)
+		c.RenderWithErr(c.Tr("repo.milestones.invalid_due_date_format"), MilestoneNewTPL, &f)
 		return
 	}
 

+ 29 - 19
routes/repo/pull.go

@@ -23,12 +23,20 @@ import (
 )
 
 const (
-	FORK         = "repo/pulls/fork"
-	COMPARE_PULL = "repo/pulls/compare"
-	PULL_COMMITS = "repo/pulls/commits"
-	PULL_FILES   = "repo/pulls/files"
+	// ForkTPL page template
+	ForkTPL = "repo/pulls/fork"
 
-	PULL_REQUEST_TEMPLATE_KEY = "PullRequestTemplate"
+	// ComparePullTPL page template
+	ComparePullTPL = "repo/pulls/compare"
+
+	// PullCommitsTPL page template
+	PullCommitsTPL = "repo/pulls/commits"
+
+	// PullFilesTPL page template
+	PullFilesTPL = "repo/pulls/files"
+
+	// PullRequestTemplateKeyTPL page template
+	PullRequestTemplateKeyTPL = "PullRequestTemplate"
 )
 
 var (
@@ -79,9 +87,10 @@ func Fork(c *context.Context) {
 	}
 
 	c.Data["ContextUser"] = c.User
-	c.Success(FORK)
+	c.Success(ForkTPL)
 }
 
+// ForkPost forks a repo
 func ForkPost(c *context.Context, f form.CreateRepo) {
 	c.Data["Title"] = c.Tr("new_fork")
 
@@ -97,7 +106,7 @@ func ForkPost(c *context.Context, f form.CreateRepo) {
 	c.Data["ContextUser"] = ctxUser
 
 	if c.HasError() {
-		c.Success(FORK)
+		c.Success(ForkTPL)
 		return
 	}
 
@@ -118,7 +127,7 @@ func ForkPost(c *context.Context, f form.CreateRepo) {
 
 	// Cannot fork to same owner
 	if ctxUser.ID == baseRepo.OwnerID {
-		c.RenderWithErr(c.Tr("repo.settings.cannot_fork_to_same_owner"), FORK, &f)
+		c.RenderWithErr(c.Tr("repo.settings.cannot_fork_to_same_owner"), ForkTPL, &f)
 		return
 	}
 
@@ -127,13 +136,13 @@ func ForkPost(c *context.Context, f form.CreateRepo) {
 		c.Data["Err_RepoName"] = true
 		switch {
 		case errors.IsReachLimitOfRepo(err):
-			c.RenderWithErr(c.Tr("repo.form.reach_limit_of_creation", c.User.RepoCreationNum()), FORK, &f)
+			c.RenderWithErr(c.Tr("repo.form.reach_limit_of_creation", c.User.RepoCreationNum()), ForkTPL, &f)
 		case models.IsErrRepoAlreadyExist(err):
-			c.RenderWithErr(c.Tr("repo.settings.new_owner_has_same_repo"), FORK, &f)
+			c.RenderWithErr(c.Tr("repo.settings.new_owner_has_same_repo"), ForkTPL, &f)
 		case models.IsErrNameReserved(err):
-			c.RenderWithErr(c.Tr("repo.form.name_reserved", err.(models.ErrNameReserved).Name), FORK, &f)
+			c.RenderWithErr(c.Tr("repo.form.name_reserved", err.(models.ErrNameReserved).Name), ForkTPL, &f)
 		case models.IsErrNamePatternNotAllowed(err):
-			c.RenderWithErr(c.Tr("repo.form.name_pattern_not_allowed", err.(models.ErrNamePatternNotAllowed).Pattern), FORK, &f)
+			c.RenderWithErr(c.Tr("repo.form.name_pattern_not_allowed", err.(models.ErrNamePatternNotAllowed).Pattern), ForkTPL, &f)
 		default:
 			c.ServerError("ForkPost", err)
 		}
@@ -287,7 +296,7 @@ func ViewPullCommits(c *context.Context) {
 	c.Data["Commits"] = commits
 	c.Data["CommitsCount"] = commits.Len()
 
-	c.Success(PULL_COMMITS)
+	c.Success(PullCommitsTPL)
 }
 
 func ViewPullFiles(c *context.Context) {
@@ -382,7 +391,7 @@ func ViewPullFiles(c *context.Context) {
 	}
 
 	c.Data["RequireHighlightJS"] = true
-	c.Success(PULL_FILES)
+	c.Success(PullFilesTPL)
 }
 
 func MergePullRequest(c *context.Context) {
@@ -523,7 +532,7 @@ func ParseCompareInfo(c *context.Context) (*models.User, *models.Repository, *gi
 	if err != nil {
 		if git.IsErrNoMergeBase(err) {
 			c.Data["IsNoMergeBase"] = true
-			c.Success(COMPARE_PULL)
+			c.Success(ComparePullTPL)
 		} else {
 			c.ServerError("GetPullRequestInfo", err)
 		}
@@ -597,7 +606,7 @@ func CompareAndPullRequest(c *context.Context) {
 	c.Data["PageIsComparePull"] = true
 	c.Data["IsDiffCompare"] = true
 	c.Data["RequireHighlightJS"] = true
-	setTemplateIfExists(c, PULL_REQUEST_TEMPLATE_KEY, PullRequestTemplateCandidates)
+	setTemplateIfExists(c, PullRequestTemplateKeyTPL, PullRequestTemplateCandidates)
 	renderAttachmentSettings(c)
 
 	headUser, headRepo, headGitRepo, prInfo, baseBranch, headBranch := ParseCompareInfo(c)
@@ -614,7 +623,7 @@ func CompareAndPullRequest(c *context.Context) {
 	} else {
 		c.Data["HasPullRequest"] = true
 		c.Data["PullRequest"] = pr
-		c.Success(COMPARE_PULL)
+		c.Success(ComparePullTPL)
 		return
 	}
 
@@ -637,9 +646,10 @@ func CompareAndPullRequest(c *context.Context) {
 	}
 
 	c.Data["IsSplitStyle"] = c.Query("style") == "split"
-	c.Success(COMPARE_PULL)
+	c.Success(ComparePullTPL)
 }
 
+// CompareAndPullRequestPost compares branches/forks and create a new pull request
 func CompareAndPullRequestPost(c *context.Context, f form.NewIssue) {
 	c.Data["Title"] = c.Tr("repo.pulls.compare_changes")
 	c.Data["PageIsComparePull"] = true
@@ -676,7 +686,7 @@ func CompareAndPullRequestPost(c *context.Context, f form.NewIssue) {
 			return
 		}
 
-		c.Success(COMPARE_PULL)
+		c.Success(ComparePullTPL)
 		return
 	}
 

+ 15 - 10
routes/repo/release.go

@@ -19,8 +19,11 @@ import (
 )
 
 const (
-	RELEASES    = "repo/release/list"
-	RELEASE_NEW = "repo/release/new"
+	// ReleasesTPL page template
+	ReleasesTPL = "repo/release/list"
+
+	// ReleasesNewTPL page template
+	ReleasesNewTPL = "repo/release/new"
 )
 
 // calReleaseNumCommitsBehind calculates given release has how many commits behind release target.
@@ -147,7 +150,7 @@ func Releases(c *context.Context) {
 	if len(results) > 0 {
 		c.Data["NextAfter"] = results[len(results)-1].TagName
 	}
-	c.HTML(200, RELEASES)
+	c.HTML(200, ReleasesTPL)
 }
 
 func renderReleaseAttachmentSettings(c *context.Context) {
@@ -163,21 +166,22 @@ func NewRelease(c *context.Context) {
 	c.Data["PageIsReleaseList"] = true
 	c.Data["tag_target"] = c.Repo.Repository.DefaultBranch
 	renderReleaseAttachmentSettings(c)
-	c.HTML(200, RELEASE_NEW)
+	c.HTML(200, ReleasesNewTPL)
 }
 
+// NewReleasePost creates a new release
 func NewReleasePost(c *context.Context, f form.NewRelease) {
 	c.Data["Title"] = c.Tr("repo.release.new_release")
 	c.Data["PageIsReleaseList"] = true
 	renderReleaseAttachmentSettings(c)
 
 	if c.HasError() {
-		c.HTML(200, RELEASE_NEW)
+		c.HTML(200, ReleasesNewTPL)
 		return
 	}
 
 	if !c.Repo.GitRepo.IsBranchExist(f.Target) {
-		c.RenderWithErr(c.Tr("form.target_branch_not_exist"), RELEASE_NEW, &f)
+		c.RenderWithErr(c.Tr("form.target_branch_not_exist"), ReleasesNewTPL, &f)
 		return
 	}
 
@@ -225,9 +229,9 @@ func NewReleasePost(c *context.Context, f form.NewRelease) {
 		c.Data["Err_TagName"] = true
 		switch {
 		case models.IsErrReleaseAlreadyExist(err):
-			c.RenderWithErr(c.Tr("repo.release.tag_name_already_exist"), RELEASE_NEW, &f)
+			c.RenderWithErr(c.Tr("repo.release.tag_name_already_exist"), ReleasesNewTPL, &f)
 		case models.IsErrInvalidTagName(err):
-			c.RenderWithErr(c.Tr("repo.release.tag_name_invalid"), RELEASE_NEW, &f)
+			c.RenderWithErr(c.Tr("repo.release.tag_name_invalid"), ReleasesNewTPL, &f)
 		default:
 			c.Handle(500, "NewRelease", err)
 		}
@@ -263,9 +267,10 @@ func EditRelease(c *context.Context) {
 	c.Data["prerelease"] = rel.IsPrerelease
 	c.Data["IsDraft"] = rel.IsDraft
 
-	c.HTML(200, RELEASE_NEW)
+	c.HTML(200, ReleasesNewTPL)
 }
 
+// EditReleasePost edits a release
 func EditReleasePost(c *context.Context, f form.EditRelease) {
 	c.Data["Title"] = c.Tr("repo.release.edit_release")
 	c.Data["PageIsReleaseList"] = true
@@ -291,7 +296,7 @@ func EditReleasePost(c *context.Context, f form.EditRelease) {
 	c.Data["IsDraft"] = rel.IsDraft
 
 	if c.HasError() {
-		c.HTML(200, RELEASE_NEW)
+		c.HTML(200, ReleasesNewTPL)
 		return
 	}
 

+ 18 - 13
routes/repo/repo.go

@@ -25,8 +25,11 @@ import (
 )
 
 const (
-	CREATE  = "repo/create"
-	MIGRATE = "repo/migrate"
+	// CreateTPL page template
+	CreateTPL = "repo/create"
+
+	// MigrateTPL page template
+	MigrateTPL = "repo/migrate"
 )
 
 func MustBeNotBare(c *context.Context) {
@@ -84,7 +87,7 @@ func Create(c *context.Context) {
 	}
 	c.Data["ContextUser"] = ctxUser
 
-	c.HTML(200, CREATE)
+	c.HTML(200, CreateTPL)
 }
 
 func handleCreateError(c *context.Context, owner *models.User, err error, name, tpl string, form interface{}) {
@@ -105,6 +108,7 @@ func handleCreateError(c *context.Context, owner *models.User, err error, name,
 	}
 }
 
+// CreatePost creates a new repo
 func CreatePost(c *context.Context, f form.CreateRepo) {
 	c.Data["Title"] = c.Tr("new_repo")
 
@@ -119,7 +123,7 @@ func CreatePost(c *context.Context, f form.CreateRepo) {
 	c.Data["ContextUser"] = ctxUser
 
 	if c.HasError() {
-		c.HTML(200, CREATE)
+		c.HTML(200, CreateTPL)
 		return
 	}
 
@@ -145,7 +149,7 @@ func CreatePost(c *context.Context, f form.CreateRepo) {
 		}
 	}
 
-	handleCreateError(c, ctxUser, err, "CreatePost", CREATE, &f)
+	handleCreateError(c, ctxUser, err, "CreatePost", CreateTPL, &f)
 }
 
 func Migrate(c *context.Context) {
@@ -160,9 +164,10 @@ func Migrate(c *context.Context) {
 	}
 	c.Data["ContextUser"] = ctxUser
 
-	c.HTML(200, MIGRATE)
+	c.HTML(200, MigrateTPL)
 }
 
+// MigratePost creates a new repo migration
 func MigratePost(c *context.Context, f form.MigrateRepo) {
 	c.Data["Title"] = c.Tr("new_migrate")
 
@@ -173,7 +178,7 @@ func MigratePost(c *context.Context, f form.MigrateRepo) {
 	c.Data["ContextUser"] = ctxUser
 
 	if c.HasError() {
-		c.HTML(200, MIGRATE)
+		c.HTML(200, MigrateTPL)
 		return
 	}
 
@@ -184,11 +189,11 @@ func MigratePost(c *context.Context, f form.MigrateRepo) {
 			addrErr := err.(models.ErrInvalidCloneAddr)
 			switch {
 			case addrErr.IsURLError:
-				c.RenderWithErr(c.Tr("form.url_error"), MIGRATE, &f)
+				c.RenderWithErr(c.Tr("form.url_error"), MigrateTPL, &f)
 			case addrErr.IsPermissionDenied:
-				c.RenderWithErr(c.Tr("repo.migrate.permission_denied"), MIGRATE, &f)
+				c.RenderWithErr(c.Tr("repo.migrate.permission_denied"), MigrateTPL, &f)
 			case addrErr.IsInvalidPath:
-				c.RenderWithErr(c.Tr("repo.migrate.invalid_local_path"), MIGRATE, &f)
+				c.RenderWithErr(c.Tr("repo.migrate.invalid_local_path"), MigrateTPL, &f)
 			default:
 				c.Handle(500, "Unknown error", err)
 			}
@@ -221,15 +226,15 @@ func MigratePost(c *context.Context, f form.MigrateRepo) {
 	if strings.Contains(err.Error(), "Authentication failed") ||
 		strings.Contains(err.Error(), "could not read Username") {
 		c.Data["Err_Auth"] = true
-		c.RenderWithErr(c.Tr("form.auth_failed", models.HandleMirrorCredentials(err.Error(), true)), MIGRATE, &f)
+		c.RenderWithErr(c.Tr("form.auth_failed", models.HandleMirrorCredentials(err.Error(), true)), MigrateTPL, &f)
 		return
 	} else if strings.Contains(err.Error(), "fatal:") {
 		c.Data["Err_CloneAddr"] = true
-		c.RenderWithErr(c.Tr("repo.migrate.failed", models.HandleMirrorCredentials(err.Error(), true)), MIGRATE, &f)
+		c.RenderWithErr(c.Tr("repo.migrate.failed", models.HandleMirrorCredentials(err.Error(), true)), MigrateTPL, &f)
 		return
 	}
 
-	handleCreateError(c, ctxUser, err, "MigratePost", MIGRATE, &f)
+	handleCreateError(c, ctxUser, err, "MigratePost", MigrateTPL, &f)
 }
 
 func Action(c *context.Context) {

+ 51 - 30
routes/repo/setting.go

@@ -26,23 +26,39 @@ import (
 )
 
 const (
-	SETTINGS_OPTIONS          = "repo/settings/options"
-	SETTINGS_REPO_AVATAR      = "repo/settings/avatar"
-	SETTINGS_COLLABORATION    = "repo/settings/collaboration"
-	SETTINGS_BRANCHES         = "repo/settings/branches"
-	SETTINGS_PROTECTED_BRANCH = "repo/settings/protected_branch"
-	SETTINGS_GITHOOKS         = "repo/settings/githooks"
-	SETTINGS_GITHOOK_EDIT     = "repo/settings/githook_edit"
-	SETTINGS_DEPLOY_KEYS      = "repo/settings/deploy_keys"
+	// SettingsOptionsTPL page template
+	SettingsOptionsTPL = "repo/settings/options"
+
+	// SettingsRepoAvatarTPL page template
+	SettingsRepoAvatarTPL = "repo/settings/avatar"
+
+	// SettingsCollaborationTPL page template
+	SettingsCollaborationTPL = "repo/settings/collaboration"
+
+	// SettingsBranchesTPL page template
+	SettingsBranchesTPL = "repo/settings/branches"
+
+	// SettingsProtectedBranchTPL page template
+	SettingsProtectedBranchTPL = "repo/settings/protected_branch"
+
+	// SettingsGitHooksTPL page template
+	SettingsGitHooksTPL = "repo/settings/githooks"
+
+	// SettingsGitHookEditTPL page template
+	SettingsGitHookEditTPL = "repo/settings/githook_edit"
+
+	// SettingsDeployKeysTPL page template
+	SettingsDeployKeysTPL = "repo/settings/deploy_keys"
 )
 
 func Settings(c *context.Context) {
 	c.Title("repo.settings")
 	c.PageIs("SettingsOptions")
 	c.RequireAutosize()
-	c.Success(SETTINGS_OPTIONS)
+	c.Success(SettingsOptionsTPL)
 }
 
+// SettingsPost updates settings
 func SettingsPost(c *context.Context, f form.RepoSetting) {
 	c.Title("repo.settings")
 	c.PageIs("SettingsOptions")
@@ -53,7 +69,7 @@ func SettingsPost(c *context.Context, f form.RepoSetting) {
 	switch c.Query("action") {
 	case "update":
 		if c.HasError() {
-			c.Success(SETTINGS_OPTIONS)
+			c.Success(SettingsOptionsTPL)
 			return
 		}
 
@@ -67,11 +83,11 @@ func SettingsPost(c *context.Context, f form.RepoSetting) {
 				c.FormErr("RepoName")
 				switch {
 				case models.IsErrRepoAlreadyExist(err):
-					c.RenderWithErr(c.Tr("form.repo_name_been_taken"), SETTINGS_OPTIONS, &f)
+					c.RenderWithErr(c.Tr("form.repo_name_been_taken"), SettingsOptionsTPL, &f)
 				case models.IsErrNameReserved(err):
-					c.RenderWithErr(c.Tr("repo.form.name_reserved", err.(models.ErrNameReserved).Name), SETTINGS_OPTIONS, &f)
+					c.RenderWithErr(c.Tr("repo.form.name_reserved", err.(models.ErrNameReserved).Name), SettingsOptionsTPL, &f)
 				case models.IsErrNamePatternNotAllowed(err):
-					c.RenderWithErr(c.Tr("repo.form.name_pattern_not_allowed", err.(models.ErrNamePatternNotAllowed).Pattern), SETTINGS_OPTIONS, &f)
+					c.RenderWithErr(c.Tr("repo.form.name_pattern_not_allowed", err.(models.ErrNamePatternNotAllowed).Pattern), SettingsOptionsTPL, &f)
 				default:
 					c.ServerError("ChangeRepositoryName", err)
 				}
@@ -175,7 +191,7 @@ func SettingsPost(c *context.Context, f form.RepoSetting) {
 			return
 		}
 		if repo.Name != f.RepoName {
-			c.RenderWithErr(c.Tr("form.enterred_invalid_repo_name"), SETTINGS_OPTIONS, nil)
+			c.RenderWithErr(c.Tr("form.enterred_invalid_repo_name"), SettingsOptionsTPL, nil)
 			return
 		}
 
@@ -209,7 +225,7 @@ func SettingsPost(c *context.Context, f form.RepoSetting) {
 			return
 		}
 		if repo.Name != f.RepoName {
-			c.RenderWithErr(c.Tr("form.enterred_invalid_repo_name"), SETTINGS_OPTIONS, nil)
+			c.RenderWithErr(c.Tr("form.enterred_invalid_repo_name"), SettingsOptionsTPL, nil)
 			return
 		}
 
@@ -226,13 +242,13 @@ func SettingsPost(c *context.Context, f form.RepoSetting) {
 			c.ServerError("IsUserExist", err)
 			return
 		} else if !isExist {
-			c.RenderWithErr(c.Tr("form.enterred_invalid_owner_name"), SETTINGS_OPTIONS, nil)
+			c.RenderWithErr(c.Tr("form.enterred_invalid_owner_name"), SettingsOptionsTPL, nil)
 			return
 		}
 
 		if err = models.TransferOwnership(c.User, newOwner, repo); err != nil {
 			if models.IsErrRepoAlreadyExist(err) {
-				c.RenderWithErr(c.Tr("repo.settings.new_owner_has_same_repo"), SETTINGS_OPTIONS, nil)
+				c.RenderWithErr(c.Tr("repo.settings.new_owner_has_same_repo"), SettingsOptionsTPL, nil)
 			} else {
 				c.ServerError("TransferOwnership", err)
 			}
@@ -248,7 +264,7 @@ func SettingsPost(c *context.Context, f form.RepoSetting) {
 			return
 		}
 		if repo.Name != f.RepoName {
-			c.RenderWithErr(c.Tr("form.enterred_invalid_repo_name"), SETTINGS_OPTIONS, nil)
+			c.RenderWithErr(c.Tr("form.enterred_invalid_repo_name"), SettingsOptionsTPL, nil)
 			return
 		}
 
@@ -274,7 +290,7 @@ func SettingsPost(c *context.Context, f form.RepoSetting) {
 			return
 		}
 		if repo.Name != f.RepoName {
-			c.RenderWithErr(c.Tr("form.enterred_invalid_repo_name"), SETTINGS_OPTIONS, nil)
+			c.RenderWithErr(c.Tr("form.enterred_invalid_repo_name"), SettingsOptionsTPL, nil)
 			return
 		}
 
@@ -305,9 +321,10 @@ func SettingsPost(c *context.Context, f form.RepoSetting) {
 func SettingsAvatar(c *context.Context) {
 	c.Title("settings.avatar")
 	c.PageIs("SettingsAvatar")
-	c.Success(SETTINGS_REPO_AVATAR)
+	c.Success(SettingsRepoAvatarTPL)
 }
 
+// SettingsAvatarPost updates avatar settings
 func SettingsAvatarPost(c *context.Context, f form.Avatar) {
 	f.Source = form.AVATAR_LOCAL
 	if err := UpdateAvatarSetting(c, f, c.Repo.Repository); err != nil {
@@ -370,9 +387,10 @@ func SettingsCollaboration(c *context.Context) {
 	}
 	c.Data["Collaborators"] = users
 
-	c.HTML(200, SETTINGS_COLLABORATION)
+	c.HTML(200, SettingsCollaborationTPL)
 }
 
+// SettingsCollaborationPost updates collaborator settings
 func SettingsCollaborationPost(c *context.Context) {
 	name := strings.ToLower(c.Query("collaborator"))
 	if len(name) == 0 || c.Repo.Owner.LowerName == name {
@@ -441,7 +459,7 @@ func SettingsBranches(c *context.Context) {
 
 	if c.Repo.Repository.IsBare {
 		c.Flash.Info(c.Tr("repo.settings.branches_bare"), true)
-		c.HTML(200, SETTINGS_BRANCHES)
+		c.HTML(200, SettingsBranchesTPL)
 		return
 	}
 
@@ -460,7 +478,7 @@ func SettingsBranches(c *context.Context) {
 	}
 	c.Data["ProtectBranches"] = branches
 
-	c.HTML(200, SETTINGS_BRANCHES)
+	c.HTML(200, SettingsBranchesTPL)
 }
 
 func UpdateDefaultBranch(c *context.Context) {
@@ -531,9 +549,10 @@ func SettingsProtectedBranch(c *context.Context) {
 	}
 
 	c.Data["Branch"] = protectBranch
-	c.HTML(200, SETTINGS_PROTECTED_BRANCH)
+	c.HTML(200, SettingsProtectedBranchTPL)
 }
 
+// SettingsProtectedBranchPost updates protected branch settings
 func SettingsProtectedBranchPost(c *context.Context, f form.ProtectBranch) {
 	branch := c.Params("*")
 	if !c.Repo.GitRepo.IsBranchExist(branch) {
@@ -583,7 +602,7 @@ func SettingsGitHooks(c *context.Context) {
 	}
 	c.Data["Hooks"] = hooks
 
-	c.HTML(200, SETTINGS_GITHOOKS)
+	c.HTML(200, SettingsGitHooksTPL)
 }
 
 func SettingsGitHooksEdit(c *context.Context) {
@@ -602,9 +621,10 @@ func SettingsGitHooksEdit(c *context.Context) {
 		return
 	}
 	c.Data["Hook"] = hook
-	c.HTML(200, SETTINGS_GITHOOK_EDIT)
+	c.HTML(200, SettingsGitHookEditTPL)
 }
 
+// SettingsGitHooksEditPost updates githook settings
 func SettingsGitHooksEditPost(c *context.Context) {
 	name := c.Params(":name")
 	hook, err := c.Repo.GitRepo.GetHook(name)
@@ -635,9 +655,10 @@ func SettingsDeployKeys(c *context.Context) {
 	}
 	c.Data["Deploykeys"] = keys
 
-	c.HTML(200, SETTINGS_DEPLOY_KEYS)
+	c.HTML(200, SettingsDeployKeysTPL)
 }
 
+// SettingsDeployKeysPost updates deploy keys settings
 func SettingsDeployKeysPost(c *context.Context, f form.AddSSHKey) {
 	c.Data["Title"] = c.Tr("repo.settings.deploy_keys")
 	c.Data["PageIsSettingsKeys"] = true
@@ -650,7 +671,7 @@ func SettingsDeployKeysPost(c *context.Context, f form.AddSSHKey) {
 	c.Data["Deploykeys"] = keys
 
 	if c.HasError() {
-		c.HTML(200, SETTINGS_DEPLOY_KEYS)
+		c.HTML(200, SettingsDeployKeysTPL)
 		return
 	}
 
@@ -673,10 +694,10 @@ func SettingsDeployKeysPost(c *context.Context, f form.AddSSHKey) {
 		switch {
 		case models.IsErrKeyAlreadyExist(err):
 			c.Data["Err_Content"] = true
-			c.RenderWithErr(c.Tr("repo.settings.key_been_used"), SETTINGS_DEPLOY_KEYS, &f)
+			c.RenderWithErr(c.Tr("repo.settings.key_been_used"), SettingsDeployKeysTPL, &f)
 		case models.IsErrKeyNameAlreadyUsed(err):
 			c.Data["Err_Title"] = true
-			c.RenderWithErr(c.Tr("repo.settings.key_name_used"), SETTINGS_DEPLOY_KEYS, &f)
+			c.RenderWithErr(c.Tr("repo.settings.key_name_used"), SettingsDeployKeysTPL, &f)
 		default:
 			c.Handle(500, "AddDeployKey", err)
 		}

+ 16 - 9
routes/repo/view.go

@@ -28,10 +28,17 @@ import (
 )
 
 const (
-	BARE     = "repo/bare"
-	HOME     = "repo/home"
-	WATCHERS = "repo/watchers"
-	FORKS    = "repo/forks"
+	// BareTPL page template
+	BareTPL = "repo/bare"
+
+	// HomeTPL page template
+	HomeTPL = "repo/home"
+
+	// WatchersTPL page template
+	WatchersTPL = "repo/watchers"
+
+	// ForksTPL page template
+	ForksTPL = "repo/forks"
 )
 
 func renderDirectory(c *context.Context, treeLink string) {
@@ -243,7 +250,7 @@ func Home(c *context.Context) {
 	c.Data["PageIsViewFiles"] = true
 
 	if c.Repo.Repository.IsBare {
-		c.HTML(200, BARE)
+		c.HTML(200, BareTPL)
 		return
 	}
 
@@ -317,7 +324,7 @@ func Home(c *context.Context) {
 	c.Data["TreeLink"] = treeLink
 	c.Data["TreeNames"] = treeNames
 	c.Data["BranchLink"] = branchLink
-	c.HTML(200, HOME)
+	c.HTML(200, HomeTPL)
 }
 
 func RenderUserCards(c *context.Context, total int, getter func(page int) ([]*models.User, error), tpl string) {
@@ -342,14 +349,14 @@ func Watchers(c *context.Context) {
 	c.Data["Title"] = c.Tr("repo.watchers")
 	c.Data["CardsTitle"] = c.Tr("repo.watchers")
 	c.Data["PageIsWatchers"] = true
-	RenderUserCards(c, c.Repo.Repository.NumWatches, c.Repo.Repository.GetWatchers, WATCHERS)
+	RenderUserCards(c, c.Repo.Repository.NumWatches, c.Repo.Repository.GetWatchers, WatchersTPL)
 }
 
 func Stars(c *context.Context) {
 	c.Data["Title"] = c.Tr("repo.stargazers")
 	c.Data["CardsTitle"] = c.Tr("repo.stargazers")
 	c.Data["PageIsStargazers"] = true
-	RenderUserCards(c, c.Repo.Repository.NumStars, c.Repo.Repository.GetStargazers, WATCHERS)
+	RenderUserCards(c, c.Repo.Repository.NumStars, c.Repo.Repository.GetStargazers, WatchersTPL)
 }
 
 func Forks(c *context.Context) {
@@ -369,5 +376,5 @@ func Forks(c *context.Context) {
 	}
 	c.Data["Forks"] = forks
 
-	c.HTML(200, FORKS)
+	c.HTML(200, ForksTPL)
 }

+ 18 - 8
routes/repo/webhook.go

@@ -22,9 +22,14 @@ import (
 )
 
 const (
-	WEBHOOKS        = "repo/settings/webhook/base"
-	WEBHOOK_NEW     = "repo/settings/webhook/new"
-	ORG_WEBHOOK_NEW = "org/settings/webhook_new"
+	// WebhooksTPL page template
+	WebhooksTPL = "repo/settings/webhook/base"
+
+	// WebhookNewTPL page template
+	WebhookNewTPL = "repo/settings/webhook/new"
+
+	// OrgWebhookNewTPL page template
+	OrgWebhookNewTPL = "org/settings/webhook_new"
 )
 
 func Webhooks(c *context.Context) {
@@ -41,9 +46,10 @@ func Webhooks(c *context.Context) {
 	}
 	c.Data["Webhooks"] = ws
 
-	c.HTML(200, WEBHOOKS)
+	c.HTML(200, WebhooksTPL)
 }
 
+// OrgRepoCtx contains the org repo information
 type OrgRepoCtx struct {
 	OrgID       int64
 	RepoID      int64
@@ -58,7 +64,7 @@ func getOrgRepoCtx(c *context.Context) (*OrgRepoCtx, error) {
 		return &OrgRepoCtx{
 			RepoID:      c.Repo.Repository.ID,
 			Link:        c.Repo.RepoLink,
-			NewTemplate: WEBHOOK_NEW,
+			NewTemplate: WebhookNewTPL,
 		}, nil
 	}
 
@@ -67,7 +73,7 @@ func getOrgRepoCtx(c *context.Context) (*OrgRepoCtx, error) {
 		return &OrgRepoCtx{
 			OrgID:       c.Org.Organization.ID,
 			Link:        c.Org.OrgLink,
-			NewTemplate: ORG_WEBHOOK_NEW,
+			NewTemplate: OrgWebhookNewTPL,
 		}, nil
 	}
 
@@ -122,6 +128,7 @@ func ParseHookEvent(f form.Webhook) *models.HookEvent {
 	}
 }
 
+// WebHooksNewPost creates new webhooks
 func WebHooksNewPost(c *context.Context, f form.NewWebhook) {
 	c.Data["Title"] = c.Tr("repo.settings.add_webhook")
 	c.Data["PageIsSettingsHooks"] = true
@@ -168,6 +175,7 @@ func WebHooksNewPost(c *context.Context, f form.NewWebhook) {
 	c.Redirect(orCtx.Link + "/settings/hooks")
 }
 
+// SlackHooksNewPost creates new slack hook
 func SlackHooksNewPost(c *context.Context, f form.NewSlackHook) {
 	c.Data["Title"] = c.Tr("repo.settings")
 	c.Data["PageIsSettingsHooks"] = true
@@ -218,7 +226,7 @@ func SlackHooksNewPost(c *context.Context, f form.NewSlackHook) {
 	c.Redirect(orCtx.Link + "/settings/hooks")
 }
 
-// FIXME: merge logic to Slack
+// DiscordHooksNewPost creates new discord hook
 func DiscordHooksNewPost(c *context.Context, f form.NewDiscordHook) {
 	c.Data["Title"] = c.Tr("repo.settings")
 	c.Data["PageIsSettingsHooks"] = true
@@ -321,6 +329,7 @@ func WebHooksEdit(c *context.Context) {
 	c.HTML(200, orCtx.NewTemplate)
 }
 
+// WebHooksEditPost edits webhooks
 func WebHooksEditPost(c *context.Context, f form.NewWebhook) {
 	c.Data["Title"] = c.Tr("repo.settings.update_webhook")
 	c.Data["PageIsSettingsHooks"] = true
@@ -359,6 +368,7 @@ func WebHooksEditPost(c *context.Context, f form.NewWebhook) {
 	c.Redirect(fmt.Sprintf("%s/settings/hooks/%d", orCtx.Link, w.ID))
 }
 
+// SlackHooksEditPost edits slack hooks
 func SlackHooksEditPost(c *context.Context, f form.NewSlackHook) {
 	c.Data["Title"] = c.Tr("repo.settings")
 	c.Data["PageIsSettingsHooks"] = true
@@ -402,7 +412,7 @@ func SlackHooksEditPost(c *context.Context, f form.NewSlackHook) {
 	c.Redirect(fmt.Sprintf("%s/settings/hooks/%d", orCtx.Link, w.ID))
 }
 
-// FIXME: merge logic to Slack
+// DiscordHooksEditPost edits discord hooks
 func DiscordHooksEditPost(c *context.Context, f form.NewDiscordHook) {
 	c.Data["Title"] = c.Tr("repo.settings")
 	c.Data["PageIsSettingsHooks"] = true

+ 23 - 12
routes/repo/wiki.go

@@ -19,10 +19,17 @@ import (
 )
 
 const (
-	WIKI_START = "repo/wiki/start"
-	WIKI_VIEW  = "repo/wiki/view"
-	WIKI_NEW   = "repo/wiki/new"
-	WIKI_PAGES = "repo/wiki/pages"
+	// WikiStartTPL page template
+	WikiStartTPL = "repo/wiki/start"
+
+	// WikiViewTPL page template
+	WikiViewTPL = "repo/wiki/view"
+
+	// WikiNewTPL page template
+	WikiNewTPL = "repo/wiki/new"
+
+	// WikiPagesTPL page template
+	WikiPagesTPL = "repo/wiki/pages"
 )
 
 func MustEnableWiki(c *context.Context) {
@@ -37,6 +44,7 @@ func MustEnableWiki(c *context.Context) {
 	}
 }
 
+// PageMeta contains the page meta information
 type PageMeta struct {
 	Name    string
 	URL     string
@@ -121,7 +129,7 @@ func Wiki(c *context.Context) {
 	if !c.Repo.Repository.HasWiki() {
 		c.Data["Title"] = c.Tr("repo.wiki")
 		c.Data["PageIsRepoWiki"] = true
-		c.HTML(200, WIKI_START)
+		c.HTML(200, WikiStartTPL)
 		return
 	}
 
@@ -138,7 +146,7 @@ func Wiki(c *context.Context) {
 	}
 	c.Data["Author"] = lastCommit.Author
 
-	c.HTML(200, WIKI_VIEW)
+	c.HTML(200, WikiViewTPL)
 }
 
 func WikiPages(c *context.Context) {
@@ -184,7 +192,7 @@ func WikiPages(c *context.Context) {
 	}
 	c.Data["Pages"] = pages
 
-	c.HTML(200, WIKI_PAGES)
+	c.HTML(200, WikiPagesTPL)
 }
 
 func NewWiki(c *context.Context) {
@@ -196,23 +204,24 @@ func NewWiki(c *context.Context) {
 		c.Data["title"] = "Home"
 	}
 
-	c.HTML(200, WIKI_NEW)
+	c.HTML(200, WikiNewTPL)
 }
 
+// NewWikiPost creates a new wiki
 func NewWikiPost(c *context.Context, f form.NewWiki) {
 	c.Data["Title"] = c.Tr("repo.wiki.new_page")
 	c.Data["PageIsWiki"] = true
 	c.Data["RequireSimpleMDE"] = true
 
 	if c.HasError() {
-		c.HTML(200, WIKI_NEW)
+		c.HTML(200, WikiNewTPL)
 		return
 	}
 
 	if err := c.Repo.Repository.AddWikiPage(c.User, f.Title, f.Content, f.Message); err != nil {
 		if models.IsErrWikiAlreadyExist(err) {
 			c.Data["Err_Title"] = true
-			c.RenderWithErr(c.Tr("repo.wiki.page_already_exists"), WIKI_NEW, &f)
+			c.RenderWithErr(c.Tr("repo.wiki.page_already_exists"), WikiNewTPL, &f)
 		} else {
 			c.Handle(500, "AddWikiPage", err)
 		}
@@ -237,16 +246,17 @@ func EditWiki(c *context.Context) {
 		return
 	}
 
-	c.HTML(200, WIKI_NEW)
+	c.HTML(200, WikiNewTPL)
 }
 
+// EditWikiPost edits a wiki
 func EditWikiPost(c *context.Context, f form.NewWiki) {
 	c.Data["Title"] = c.Tr("repo.wiki.new_page")
 	c.Data["PageIsWiki"] = true
 	c.Data["RequireSimpleMDE"] = true
 
 	if c.HasError() {
-		c.HTML(200, WIKI_NEW)
+		c.HTML(200, WikiNewTPL)
 		return
 	}
 
@@ -258,6 +268,7 @@ func EditWikiPost(c *context.Context, f form.NewWiki) {
 	c.Redirect(c.Repo.RepoLink + "/wiki/" + models.ToWikiPageURL(models.ToWikiPageName(f.Title)))
 }
 
+// DeleteWikiPagePost deletes a wiki
 func DeleteWikiPagePost(c *context.Context) {
 	pageURL := c.Params(":page")
 	if len(pageURL) == 0 {

+ 47 - 34
routes/user/auth.go

@@ -23,13 +23,26 @@ import (
 )
 
 const (
-	LOGIN                    = "user/auth/login"
-	TWO_FACTOR               = "user/auth/two_factor"
-	TWO_FACTOR_RECOVERY_CODE = "user/auth/two_factor_recovery_code"
-	SIGNUP                   = "user/auth/signup"
-	ACTIVATE                 = "user/auth/activate"
-	FORGOT_PASSWORD          = "user/auth/forgot_passwd"
-	RESET_PASSWORD           = "user/auth/reset_passwd"
+	// LoginTPL page template
+	LoginTPL = "user/auth/login"
+
+	// TwoFactorTPL page template
+	TwoFactorTPL = "user/auth/two_factor"
+
+	// TwoFactorRecoveryCodeTPL page template
+	TwoFactorRecoveryCodeTPL = "user/auth/two_factor_recovery_code"
+
+	// SignupTPL page template
+	SignupTPL = "user/auth/signup"
+
+	// ActivateTPL page template
+	ActivateTPL = "user/auth/activate"
+
+	// ForgotPasswordTPL page template
+	ForgotPasswordTPL = "user/auth/forgot_passwd"
+
+	// ResetPasswordTPL page template
+	ResetPasswordTPL = "user/auth/reset_passwd"
 )
 
 // AutoLogin reads cookie and try to auto-login.
@@ -121,7 +134,7 @@ func Login(c *context.Context) {
 		}
 	}
 
-	c.Success(LOGIN)
+	c.Success(LoginTPL)
 }
 
 //afterLogin set sessions cookies and redirect to "/"
@@ -165,7 +178,7 @@ func LoginPost(c *context.Context, f form.SignIn) {
 	c.Data["LoginSources"] = loginSources
 
 	if c.HasError() {
-		c.Success(LOGIN)
+		c.Success(LoginTPL)
 		return
 	}
 
@@ -174,10 +187,10 @@ func LoginPost(c *context.Context, f form.SignIn) {
 		switch err.(type) {
 		case errors.UserNotExist:
 			c.FormErr("UserName", "Password")
-			c.RenderWithErr(c.Tr("form.username_password_incorrect"), LOGIN, &f)
+			c.RenderWithErr(c.Tr("form.username_password_incorrect"), LoginTPL, &f)
 		case errors.LoginSourceMismatch:
 			c.FormErr("LoginSource")
-			c.RenderWithErr(c.Tr("form.auth_source_mismatch"), LOGIN, &f)
+			c.RenderWithErr(c.Tr("form.auth_source_mismatch"), LoginTPL, &f)
 
 		default:
 			c.ServerError("UserLogin", err)
@@ -214,7 +227,7 @@ func LoginTwoFactor(c *context.Context) {
 		return
 	}
 
-	c.Success(TWO_FACTOR)
+	c.Success(TwoFactorTPL)
 }
 
 //LoginTwoFactorPost is the POST handler for "/login" with two factors authentication
@@ -270,7 +283,7 @@ func LoginTwoFactorRecoveryCode(c *context.Context) {
 		return
 	}
 
-	c.Success(TWO_FACTOR_RECOVERY_CODE)
+	c.Success(TwoFactorRecoveryCodeTPL)
 }
 
 //LoginTwoFactorRecoveryCodePost is the POST handler to recover Two Factor Code
@@ -317,11 +330,11 @@ func SignUp(c *context.Context) {
 
 	if setting.Service.DisableRegistration {
 		c.Data["DisableRegistration"] = true
-		c.Success(SIGNUP)
+		c.Success(SignupTPL)
 		return
 	}
 
-	c.Success(SIGNUP)
+	c.Success(SignupTPL)
 }
 
 //SignUpPost is the POST handler for "/join"
@@ -336,19 +349,19 @@ func SignUpPost(c *context.Context, cpt *captcha.Captcha, f form.Register) {
 	}
 
 	if c.HasError() {
-		c.Success(SIGNUP)
+		c.Success(SignupTPL)
 		return
 	}
 
 	if setting.Service.EnableCaptcha && !cpt.VerifyReq(c.Req) {
 		c.FormErr("Captcha")
-		c.RenderWithErr(c.Tr("form.captcha_incorrect"), SIGNUP, &f)
+		c.RenderWithErr(c.Tr("form.captcha_incorrect"), SignupTPL, &f)
 		return
 	}
 
 	if f.Password != f.Retype {
 		c.FormErr("Password")
-		c.RenderWithErr(c.Tr("form.password_not_match"), SIGNUP, &f)
+		c.RenderWithErr(c.Tr("form.password_not_match"), SignupTPL, &f)
 		return
 	}
 
@@ -364,16 +377,16 @@ func SignUpPost(c *context.Context, cpt *captcha.Captcha, f form.Register) {
 		switch {
 		case models.IsErrUserAlreadyExist(err):
 			c.FormErr("UserName")
-			c.RenderWithErr(c.Tr("form.username_been_taken"), SIGNUP, &f)
+			c.RenderWithErr(c.Tr("form.username_been_taken"), SignupTPL, &f)
 		case models.IsErrEmailAlreadyUsed(err):
 			c.FormErr("Email")
-			c.RenderWithErr(c.Tr("form.email_been_used"), SIGNUP, &f)
+			c.RenderWithErr(c.Tr("form.email_been_used"), SignupTPL, &f)
 		case models.IsErrNameReserved(err):
 			c.FormErr("UserName")
-			c.RenderWithErr(c.Tr("user.form.name_reserved", err.(models.ErrNameReserved).Name), SIGNUP, &f)
+			c.RenderWithErr(c.Tr("user.form.name_reserved", err.(models.ErrNameReserved).Name), SignupTPL, &f)
 		case models.IsErrNamePatternNotAllowed(err):
 			c.FormErr("UserName")
-			c.RenderWithErr(c.Tr("user.form.name_pattern_not_allowed", err.(models.ErrNamePatternNotAllowed).Pattern), SIGNUP, &f)
+			c.RenderWithErr(c.Tr("user.form.name_pattern_not_allowed", err.(models.ErrNamePatternNotAllowed).Pattern), SignupTPL, &f)
 		default:
 			c.ServerError("CreateUser", err)
 		}
@@ -400,7 +413,7 @@ func SignUpPost(c *context.Context, cpt *captcha.Captcha, f form.Register) {
 		c.Data["IsSendRegisterMail"] = true
 		c.Data["Email"] = u.Email
 		c.Data["Hours"] = setting.Service.ActiveCodeLives / 60
-		c.Success(ACTIVATE)
+		c.Success(ActivateTPL)
 
 		if err := c.Cache.Put(u.MailResendCacheKey(), 1, 180); err != nil {
 			raven.CaptureErrorAndWait(err, nil)
@@ -437,7 +450,7 @@ func Activate(c *context.Context) {
 		} else {
 			c.Data["ServiceNotEnabled"] = true
 		}
-		c.Success(ACTIVATE)
+		c.Success(ActivateTPL)
 		return
 	}
 
@@ -463,7 +476,7 @@ func Activate(c *context.Context) {
 	}
 
 	c.Data["IsActivateFailed"] = true
-	c.Success(ACTIVATE)
+	c.Success(ActivateTPL)
 }
 
 //ActivateEmail is the handler to activate the user email
@@ -491,12 +504,12 @@ func ForgotPasswd(c *context.Context) {
 
 	if setting.MailService == nil {
 		c.Data["IsResetDisable"] = true
-		c.Success(FORGOT_PASSWORD)
+		c.Success(ForgotPasswordTPL)
 		return
 	}
 
 	c.Data["IsResetRequest"] = true
-	c.Success(FORGOT_PASSWORD)
+	c.Success(ForgotPasswordTPL)
 }
 
 //ForgotPasswdPost is the POST handler for "/user/forget_password"
@@ -517,7 +530,7 @@ func ForgotPasswdPost(c *context.Context) {
 		if errors.IsUserNotExist(err) {
 			c.Data["Hours"] = setting.Service.ActiveCodeLives / 60
 			c.Data["IsResetSent"] = true
-			c.Success(FORGOT_PASSWORD)
+			c.Success(ForgotPasswordTPL)
 			return
 		} else {
 			c.ServerError("GetUserByEmail", err)
@@ -527,13 +540,13 @@ func ForgotPasswdPost(c *context.Context) {
 
 	if !u.IsLocal() {
 		c.FormErr("Email")
-		c.RenderWithErr(c.Tr("auth.non_local_account"), FORGOT_PASSWORD, nil)
+		c.RenderWithErr(c.Tr("auth.non_local_account"), ForgotPasswordTPL, nil)
 		return
 	}
 
 	if c.Cache.IsExist(u.MailResendCacheKey()) {
 		c.Data["ResendLimited"] = true
-		c.Success(FORGOT_PASSWORD)
+		c.Success(ForgotPasswordTPL)
 		return
 	}
 
@@ -545,7 +558,7 @@ func ForgotPasswdPost(c *context.Context) {
 
 	c.Data["Hours"] = setting.Service.ActiveCodeLives / 60
 	c.Data["IsResetSent"] = true
-	c.Success(FORGOT_PASSWORD)
+	c.Success(ForgotPasswordTPL)
 }
 
 //ResetPasswd is the handler to reset your password
@@ -559,7 +572,7 @@ func ResetPasswd(c *context.Context) {
 	}
 	c.Data["Code"] = code
 	c.Data["IsResetForm"] = true
-	c.Success(RESET_PASSWORD)
+	c.Success(ResetPasswordTPL)
 }
 
 //ResetPasswdPost is the POST handler to reset your password
@@ -579,7 +592,7 @@ func ResetPasswdPost(c *context.Context) {
 		if len(passwd) < 6 {
 			c.Data["IsResetForm"] = true
 			c.Data["Err_Password"] = true
-			c.RenderWithErr(c.Tr("auth.password_too_short"), RESET_PASSWORD, nil)
+			c.RenderWithErr(c.Tr("auth.password_too_short"), ResetPasswordTPL, nil)
 			return
 		}
 
@@ -605,5 +618,5 @@ func ResetPasswdPost(c *context.Context) {
 	}
 
 	c.Data["IsResetFailed"] = true
-	c.Success(RESET_PASSWORD)
+	c.Success(ResetPasswordTPL)
 }

+ 3 - 2
routes/user/certificate.go

@@ -12,12 +12,13 @@ import (
 )
 
 const (
-	INTERNCERTIFICATE = "misc/internscert"
+	// InterCertificateTPL page template
+	InterCertificateTPL = "misc/internscert"
 )
 
 func InternCertificate(c *context.Context) {
 	ctxUser := GetUserByName(c, strings.TrimSuffix(c.Params(":username"), ""))
 	c.Data["Owner"] = ctxUser
 
-	c.HTML(200, INTERNCERTIFICATE)
+	c.HTML(200, InterCertificateTPL)
 }

+ 3 - 2
routes/user/embed.go

@@ -12,12 +12,13 @@ import (
 )
 
 const (
-	EMBED = "embed/user"
+	// EmbedTPL page template
+	EmbedTPL = "embed/user"
 )
 
 func Embed(c *context.Context) {
 	ctxUser := GetUserByName(c, strings.TrimSuffix(c.Params(":username"), ""))
 	c.Data["Owner"] = ctxUser
 
-	c.HTML(200, EMBED)
+	c.HTML(200, EmbedTPL)
 }

+ 18 - 9
routes/user/home.go

@@ -19,11 +19,20 @@ import (
 )
 
 const (
-	DASHBOARD = "user/dashboard/dashboard"
-	NEWS_FEED = "user/dashboard/feeds"
-	ISSUES    = "user/dashboard/issues"
-	PROFILE   = "user/profile"
-	ORG_HOME  = "org/home"
+	// DashboardTPL page template
+	DashboardTPL = "user/dashboard/dashboard"
+
+	// NewsFeedTPL page template
+	NewsFeedTPL = "user/dashboard/feeds"
+
+	// IssuesTPL page template
+	IssuesTPL = "user/dashboard/issues"
+
+	// ProfileTPL page template
+	ProfileTPL = "user/profile"
+
+	// OrgHomeTPL page template
+	OrgHomeTPL = "org/home"
 )
 
 // getDashboardContextUser finds out dashboard is viewing as which context user.
@@ -101,7 +110,7 @@ func Dashboard(c *context.Context) {
 	}
 
 	if c.Req.Header.Get("X-AJAX") == "true" {
-		c.HTML(200, NEWS_FEED)
+		c.HTML(200, NewsFeedTPL)
 		return
 	}
 
@@ -163,7 +172,7 @@ func Dashboard(c *context.Context) {
 	c.Data["MirrorCount"] = len(mirrors)
 	c.Data["Mirrors"] = mirrors
 
-	c.HTML(200, DASHBOARD)
+	c.HTML(200, DashboardTPL)
 }
 
 func Issues(c *context.Context) {
@@ -343,7 +352,7 @@ func Issues(c *context.Context) {
 		c.Data["State"] = "open"
 	}
 
-	c.HTML(200, ISSUES)
+	c.HTML(200, IssuesTPL)
 }
 
 func ShowSSHKeys(c *context.Context, uid int64) {
@@ -413,7 +422,7 @@ func showOrgProfile(c *context.Context) {
 
 	c.Data["Teams"] = org.Teams
 	c.Data["PageIsOrgHome"] = true
-	c.HTML(200, ORG_HOME)
+	c.HTML(200, OrgHomeTPL)
 }
 
 func Email2User(c *context.Context) {

+ 8 - 5
routes/user/profile.go

@@ -20,8 +20,11 @@ import (
 )
 
 const (
-	FOLLOWERS = "user/meta/followers"
-	STARS     = "user/meta/stars"
+	// FollowersTPL page template
+	FollowersTPL = "user/meta/followers"
+
+	// StarsTPL page template
+	StarsTPL = "user/meta/stars"
 )
 
 func GetUserByName(c *context.Context, name string) *models.User {
@@ -94,7 +97,7 @@ func Profile(c *context.Context, puser *context.ParamsUser) {
 	if puser.Suspended == true {
 		c.Handle(404, "Suspended", err)
 	} else {
-		c.Success(PROFILE)
+		c.Success(ProfileTPL)
 	}
 }
 
@@ -103,7 +106,7 @@ func Followers(c *context.Context, puser *context.ParamsUser) {
 	c.PageIs("Followers")
 	c.Data["CardsTitle"] = c.Tr("user.followers")
 	c.Data["Owner"] = puser
-	repo.RenderUserCards(c, puser.NumFollowers, puser.GetFollowers, FOLLOWERS)
+	repo.RenderUserCards(c, puser.NumFollowers, puser.GetFollowers, FollowersTPL)
 }
 
 func Following(c *context.Context, puser *context.ParamsUser) {
@@ -111,7 +114,7 @@ func Following(c *context.Context, puser *context.ParamsUser) {
 	c.PageIs("Following")
 	c.Data["CardsTitle"] = c.Tr("user.following")
 	c.Data["Owner"] = puser
-	repo.RenderUserCards(c, puser.NumFollowing, puser.GetFollowing, FOLLOWERS)
+	repo.RenderUserCards(c, puser.NumFollowing, puser.GetFollowing, FollowersTPL)
 }
 
 func Stars(c *context.Context) {

+ 70 - 41
routes/user/setting.go

@@ -30,21 +30,50 @@ import (
 )
 
 const (
-	SETTINGS_PROFILE                   = "user/settings/profile"
-	SETTINGS_SOCIAL                    = "user/settings/social"
-	SETTINGS_AVATAR                    = "user/settings/avatar"
-	SETTINGS_PASSWORD                  = "user/settings/password"
-	SETTINGS_EMAILS                    = "user/settings/email"
-	SETTINGS_SSH_KEYS                  = "user/settings/sshkeys"
-	SETTINGS_SECURITY                  = "user/settings/security"
-	SETTINGS_TWO_FACTOR_ENABLE         = "user/settings/two_factor_enable"
-	SETTINGS_TWO_FACTOR_RECOVERY_CODES = "user/settings/two_factor_recovery_codes"
-	SETTINGS_REPOSITORIES              = "user/settings/repositories"
-	SETTINGS_ORGANIZATIONS             = "user/settings/organizations"
-	SETTINGS_APPLICATIONS              = "user/settings/applications"
-	SETTINGS_EMBEDS                    = "user/settings/embeds"
-	SETTINGS_DELETE                    = "user/settings/delete"
-	NOTIFICATION                       = "user/notification"
+	// SettingsProfileTPL page template
+	SettingsProfileTPL = "user/settings/profile"
+
+	// SettingsSocialTPL page template
+	SettingsSocialTPL = "user/settings/social"
+
+	// SettingsAvatarTPL page template
+	SettingsAvatarTPL = "user/settings/avatar"
+
+	// SettingsPasswordTPL page template
+	SettingsPasswordTPL = "user/settings/password"
+
+	// SettingsEmailsTPL page template
+	SettingsEmailsTPL = "user/settings/email"
+
+	// SettingsSSHKeysTPL page template
+	SettingsSSHKeysTPL = "user/settings/sshkeys"
+
+	// SettingsSecurityTPL page template
+	SettingsSecurityTPL = "user/settings/security"
+
+	// SettingsTwoFactorEnableTPL page template
+	SettingsTwoFactorEnableTPL = "user/settings/two_factor_enable"
+
+	// SettingsTwoFactorRecoveryCodesTPL page template
+	SettingsTwoFactorRecoveryCodesTPL = "user/settings/two_factor_recovery_codes"
+
+	// SettingsRepositoriesTPL page template
+	SettingsRepositoriesTPL = "user/settings/repositories"
+
+	// SettingsOrganizationsTPL page template
+	SettingsOrganizationsTPL = "user/settings/organizations"
+
+	// SettingsApplicationsTPL page template
+	SettingsApplicationsTPL = "user/settings/applications"
+
+	// SettingsEmbedsTPL page template
+	SettingsEmbedsTPL = "user/settings/embeds"
+
+	// SettingsDeleteTPL page template
+	SettingsDeleteTPL = "user/settings/delete"
+
+	// NotificationTPL page template
+	NotificationTPL = "user/notification"
 )
 
 func Settings(c *context.Context) {
@@ -65,7 +94,7 @@ func Settings(c *context.Context) {
 	c.Data["show_ads"] = c.User.ShowAds
 	c.Data["private_email"] = c.User.PrivateEmail
 	c.Data["private_profile"] = c.User.PrivateProfile
-	c.Success(SETTINGS_PROFILE)
+	c.Success(SettingsProfileTPL)
 }
 
 func SettingsPost(c *context.Context, f form.UpdateProfile) {
@@ -74,7 +103,7 @@ func SettingsPost(c *context.Context, f form.UpdateProfile) {
 	c.Data["origin_name"] = c.User.Name
 
 	if c.HasError() {
-		c.Success(SETTINGS_PROFILE)
+		c.Success(SettingsProfileTPL)
 		return
 	}
 
@@ -97,7 +126,7 @@ func SettingsPost(c *context.Context, f form.UpdateProfile) {
 					return
 				}
 
-				c.RenderWithErr(msg, SETTINGS_PROFILE, &f)
+				c.RenderWithErr(msg, SettingsProfileTPL, &f)
 				return
 			}
 
@@ -113,7 +142,7 @@ func SettingsPost(c *context.Context, f form.UpdateProfile) {
 	if c.User.Email != email {
 		if used, err := models.IsEmailUsed(email); used {
 			c.FormErr("Email")
-			c.RenderWithErr(c.Tr("form.email_been_used"), SETTINGS_PROFILE, &f)
+			c.RenderWithErr(c.Tr("form.email_been_used"), SettingsProfileTPL, &f)
 			return
 		} else if err != nil {
 			c.ServerError("ChangeUserName", err)
@@ -156,7 +185,7 @@ func SettingsSocial(c *context.Context) {
 	c.Data["telegram"] = c.User.Telegram
 	c.Data["codepen"] = c.User.Codepen
 	c.Data["gitlab"] = c.User.Gitlab
-	c.Success(SETTINGS_SOCIAL)
+	c.Success(SettingsSocialTPL)
 }
 
 func SettingsSocialPost(c *context.Context, f form.UpdateSocial) {
@@ -165,7 +194,7 @@ func SettingsSocialPost(c *context.Context, f form.UpdateSocial) {
 	c.Data["origin_name"] = c.User.Name
 
 	if c.HasError() {
-		c.Success(SETTINGS_SOCIAL)
+		c.Success(SettingsSocialTPL)
 		return
 	}
 
@@ -233,7 +262,7 @@ func UpdateAvatarSetting(c *context.Context, f form.Avatar, ctxUser *models.User
 func SettingsAvatar(c *context.Context) {
 	c.Title("settings.avatar")
 	c.PageIs("SettingsAvatar")
-	c.Success(SETTINGS_AVATAR)
+	c.Success(SettingsAvatarTPL)
 }
 
 func SettingsAvatarPost(c *context.Context, f form.Avatar) {
@@ -257,7 +286,7 @@ func SettingsDeleteAvatar(c *context.Context) {
 func SettingsPassword(c *context.Context) {
 	c.Title("settings.password")
 	c.PageIs("SettingsPassword")
-	c.Success(SETTINGS_PASSWORD)
+	c.Success(SettingsPasswordTPL)
 }
 
 func SettingsPasswordPost(c *context.Context, f form.ChangePassword) {
@@ -265,7 +294,7 @@ func SettingsPasswordPost(c *context.Context, f form.ChangePassword) {
 	c.PageIs("SettingsPassword")
 
 	if c.HasError() {
-		c.Success(SETTINGS_PASSWORD)
+		c.Success(SettingsPasswordTPL)
 		return
 	}
 
@@ -302,7 +331,7 @@ func SettingsEmails(c *context.Context) {
 	}
 	c.Data["Emails"] = emails
 
-	c.Success(SETTINGS_EMAILS)
+	c.Success(SettingsEmailsTPL)
 }
 
 func SettingsEmailPost(c *context.Context, f form.AddEmail) {
@@ -329,7 +358,7 @@ func SettingsEmailPost(c *context.Context, f form.AddEmail) {
 	c.Data["Emails"] = emails
 
 	if c.HasError() {
-		c.Success(SETTINGS_EMAILS)
+		c.Success(SettingsEmailsTPL)
 		return
 	}
 
@@ -340,7 +369,7 @@ func SettingsEmailPost(c *context.Context, f form.AddEmail) {
 	}
 	if err := models.AddEmailAddress(email); err != nil {
 		if models.IsErrEmailAlreadyUsed(err) {
-			c.RenderWithErr(c.Tr("form.email_been_used"), SETTINGS_EMAILS, &f)
+			c.RenderWithErr(c.Tr("form.email_been_used"), SettingsEmailsTPL, &f)
 		} else {
 			c.ServerError("AddEmailAddress", err)
 		}
@@ -389,7 +418,7 @@ func SettingsSSHKeys(c *context.Context) {
 	}
 	c.Data["Keys"] = keys
 
-	c.Success(SETTINGS_SSH_KEYS)
+	c.Success(SettingsSSHKeysTPL)
 }
 
 func SettingsSSHKeysPost(c *context.Context, f form.AddSSHKey) {
@@ -404,7 +433,7 @@ func SettingsSSHKeysPost(c *context.Context, f form.AddSSHKey) {
 	c.Data["Keys"] = keys
 
 	if c.HasError() {
-		c.Success(SETTINGS_SSH_KEYS)
+		c.Success(SettingsSSHKeysTPL)
 		return
 	}
 
@@ -424,10 +453,10 @@ func SettingsSSHKeysPost(c *context.Context, f form.AddSSHKey) {
 		switch {
 		case models.IsErrKeyAlreadyExist(err):
 			c.FormErr("Content")
-			c.RenderWithErr(c.Tr("settings.ssh_key_been_used"), SETTINGS_SSH_KEYS, &f)
+			c.RenderWithErr(c.Tr("settings.ssh_key_been_used"), SettingsSSHKeysTPL, &f)
 		case models.IsErrKeyNameAlreadyUsed(err):
 			c.FormErr("Title")
-			c.RenderWithErr(c.Tr("settings.ssh_key_name_used"), SETTINGS_SSH_KEYS, &f)
+			c.RenderWithErr(c.Tr("settings.ssh_key_name_used"), SettingsSSHKeysTPL, &f)
 		default:
 			c.ServerError("AddPublicKey", err)
 		}
@@ -461,7 +490,7 @@ func SettingsSecurity(c *context.Context) {
 	}
 	c.Data["TwoFactor"] = t
 
-	c.Success(SETTINGS_SECURITY)
+	c.Success(SettingsSecurityTPL)
 }
 
 func SettingsTwoFactorEnable(c *context.Context) {
@@ -506,7 +535,7 @@ func SettingsTwoFactorEnable(c *context.Context) {
 
 	c.Session.Set("twoFactorSecret", c.Data["TwoFactorSecret"])
 	c.Session.Set("twoFactorURL", key.String())
-	c.Success(SETTINGS_TWO_FACTOR_ENABLE)
+	c.Success(SettingsTwoFactorEnableTPL)
 }
 
 func SettingsTwoFactorEnablePost(c *context.Context) {
@@ -550,7 +579,7 @@ func SettingsTwoFactorRecoveryCodes(c *context.Context) {
 	}
 	c.Data["RecoveryCodes"] = recoveryCodes
 
-	c.Success(SETTINGS_TWO_FACTOR_RECOVERY_CODES)
+	c.Success(SettingsTwoFactorRecoveryCodesTPL)
 }
 
 func SettingsTwoFactorRecoveryCodesPost(c *context.Context) {
@@ -600,7 +629,7 @@ func SettingsRepos(c *context.Context) {
 	}
 	c.Data["Repos"] = repos
 
-	c.Success(SETTINGS_REPOSITORIES)
+	c.Success(SettingsRepositoriesTPL)
 }
 
 func SettingsLeaveRepo(c *context.Context) {
@@ -632,7 +661,7 @@ func SettingsOrganizations(c *context.Context) {
 	}
 	c.Data["Orgs"] = orgs
 
-	c.Success(SETTINGS_ORGANIZATIONS)
+	c.Success(SettingsOrganizationsTPL)
 }
 
 func SettingsLeaveOrganization(c *context.Context) {
@@ -661,7 +690,7 @@ func SettingsApplications(c *context.Context) {
 	}
 	c.Data["Tokens"] = tokens
 
-	c.Success(SETTINGS_APPLICATIONS)
+	c.Success(SettingsApplicationsTPL)
 }
 
 func SettingsApplicationsPost(c *context.Context, f form.NewAccessToken) {
@@ -676,7 +705,7 @@ func SettingsApplicationsPost(c *context.Context, f form.NewAccessToken) {
 		}
 
 		c.Data["Tokens"] = tokens
-		c.Success(SETTINGS_APPLICATIONS)
+		c.Success(SettingsApplicationsTPL)
 		return
 	}
 
@@ -710,7 +739,7 @@ func SettingsEmbeds(c *context.Context) {
 	c.Title("settings.embeds")
 	c.PageIs("SettingsEmbeds")
 
-	c.Success(SETTINGS_EMBEDS)
+	c.Success(SettingsEmbedsTPL)
 }
 
 func SettingsDelete(c *context.Context) {
@@ -720,7 +749,7 @@ func SettingsDelete(c *context.Context) {
 	if c.Req.Method == "POST" {
 		if _, err := models.UserLogin(c.User.Name, c.Query("password"), c.User.LoginSource); err != nil {
 			if errors.IsUserNotExist(err) {
-				c.RenderWithErr(c.Tr("form.enterred_invalid_password"), SETTINGS_DELETE, nil)
+				c.RenderWithErr(c.Tr("form.enterred_invalid_password"), SettingsDeleteTPL, nil)
 			} else {
 				c.ServerError("UserLogin", err)
 			}
@@ -745,5 +774,5 @@ func SettingsDelete(c *context.Context) {
 		return
 	}
 
-	c.Success(SETTINGS_DELETE)
+	c.Success(SettingsDeleteTPL)
 }

+ 0 - 74
templates/admin/api.tmpl

@@ -1,74 +0,0 @@
-{{template "base/head" .}}
-<div class="admin monitor">
-	<div class="ui container">
-		<div class="ui grid">
-			{{template "admin/navbar" .}}
-			<div class="twelve wide column content">
-				{{template "base/alert" .}}
-				<h4 class="ui top attached header">
-					API 📲 <span class="ui basic green label small">Beta</span>
-				</h4>
-                <div class="ui attached segment">
-                    <h3>
-                        Version - <a href="{{AppURL}}api/{{APIVer}}/users/gitote">{{APIVer}}</a>
-                    </h3>
-                </div>
-
-                <h4 class="ui top attached header">
-					User
-				</h4>
-                <div class="ui attached segment">
-                    <h3>
-                        Soon
-                    </h3>
-                </div>
-
-                <h4 class="ui top attached header">
-					Organization
-				</h4>
-                <div class="ui attached segment">
-                    <h3>
-                        Soon
-                    </h3>
-                </div>
-
-                <h4 class="ui top attached header">
-					Repository
-				</h4>
-                <div class="ui attached segment">
-                    <h3>
-                        Soon
-                    </h3>
-                </div>
-
-                <h4 class="ui top attached header">
-					Issues
-				</h4>
-                <div class="ui attached segment">
-                    <h3>
-                        Soon
-                    </h3>
-                </div>
-
-                <h4 class="ui top attached header">
-					Admin
-				</h4>
-                <div class="ui attached segment">
-                    <h3>
-                        Soon
-                    </h3>
-                </div>
-
-                <h4 class="ui top attached header">
-					Miscellaneous
-				</h4>
-                <div class="ui attached segment">
-                    <h3>
-                        Soon
-                    </h3>
-                </div>
-			</div>
-		</div>
-	</div>
-</div>
-{{template "base/footer" .}}

+ 0 - 42
templates/admin/inbox.tmpl

@@ -1,42 +0,0 @@
-{{/** WIP - Alpha **/}}
-{{template "base/head" .}}
-<div class="admin monitor">
-	<div class="ui container">
-		<div class="ui grid">
-			{{template "admin/navbar" .}}
-			<div class="twelve wide column content">
-				{{template "base/alert" .}}
-				<h4 class="ui top attached header">
-					Inbox 📬 <span class="ui red label small">Alpha</span>
-				</h4>
-				<div class="ui unstackable attached table segment">
-					<table class="ui unstackable very basic striped table">
-						<thead>
-							<tr>
-								<th>Name</th>
-								<th>Email</th>
-								<th>Subject</th>
-								<th>Op.</th>
-							</tr>
-						</thead>
-						<tbody>
-							{{/** {{range .Entries}} **/}}
-								<tr>
-									<td>
-									    <a class="ui image label" href="{{AppSubURL}}/example">
-											<img src="https://secure.gravatar.com/avatar/554506e208edaf6c95dc896105b898f0?s=40&d=identicon"> Example
-										</a>
-									</td>
-									<td><b>me@example.com</td>
-									<td>My Account Suspended</td>
-									<td><a href="#"><i class="eye icon view-detail" data-content="{{.Description}}"></i></a></td>
-								</tr>
-							{{/** {{end}} **/}}
-						</tbody>
-					</table>
-				</div>
-			</div>
-		</div>
-	</div>
-</div>
-{{template "base/footer" .}}

+ 0 - 12
templates/admin/navbar.tmpl

@@ -8,10 +8,6 @@
 			🚦 Analytics
 			<span class="ui green basic label small">Beta</span>
 		</a>
-		<a class="item" href="{{AppSubURL}}/admin/picks">
-			😍 Staff Picks
-			<span class="ui violet basic label small">ToDo</span>
-		</a>
 		<a class="{{if .PageIsAdminNews}}active{{end}} item" href="{{AppSubURL}}/admin/news">
 			🌐 News
 			<span class="ui green basic label small">Beta</span>
@@ -31,17 +27,9 @@
 		<a class="{{if .PageIsAdminConfig}}active{{end}} item" href="{{AppSubURL}}/admin/config">
 			🛠️ Configuration
 		</a>
-		<a class="{{if .PageIsAdminAPI}}active{{end}} item" href="{{AppSubURL}}/admin/api">
-			📲 API
-			<span class="ui green basic label small">Beta</span>
-		</a>
 		<a class="{{if .PageIsAdminNotices}}active{{end}} item" href="{{AppSubURL}}/admin/notices">
 			📜 System Notices
 		</a>
-		<a class="{{if .PageIsAdminInbox}}active{{end}} item" href="{{AppSubURL}}/admin/inbox">
-			📬 Inbox
-			<span class="ui red basic label small">Alpha</span>
-		</a>
 		<a class="{{if .PageIsAdminMonitor}}active{{end}} item" href="{{AppSubURL}}/admin/monitor">
 			💻 Monitoring
 		</a>