From 68704532c28cf09db96c988291b2f82c5e615984 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sat, 10 Dec 2022 10:46:31 +0800 Subject: Rename almost all Ctx functions (#22071) --- templates/admin/config.tmpl | 2 +- templates/org/team/new.tmpl | 8 ++--- templates/org/team/sidebar.tmpl | 6 ++-- templates/repo/editor/commit_form.tmpl | 4 +-- templates/repo/graph/commits.tmpl | 2 +- templates/repo/header.tmpl | 2 +- templates/repo/issue/view_content/pull.tmpl | 2 +- templates/repo/issue/view_content/sidebar.tmpl | 4 +-- templates/repo/settings/collaboration.tmpl | 2 +- templates/repo/settings/options.tmpl | 46 +++++++++++++------------- 10 files changed, 39 insertions(+), 39 deletions(-) (limited to 'templates') diff --git a/templates/admin/config.tmpl b/templates/admin/config.tmpl index 982cfb2800..de33c6c553 100644 --- a/templates/admin/config.tmpl +++ b/templates/admin/config.tmpl @@ -177,7 +177,7 @@
{{.locale.Tr "admin.config.default_enable_timetracking"}}
{{if .Service.DefaultEnableTimetracking}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}
{{.locale.Tr "admin.config.default_allow_only_contributors_to_track_time"}}
-
{{if .Service.DefaultAllowOnlyContributorsToTrackTime}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}
+
{{if .Service.DefaultAllowOnlyContributorsToTrackTime $.Context}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}
{{end}}
{{.locale.Tr "admin.config.default_visibility_organization"}}
{{.Service.DefaultOrgVisibility}}
diff --git a/templates/org/team/new.tmpl b/templates/org/team/new.tmpl index f6786f3d8d..10b5abda31 100644 --- a/templates/org/team/new.tmpl +++ b/templates/org/team/new.tmpl @@ -99,17 +99,17 @@
- +
- +
- +
@@ -121,7 +121,7 @@ {{if lt $unit.MaxPerm 2}}
- + {{$.locale.Tr $unit.DescKey}}
diff --git a/templates/org/team/sidebar.tmpl b/templates/org/team/sidebar.tmpl index 5d952b501e..ab118a7e26 100644 --- a/templates/org/team/sidebar.tmpl +++ b/templates/org/team/sidebar.tmpl @@ -61,11 +61,11 @@ {{if and (lt $unit.MaxPerm 2) (not $unit.Type.UnitGlobalDisabled)}} {{$.locale.Tr $unit.NameKey}} - {{if eq ($.Team.UnitAccessMode $unit.Type) 0 -}} + {{if eq ($.Team.UnitAccessMode $.Context $unit.Type) 0 -}} {{$.locale.Tr "org.teams.none_access"}} - {{- else if or (eq $.Team.ID 0) (eq ($.Team.UnitAccessMode $unit.Type) 1) -}} + {{- else if or (eq $.Team.ID 0) (eq ($.Team.UnitAccessMode $.Context $unit.Type) 1) -}} {{$.locale.Tr "org.teams.read_access"}} - {{- else if eq ($.Team.UnitAccessMode $unit.Type) 2 -}} + {{- else if eq ($.Team.UnitAccessMode $.Context $unit.Type) 2 -}} {{$.locale.Tr "org.teams.write_access"}} {{- end}} diff --git a/templates/repo/editor/commit_form.tmpl b/templates/repo/editor/commit_form.tmpl index 95fcf2b855..8700f77401 100644 --- a/templates/repo/editor/commit_form.tmpl +++ b/templates/repo/editor/commit_form.tmpl @@ -40,8 +40,8 @@
- {{$pullRequestEnabled := .Repository.UnitEnabled $.UnitTypePullRequests}} - {{$prUnit := .Repository.MustGetUnit $.UnitTypePullRequests}} + {{$pullRequestEnabled := .Repository.UnitEnabled $.Context $.UnitTypePullRequests}} + {{$prUnit := .Repository.MustGetUnit $.Context $.UnitTypePullRequests}}
{{if $pullRequestEnabled}} diff --git a/templates/repo/graph/commits.tmpl b/templates/repo/graph/commits.tmpl index 357c99b2b8..fc4b1a1ea3 100644 --- a/templates/repo/graph/commits.tmpl +++ b/templates/repo/graph/commits.tmpl @@ -37,7 +37,7 @@ {{if eq $refGroup "pull"}} {{if or (not $.HidePRRefs) (containGeneric $.SelectedBranches .Name)}} - + {{svg "octicon-git-pull-request" 16 "mr-2"}}#{{.ShortName}} {{end}} diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index c706e00777..4da91e424d 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -208,7 +208,7 @@ {{end}} {{if or (.Permission.CanRead $.UnitTypeWiki) (.Permission.CanRead $.UnitTypeExternalWiki)}} - + {{svg "octicon-book"}} {{.locale.Tr "repo.wiki"}} {{end}} diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index 9e0909064d..d68f3e5414 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -330,7 +330,7 @@ {{end}} {{if .AllowMerge}} {{/* user is allowed to merge */}} - {{$prUnit := .Repository.MustGetUnit $.UnitTypePullRequests}} + {{$prUnit := .Repository.MustGetUnit $.Context $.UnitTypePullRequests}} {{$approvers := .Issue.PullRequest.GetApprovers}} {{if or $prUnit.PullRequestsConfig.AllowMerge $prUnit.PullRequestsConfig.AllowRebase $prUnit.PullRequestsConfig.AllowRebaseMerge $prUnit.PullRequestsConfig.AllowSquash}} {{$hasPendingPullRequestMergeTip := ""}} diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index af648387db..63b99136a8 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -337,7 +337,7 @@
{{end}} - {{if .Repository.IsTimetrackerEnabled}} + {{if .Repository.IsTimetrackerEnabled $.Context}} {{if and .CanUseTimetracker (not .Repository.IsArchived)}}
@@ -444,7 +444,7 @@ {{end}}
- {{if .Repository.IsDependenciesEnabled}} + {{if .Repository.IsDependenciesEnabled $.Context}}
diff --git a/templates/repo/settings/collaboration.tmpl b/templates/repo/settings/collaboration.tmpl index 342b260db6..2f932b4c39 100644 --- a/templates/repo/settings/collaboration.tmpl +++ b/templates/repo/settings/collaboration.tmpl @@ -74,7 +74,7 @@ {{if or (eq .AccessMode 1) (eq .AccessMode 2)}} {{$first := true}}
- Sections: {{range $u, $unit := $.Units}}{{if and ($.Repo.UnitEnabled $unit.Type) ($team.UnitEnabled $unit.Type)}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{$.locale.Tr $unit.NameKey}}{{end}}{{end}} {{if $first}}None{{end}} + Sections: {{range $u, $unit := $.Units}}{{if and ($.Repo.UnitEnabled $.Context $unit.Type) ($team.UnitEnabled $.Context $unit.Type)}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{$.locale.Tr $unit.NameKey}}{{end}}{{end}} {{if $first}}None{{end}}
{{end}}
diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl index 3c5996e903..aa79f75617 100644 --- a/templates/repo/settings/options.tmpl +++ b/templates/repo/settings/options.tmpl @@ -249,7 +249,7 @@ {{.CsrfTokenHtml}} - {{$isWikiEnabled := or (.Repository.UnitEnabled $.UnitTypeWiki) (.Repository.UnitEnabled $.UnitTypeExternalWiki)}} + {{$isWikiEnabled := or (.Repository.UnitEnabled $.Context $.UnitTypeWiki) (.Repository.UnitEnabled $.Context $.UnitTypeExternalWiki)}}
{{if and (.UnitTypeWiki.UnitGlobalDisabled) (.UnitTypeExternalWiki.UnitGlobalDisabled)}} @@ -268,7 +268,7 @@ {{else}}
{{end}} - +
@@ -278,20 +278,20 @@ {{else}}
{{end}} - +
-
+
- +

{{.locale.Tr "repo.settings.external_wiki_url_desc"}}

- {{$isIssuesEnabled := or (.Repository.UnitEnabled $.UnitTypeIssues) (.Repository.UnitEnabled $.UnitTypeExternalTracker)}} + {{$isIssuesEnabled := or (.Repository.UnitEnabled $.Context $.UnitTypeIssues) (.Repository.UnitEnabled $.Context $.UnitTypeExternalTracker)}}
{{if and (.UnitTypeIssues.UnitGlobalDisabled) (.UnitTypeExternalTracker.UnitGlobalDisabled)}} @@ -310,28 +310,28 @@ {{else}}
{{end}} - +
-
+
{{if .Repository.CanEnableTimetracker}}
- +
-
+
- +
{{end}}
- +
@@ -346,26 +346,26 @@ {{else}}
{{end}} - +
-
+
- +

{{.locale.Tr "repo.settings.external_tracker_url_desc"}}

- +

{{.locale.Tr "repo.settings.tracker_url_format_desc" | Str2html}}

- {{$externalTracker := (.Repository.MustGetUnit $.UnitTypeExternalTracker)}} + {{$externalTracker := (.Repository.MustGetUnit $.Context $.UnitTypeExternalTracker)}} {{$externalTrackerStyle := $externalTracker.ExternalTrackerConfig.ExternalTrackerStyle}} @@ -386,7 +386,7 @@
- +

{{.locale.Tr "repo.settings.tracker_issue_style.regexp_pattern_desc" | Str2html}}

@@ -394,7 +394,7 @@
- {{$isProjectsEnabled := .Repository.UnitEnabled $.UnitTypeProjects}} + {{$isProjectsEnabled := .Repository.UnitEnabled $.Context $.UnitTypeProjects}}
{{if .UnitTypeProjects.UnitGlobalDisabled}} @@ -407,7 +407,7 @@
- {{$isPackagesEnabled := .Repository.UnitEnabled $.UnitTypePackages}} + {{$isPackagesEnabled := .Repository.UnitEnabled $.Context $.UnitTypePackages}}
{{if .UnitTypePackages.UnitGlobalDisabled}} @@ -422,8 +422,8 @@ {{if not .IsMirror}}
- {{$pullRequestEnabled := .Repository.UnitEnabled $.UnitTypePullRequests}} - {{$prUnit := .Repository.MustGetUnit $.UnitTypePullRequests}} + {{$pullRequestEnabled := .Repository.UnitEnabled $.Context $.UnitTypePullRequests}} + {{$prUnit := .Repository.MustGetUnit $.Context $.UnitTypePullRequests}}
{{if .UnitTypePullRequests.UnitGlobalDisabled}} @@ -880,7 +880,7 @@
- {{if .Repository.UnitEnabled $.UnitTypeWiki}} + {{if .Repository.UnitEnabled $.Context $.UnitTypeWiki}}