Sfoglia il codice sorgente

Fixed GoStandards in repo routes

Yoginth 7 anni fa
parent
commit
d628316f85

+ 6 - 6
routes/repo/branch.go

@@ -19,11 +19,11 @@ import (
 )
 
 const (
-	// BranchesOverview page template
-	BranchesOverview = "repo/branches/overview"
+	// BranchesOverviewTPL page template
+	BranchesOverviewTPL = "repo/branches/overview"
 
-	// BranchesAll page template
-	BranchesAll = "repo/branches/all"
+	// BranchesAllTPL page template
+	BranchesAllTPL = "repo/branches/all"
 )
 
 type Branch struct {
@@ -96,7 +96,7 @@ func Branches(c *context.Context) {
 
 	c.Data["ActiveBranches"] = activeBranches
 	c.Data["StaleBranches"] = staleBranches
-	c.HTML(200, BranchesOverview)
+	c.HTML(200, BranchesOverviewTPL)
 }
 
 // AllBranches shows all branches page
@@ -110,7 +110,7 @@ func AllBranches(c *context.Context) {
 	}
 	c.Data["Branches"] = branches
 
-	c.HTML(200, BranchesAll)
+	c.HTML(200, BranchesAllTPL)
 }
 
 func DeleteBranchPost(c *context.Context) {

+ 8 - 8
routes/repo/commit.go

@@ -18,11 +18,11 @@ import (
 )
 
 const (
-	// COMMITS page template
-	COMMITS = "repo/commits"
+	// CommitsTPL page template
+	CommitsTPL = "repo/commits"
 
-	// DIFF page template
-	DIFF = "repo/diff/page"
+	// DiffTPL page template
+	DiffTPL = "repo/diff/page"
 )
 
 func RefCommits(c *context.Context) {
@@ -88,7 +88,7 @@ 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) {
@@ -117,7 +117,7 @@ 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) {
@@ -176,7 +176,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) {
@@ -235,5 +235,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)
 }

+ 28 - 28
routes/repo/editor.go

@@ -25,17 +25,17 @@ import (
 )
 
 const (
-	// EDIT_FILE page template
-	EDIT_FILE = "repo/editor/edit"
+	// EditFileTPL page template
+	EditFileTPL = "repo/editor/edit"
 
-	// EDIT_DIFF_PREVIEW page template
-	EDIT_DIFF_PREVIEW = "repo/editor/diff_preview"
+	// EditDiffPreviewTPL page template
+	EditDiffPreviewTPL = "repo/editor/diff_preview"
 
-	// DELETE_FILE page template
-	DELETE_FILE = "repo/editor/delete"
+	// DeleteFileTPL page template
+	DeleteFileTPL = "repo/editor/delete"
 
-	// UPLOAD_FILE page template
-	UPLOAD_FILE = "repo/editor/upload"
+	// UploadFileTPL page template
+	UploadFileTPL = "repo/editor/upload"
 )
 
 // getParentTreeFields returns list of parent tree names and corresponding tree paths
@@ -123,7 +123,7 @@ 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)
 }
 
 func EditFile(c *context.Context) {
@@ -169,20 +169,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
 		}
 	}
@@ -203,17 +203,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
 			}
 		}
@@ -224,7 +224,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)
 			}
@@ -239,7 +239,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
 				}
 			}
@@ -257,7 +257,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
 		}
 	}
@@ -287,7 +287,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
 	}
 
@@ -330,7 +330,7 @@ func DiffPreviewPost(c *context.Context, f form.EditPreviewDiff) {
 	}
 	c.Data["File"] = diff.Files[0]
 
-	c.HTML(200, EDIT_DIFF_PREVIEW)
+	c.HTML(200, EditDiffPreviewTPL)
 }
 
 func DeleteFile(c *context.Context) {
@@ -341,7 +341,7 @@ 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)
 }
 
 func DeleteFilePost(c *context.Context, f form.DeleteRepoFile) {
@@ -361,14 +361,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
 		}
 	}
@@ -426,7 +426,7 @@ 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)
 }
 
 func UploadFilePost(c *context.Context, f form.UploadRepoFile) {
@@ -457,14 +457,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
 		}
 	}
@@ -486,7 +486,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
 		}
 	}
@@ -510,7 +510,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
 	}
 

+ 29 - 29
routes/repo/issue.go

