improve variable name

This commit is contained in:
yp05327 2023-11-24 06:22:19 +00:00
parent 648d0a0953
commit b45f907347
6 changed files with 16 additions and 16 deletions

View File

@ -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.

View File

@ -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
}

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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}}>