mirror of
https://github.com/go-gitea/gitea
synced 2024-10-19 20:10:10 +02:00
improve variable name
This commit is contained in:
parent
648d0a0953
commit
b45f907347
@ -405,7 +405,7 @@ func repoAssignment(ctx *Context, repo *repo_model.Repository) {
|
||||
ctx.ServerError("GetRepoLicenses", err)
|
||||
return
|
||||
}
|
||||
ctx.Data["Licenses"] = repoLicenses.StringList()
|
||||
ctx.Data["DetectedRepoLicenses"] = repoLicenses.StringList()
|
||||
}
|
||||
|
||||
// RepoIDAssignment returns a handler which assigns the repo to the context.
|
||||
|
@ -222,8 +222,8 @@ func UpdateRepoLicenses(ctx context.Context, repo *repo_model.Repository, commit
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetLicenseFileName returns license file name in the repository if it exists
|
||||
func GetLicenseFileName(ctx context.Context, repo *repo_model.Repository, commit *git.Commit) (string, error) {
|
||||
// GetDetectedLicenseFileName returns license file name in the repository if it exists
|
||||
func GetDetectedLicenseFileName(ctx context.Context, repo *repo_model.Repository, commit *git.Commit) (string, error) {
|
||||
if commit == nil {
|
||||
return "", nil
|
||||
}
|
||||
|
@ -84,9 +84,9 @@ func Branches(ctx *context.Context) {
|
||||
pager.SetDefaultParams(ctx)
|
||||
ctx.Data["Page"] = pager
|
||||
|
||||
ctx.Data["LicenseFileName"], err = repo_module.GetLicenseFileName(ctx, ctx.Repo.Repository, ctx.Repo.Commit)
|
||||
ctx.Data["DetectedLicenseFileName"], err = repo_module.GetDetectedLicenseFileName(ctx, ctx.Repo.Repository, ctx.Repo.Commit)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetLicenseFileName", err)
|
||||
ctx.ServerError("GetDetectedLicenseFileName", err)
|
||||
return
|
||||
}
|
||||
ctx.HTML(http.StatusOK, tplBranch)
|
||||
|
@ -86,9 +86,9 @@ func Commits(ctx *context.Context) {
|
||||
pager := context.NewPagination(int(commitsCount), pageSize, page, 5)
|
||||
pager.SetDefaultParams(ctx)
|
||||
ctx.Data["Page"] = pager
|
||||
ctx.Data["LicenseFileName"], err = repo_module.GetLicenseFileName(ctx, ctx.Repo.Repository, ctx.Repo.Commit)
|
||||
ctx.Data["DetectedLicenseFileName"], err = repo_module.GetDetectedLicenseFileName(ctx, ctx.Repo.Repository, ctx.Repo.Commit)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetLicenseFileName", err)
|
||||
ctx.ServerError("GetDetectedLicenseFileName", err)
|
||||
return
|
||||
}
|
||||
ctx.HTML(http.StatusOK, tplCommits)
|
||||
@ -208,9 +208,9 @@ func SearchCommits(ctx *context.Context) {
|
||||
ctx.Data["Username"] = ctx.Repo.Owner.Name
|
||||
ctx.Data["Reponame"] = ctx.Repo.Repository.Name
|
||||
ctx.Data["RefName"] = ctx.Repo.RefName
|
||||
ctx.Data["LicenseFileName"], err = repo_module.GetLicenseFileName(ctx, ctx.Repo.Repository, ctx.Repo.Commit)
|
||||
ctx.Data["DetectedLicenseFileName"], err = repo_module.GetDetectedLicenseFileName(ctx, ctx.Repo.Repository, ctx.Repo.Commit)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetLicenseFileName", err)
|
||||
ctx.ServerError("GetDetectedLicenseFileName", err)
|
||||
return
|
||||
}
|
||||
ctx.HTML(http.StatusOK, tplCommits)
|
||||
@ -261,9 +261,9 @@ func FileHistory(ctx *context.Context) {
|
||||
pager.SetDefaultParams(ctx)
|
||||
ctx.Data["Page"] = pager
|
||||
|
||||
ctx.Data["LicenseFileName"], err = repo_module.GetLicenseFileName(ctx, ctx.Repo.Repository, ctx.Repo.Commit)
|
||||
ctx.Data["DetectedLicenseFileName"], err = repo_module.GetDetectedLicenseFileName(ctx, ctx.Repo.Repository, ctx.Repo.Commit)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetLicenseFileName", err)
|
||||
ctx.ServerError("GetDetectedLicenseFileName", err)
|
||||
return
|
||||
}
|
||||
ctx.HTML(http.StatusOK, tplCommits)
|
||||
|
@ -913,9 +913,9 @@ func renderCode(ctx *context.Context) {
|
||||
ctx.Data["TreeLink"] = treeLink
|
||||
ctx.Data["TreeNames"] = treeNames
|
||||
ctx.Data["BranchLink"] = branchLink
|
||||
ctx.Data["LicenseFileName"], err = repo_module.GetLicenseFileName(ctx, ctx.Repo.Repository, ctx.Repo.Commit)
|
||||
ctx.Data["DetectedLicenseFileName"], err = repo_module.GetDetectedLicenseFileName(ctx, ctx.Repo.Repository, ctx.Repo.Commit)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetLicenseFileName", err)
|
||||
ctx.ServerError("GetDetectedLicenseFileName", err)
|
||||
return
|
||||
}
|
||||
ctx.HTML(http.StatusOK, tplRepoHome)
|
||||
|
@ -13,9 +13,9 @@
|
||||
{{svg "octicon-tag"}} <b>{{ctx.Locale.PrettyNumber .NumTags}}</b> {{ctx.Locale.TrN .NumTags "repo.tag" "repo.tags"}}
|
||||
</a>
|
||||
{{end}}
|
||||
{{if .Licenses}}
|
||||
<a class="item muted" href="{{.RepoLink}}/src/{{.DefaultBranch}}/{{PathEscapeSegments .LicenseFileName}}" data-tooltip-content="{{StringUtils.Join .Licenses ", "}}">
|
||||
{{svg "octicon-law"}} <b>{{if eq (len .Licenses) 1}}{{index .Licenses 0}}{{else}}{{.locale.Tr "repo.multiple_licenses"}}{{end}}</b>
|
||||
{{if .DetectedRepoLicenses}}
|
||||
<a class="item muted" href="{{.RepoLink}}/src/{{.DefaultBranch}}/{{PathEscapeSegments .DetectedLicenseFileName}}" data-tooltip-content="{{StringUtils.Join .DetectedRepoLicenses ", "}}">
|
||||
{{svg "octicon-law"}} <b>{{if eq (len .DetectedRepoLicenses) 1}}{{index .DetectedRepoLicenses 0}}{{else}}{{.locale.Tr "repo.multiple_licenses"}}{{end}}</b>
|
||||
</a>
|
||||
{{end}}
|
||||
<span class="item not-mobile" {{if not (eq .Repository.Size 0)}}data-tooltip-content="{{.Repository.SizeDetailsString}}"{{end}}>
|
||||
|
Loading…
Reference in New Issue
Block a user