@@ -30,29 +30,29 @@ import (
 )
 
 const (
-	// ISSUES page template
-	ISSUES = "repo/issue/list"
+	// IssuesTPL page template
+	IssuesTPL = "repo/issue/list"
 
-	// ISSUE_NEW page template
-	ISSUE_NEW = "repo/issue/new"
+	// IssuesNewTPL page template
+	IssuesNewTPL = "repo/issue/new"
 
-	// ISSUE_VIEW page template
-	ISSUE_VIEW = "repo/issue/view"
+	// IssuesViewTPL page template
+	IssuesViewTPL = "repo/issue/view"
 
-	// LABELS page template
-	LABELS = "repo/issue/labels"
+	// LabelsTPL page template
+	LabelsTPL = "repo/issue/labels"
 
-	// MILESTONE page template
-	MILESTONE = "repo/issue/milestones"
+	// MilestoneTPL page template
+	MilestoneTPL = "repo/issue/milestones"
 
-	// MILESTONE_NEW page template
-	MILESTONE_NEW = "repo/issue/milestone_new"
+	// MilestoneNewTPL page template
+	MilestoneNewTPL = "repo/issue/milestone_new"
 
-	// MILESTONE_EDIT page template
-	MILESTONE_EDIT = "repo/issue/milestone_edit"
+	// MilestoneEditTPL page template
+	MilestoneEditTPL = "repo/issue/milestone_edit"
 
-	// ISSUE_TEMPLATE_KEY page template
-	ISSUE_TEMPLATE_KEY = "IssueTemplate"
+	// IssueTemplateKeyTPL page template
+	IssueTemplateKeyTPL = "IssueTemplate"
 )
 
 var (
@@ -261,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) {
@@ -364,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)
@@ -372,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) {
@@ -442,7 +442,7 @@ func NewIssuePost(c *context.Context, f form.NewIssue) {
 	}
 
 	if c.HasError() {
-		c.HTML(200, ISSUE_NEW)
+		c.HTML(200, IssuesNewTPL)
 		return
 	}
 
@@ -686,7 +686,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) {
@@ -1004,7 +1004,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) {
@@ -1135,7 +1135,7 @@ func Milestones(c *context.Context) {
 	}
 
 	c.Data["IsShowClosed"] = isShowClosed
-	c.HTML(200, MILESTONE)
+	c.HTML(200, MilestoneTPL)
 }
 
 func NewMilestone(c *context.Context) {
@@ -1144,7 +1144,7 @@ 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)
 }
 
 func NewMilestonePost(c *context.Context, f form.CreateMilestone) {
@@ -1155,7 +1155,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
 	}
 
@@ -1165,7 +1165,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
 	}
 
@@ -1204,7 +1204,7 @@ func EditMilestone(c *context.Context) {
 	if len(m.DeadlineString) > 0 {
 		c.Data["deadline"] = m.DeadlineString
 	}
-	c.HTML(200, MILESTONE_NEW)
+	c.HTML(200, MilestoneNewTPL)
 }
 
 func EditMilestonePost(c *context.Context, f form.CreateMilestone) {
@@ -1215,7 +1215,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
 	}
 
@@ -1225,7 +1225,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
 	}
 

+ 24 - 24
routes/repo/pull.go

@@ -23,20 +23,20 @@ import (
 )
 
 const (
-	// FORK page template
-	FORK = "repo/pulls/fork"
+	// ForkTPL page template
+	ForkTPL = "repo/pulls/fork"
 
-	// COMPARE_PULL page template
-	COMPARE_PULL = "repo/pulls/compare"
+	// ComparePullTPL page template
+	ComparePullTPL = "repo/pulls/compare"
 
-	// PULL_COMMITS page template
-	PULL_COMMITS = "repo/pulls/commits"
+	// PullCommitsTPL page template
+	PullCommitsTPL = "repo/pulls/commits"
 
-	// PULL_FILES page template
-	PULL_FILES = "repo/pulls/files"
+	// PullFilesTPL page template
+	PullFilesTPL = "repo/pulls/files"
 
-	// PULL_REQUEST_TEMPLATE_KEY page template
-	PULL_REQUEST_TEMPLATE_KEY = "PullRequestTemplate"
+	// PullRequestTemplateKeyTPL page template
+	PullRequestTemplateKeyTPL = "PullRequestTemplate"
 )
 
 var (
@@ -87,7 +87,7 @@ func Fork(c *context.Context) {
 	}
 
 	c.Data["ContextUser"] = c.User
-	c.Success(FORK)
+	c.Success(ForkTPL)
 }
 
 func ForkPost(c *context.Context, f form.CreateRepo) {
@@ -105,7 +105,7 @@ func ForkPost(c *context.Context, f form.CreateRepo) {
 	c.Data["ContextUser"] = ctxUser
 
 	if c.HasError() {
-		c.Success(FORK)
+		c.Success(ForkTPL)
 		return
 	}
 
@@ -126,7 +126,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
 	}
 
@@ -135,13 +135,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)
 		}
@@ -295,7 +295,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) {
@@ -390,7 +390,7 @@ func ViewPullFiles(c *context.Context) {
 	}
 
 	c.Data["RequireHighlightJS"] = true
-	c.Success(PULL_FILES)
+	c.Success(PullFilesTPL)
 }
 
 func MergePullRequest(c *context.Context) {
@@ -531,7 +531,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)
 		}
@@ -605,7 +605,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)
@@ -622,7 +622,7 @@ func CompareAndPullRequest(c *context.Context) {
 	} else {
 		c.Data["HasPullRequest"] = true
 		c.Data["PullRequest"] = pr
-		c.Success(COMPARE_PULL)
+		c.Success(ComparePullTPL)
 		return
 	}
 
@@ -645,7 +645,7 @@ func CompareAndPullRequest(c *context.Context) {
 	}
 
 	c.Data["IsSplitStyle"] = c.Query("style") == "split"
-	c.Success(COMPARE_PULL)
+	c.Success(ComparePullTPL)
 }
 
 func CompareAndPullRequestPost(c *context.Context, f form.NewIssue) {
@@ -684,7 +684,7 @@ func CompareAndPullRequestPost(c *context.Context, f form.NewIssue) {
 			return
 		}
 
-		c.Success(COMPARE_PULL)
+		c.Success(ComparePullTPL)
 		return
 	}
 

+ 12 - 12
routes/repo/release.go

@@ -19,11 +19,11 @@ import (
 )
 
 const (
-	// RELEASES page template
-	RELEASES = "repo/release/list"
+	// ReleasesTPL page template
+	ReleasesTPL = "repo/release/list"
 
-	// RELEASE_NEW page template
-	RELEASE_NEW = "repo/release/new"
+	// ReleasesNewTPL page template
+	ReleasesNewTPL = "repo/release/new"
 )
 
 // calReleaseNumCommitsBehind calculates given release has how many commits behind release target.
@@ -150,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) {
@@ -166,7 +166,7 @@ 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)
 }
 
 func NewReleasePost(c *context.Context, f form.NewRelease) {
@@ -175,12 +175,12 @@ func NewReleasePost(c *context.Context, f form.NewRelease) {
 	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
 	}
 
@@ -228,9 +228,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)
 		}
@@ -266,7 +266,7 @@ func EditRelease(c *context.Context) {
 	c.Data["prerelease"] = rel.IsPrerelease
 	c.Data["IsDraft"] = rel.IsDraft
 
-	c.HTML(200, RELEASE_NEW)
+	c.HTML(200, ReleasesNewTPL)
 }
 
 func EditReleasePost(c *context.Context, f form.EditRelease) {
@@ -294,7 +294,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
 	}
 

+ 15 - 15
routes/repo/repo.go

@@ -25,11 +25,11 @@ import (
 )
 
 const (
-	// CREATE page template
-	CREATE = "repo/create"
+	// CreateTPL page template
+	CreateTPL = "repo/create"
 
-	// MIGRATE page template
-	MIGRATE = "repo/migrate"
+	// MigrateTPL page template
+	MigrateTPL = "repo/migrate"
 )
 
 func MustBeNotBare(c *context.Context) {
@@ -87,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{}) {
@@ -122,7 +122,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
 	}
 
@@ -148,7 +148,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) {
@@ -163,7 +163,7 @@ func Migrate(c *context.Context) {
 	}
 	c.Data["ContextUser"] = ctxUser
 
-	c.HTML(200, MIGRATE)
+	c.HTML(200, MigrateTPL)
 }
 
 func MigratePost(c *context.Context, f form.MigrateRepo) {
@@ -176,7 +176,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
 	}
 
@@ -187,11 +187,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)
 			}
@@ -224,15 +224,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) {

+ 38 - 38
routes/repo/setting.go

@@ -26,36 +26,36 @@ import (
 )
 
 const (
-	// SETTINGS_OPTIONS page template
-	SETTINGS_OPTIONS = "repo/settings/options"
+	// SettingsOptionsTPL page template
+	SettingsOptionsTPL = "repo/settings/options"
 
-	// SETTINGS_REPO_AVATAR page template
-	SETTINGS_REPO_AVATAR = "repo/settings/avatar"
+	// SettingsRepoAvatarTPL page template
+	SettingsRepoAvatarTPL = "repo/settings/avatar"
 
-	// SETTINGS_COLLABORATION page template
-	SETTINGS_COLLABORATION = "repo/settings/collaboration"
+	// SettingsCollaborationTPL page template
+	SettingsCollaborationTPL = "repo/settings/collaboration"
 
-	// SETTINGS_BRANCHES page template
-	SETTINGS_BRANCHES = "repo/settings/branches"
+	// SettingsBranchesTPL page template
+	SettingsBranchesTPL = "repo/settings/branches"
 
-	// SETTINGS_PROTECTED_BRANCH page template
-	SETTINGS_PROTECTED_BRANCH = "repo/settings/protected_branch"
+	// SettingsProtectedBranchTPL page template
+	SettingsProtectedBranchTPL = "repo/settings/protected_branch"
 
-	// SETTINGS_GITHOOKS page template
-	SETTINGS_GITHOOKS = "repo/settings/githooks"
+	// SettingsGitHooksTPL page template
+	SettingsGitHooksTPL = "repo/settings/githooks"
 
-	// SETTINGS_GITHOOK_EDIT page template
-	SETTINGS_GITHOOK_EDIT = "repo/settings/githook_edit"
+	// SettingsGitHookEditTPL page template
+	SettingsGitHookEditTPL = "repo/settings/githook_edit"
 
-	// SETTINGS_DEPLOY_KEYS page template
-	SETTINGS_DEPLOY_KEYS = "repo/settings/deploy_keys"
+	// 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)
 }
 
 func SettingsPost(c *context.Context, f form.RepoSetting) {
@@ -68,7 +68,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
 		}
 
@@ -82,11 +82,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)
 				}
@@ -190,7 +190,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
 		}
 
@@ -224,7 +224,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
 		}
 
@@ -241,13 +241,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)
 			}
@@ -263,7 +263,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
 		}
 
@@ -289,7 +289,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
 		}
 
@@ -320,7 +320,7 @@ 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)
 }
 
 func SettingsAvatarPost(c *context.Context, f form.Avatar) {
@@ -385,7 +385,7 @@ func SettingsCollaboration(c *context.Context) {
 	}
 	c.Data["Collaborators"] = users
 
-	c.HTML(200, SETTINGS_COLLABORATION)
+	c.HTML(200, SettingsCollaborationTPL)
 }
 
 func SettingsCollaborationPost(c *context.Context) {
@@ -456,7 +456,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
 	}
 
@@ -475,7 +475,7 @@ func SettingsBranches(c *context.Context) {
 	}
 	c.Data["ProtectBranches"] = branches
 
-	c.HTML(200, SETTINGS_BRANCHES)
+	c.HTML(200, SettingsBranchesTPL)
 }
 
 func UpdateDefaultBranch(c *context.Context) {
@@ -546,7 +546,7 @@ func SettingsProtectedBranch(c *context.Context) {
 	}
 
 	c.Data["Branch"] = protectBranch
-	c.HTML(200, SETTINGS_PROTECTED_BRANCH)
+	c.HTML(200, SettingsProtectedBranchTPL)
 }
 
 func SettingsProtectedBranchPost(c *context.Context, f form.ProtectBranch) {
@@ -598,7 +598,7 @@ func SettingsGitHooks(c *context.Context) {
 	}
 	c.Data["Hooks"] = hooks
 
-	c.HTML(200, SETTINGS_GITHOOKS)
+	c.HTML(200, SettingsGitHooksTPL)
 }
 
 func SettingsGitHooksEdit(c *context.Context) {
@@ -617,7 +617,7 @@ func SettingsGitHooksEdit(c *context.Context) {
 		return
 	}
 	c.Data["Hook"] = hook
-	c.HTML(200, SETTINGS_GITHOOK_EDIT)
+	c.HTML(200, SettingsGitHookEditTPL)
 }
 
 func SettingsGitHooksEditPost(c *context.Context) {
@@ -650,7 +650,7 @@ func SettingsDeployKeys(c *context.Context) {
 	}
 	c.Data["Deploykeys"] = keys
 
-	c.HTML(200, SETTINGS_DEPLOY_KEYS)
+	c.HTML(200, SettingsDeployKeysTPL)
 }
 
 func SettingsDeployKeysPost(c *context.Context, f form.AddSSHKey) {
@@ -665,7 +665,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
 	}
 
@@ -688,10 +688,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)
 		}

+ 13 - 13
routes/repo/view.go

@@ -28,17 +28,17 @@ import (
 )
 
 const (
-	// BARE page template
-	BARE = "repo/bare"
+	// BareTPL page template
+	BareTPL = "repo/bare"
 
-	// HOME page template
-	HOME = "repo/home"
+	// HomeTPL page template
+	HomeTPL = "repo/home"
 
-	// WATCHERS page template
-	WATCHERS = "repo/watchers"
+	// WatchersTPL page template
+	WatchersTPL = "repo/watchers"
 
-	// FORKS page template
-	FORKS = "repo/forks"
+	// ForksTPL page template
+	ForksTPL = "repo/forks"
 )
 
 func renderDirectory(c *context.Context, treeLink string) {
@@ -250,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
 	}
 
@@ -324,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) {
@@ -349,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) {
@@ -376,5 +376,5 @@ func Forks(c *context.Context) {
 	}
 	c.Data["Forks"] = forks
 
-	c.HTML(200, FORKS)
+	c.HTML(200, ForksTPL)
 }

+ 9 - 9
routes/repo/webhook.go

@@ -22,14 +22,14 @@ import (
 )
 
 const (
-	// WEBHOOKS page template
-	WEBHOOKS = "repo/settings/webhook/base"
+	// WebhooksTPL page template
+	WebhooksTPL = "repo/settings/webhook/base"
 
-	// WEBHOOK_NEW page template
-	WEBHOOK_NEW = "repo/settings/webhook/new"
+	// WebhookNewTPL page template
+	WebhookNewTPL = "repo/settings/webhook/new"
 
-	// ORG_WEBHOOK_NEW page template
-	ORG_WEBHOOK_NEW = "org/settings/webhook_new"
+	// OrgWebhookNewTPL page template
+	OrgWebhookNewTPL = "org/settings/webhook_new"
 )
 
 func Webhooks(c *context.Context) {
@@ -46,7 +46,7 @@ func Webhooks(c *context.Context) {
 	}
 	c.Data["Webhooks"] = ws
 
-	c.HTML(200, WEBHOOKS)
+	c.HTML(200, WebhooksTPL)
 }
 
 type OrgRepoCtx struct {
@@ -63,7 +63,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
 	}
 
@@ -72,7 +72,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
 	}
 

+ 16 - 16
routes/repo/wiki.go

@@ -19,17 +19,17 @@ import (
 )
 
 const (
-	// WIKI_START page template
-	WIKI_START = "repo/wiki/start"
+	// WikiStartTPL page template
+	WikiStartTPL = "repo/wiki/start"
 
-	// WIKI_VIEW page template
-	WIKI_VIEW = "repo/wiki/view"
+	// WikiViewTPL page template
+	WikiViewTPL = "repo/wiki/view"
 
-	// WIKI_NEW page template
-	WIKI_NEW = "repo/wiki/new"
+	// WikiNewTPL page template
+	WikiNewTPL = "repo/wiki/new"
 
-	// WIKI_PAGES page template
-	WIKI_PAGES = "repo/wiki/pages"
+	// WikiPagesTPL page template
+	WikiPagesTPL = "repo/wiki/pages"
 )
 
 func MustEnableWiki(c *context.Context) {
@@ -128,7 +128,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
 	}
 
@@ -145,7 +145,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) {
@@ -191,7 +191,7 @@ func WikiPages(c *context.Context) {
 	}
 	c.Data["Pages"] = pages
 
-	c.HTML(200, WIKI_PAGES)
+	c.HTML(200, WikiPagesTPL)
 }
 
 func NewWiki(c *context.Context) {
@@ -203,7 +203,7 @@ func NewWiki(c *context.Context) {
 		c.Data["title"] = "Home"
 	}
 
-	c.HTML(200, WIKI_NEW)
+	c.HTML(200, WikiNewTPL)
 }
 
 func NewWikiPost(c *context.Context, f form.NewWiki) {
@@ -212,14 +212,14 @@ func NewWikiPost(c *context.Context, f form.NewWiki) {
 	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)
 		}
@@ -244,7 +244,7 @@ func EditWiki(c *context.Context) {
 		return
 	}
 
-	c.HTML(200, WIKI_NEW)
+	c.HTML(200, WikiNewTPL)
 }
 
 func EditWikiPost(c *context.Context, f form.NewWiki) {
@@ -253,7 +253,7 @@ func EditWikiPost(c *context.Context, f form.NewWiki) {
 	c.Data["RequireSimpleMDE"] = true
 
 	if c.HasError() {
-		c.HTML(200, WIKI_NEW)
+		c.HTML(200, WikiNewTPL)
 		return
 	}