|
64 | 64 | {{if not $.DisableStars}}
|
65 | 65 | {{template "repo/star_unstar" $}}
|
66 | 66 | {{end}}
|
67 |
| - {{if and (not .IsEmpty) ($.Permission.CanRead $.UnitTypeCode)}} |
| 67 | + {{if and (not .IsEmpty) ($.Permission.CanRead ctx.Consts.RepoUnitTypeCode)}} |
68 | 68 | <div class="ui labeled button
|
69 | 69 | {{if or (not $.IsSigned) (and (not $.CanSignedUserFork) (not $.UserAndOrgForks))}}
|
70 | 70 | disabled
|
|
131 | 131 | <overflow-menu class="ui container secondary pointing tabular top attached borderless menu tw-pt-0 tw-my-0">
|
132 | 132 | {{if not (or .Repository.IsBeingCreated .Repository.IsBroken)}}
|
133 | 133 | <div class="overflow-menu-items">
|
134 |
| - {{if .Permission.CanRead $.UnitTypeCode}} |
| 134 | + {{if .Permission.CanRead ctx.Consts.RepoUnitTypeCode}} |
135 | 135 | <a class="{{if .PageIsViewCode}}active {{end}}item" href="{{.RepoLink}}{{if and (ne .BranchName .Repository.DefaultBranch) (not $.PageIsWiki)}}/src/{{.BranchNameSubURL}}{{end}}">
|
136 | 136 | {{svg "octicon-code"}} {{ctx.Locale.Tr "repo.code"}}
|
137 | 137 | </a>
|
138 | 138 | {{end}}
|
139 | 139 |
|
140 |
| - {{if .Permission.CanRead $.UnitTypeIssues}} |
| 140 | + {{if .Permission.CanRead ctx.Consts.RepoUnitTypeIssues}} |
141 | 141 | <a class="{{if .PageIsIssueList}}active {{end}}item" href="{{.RepoLink}}/issues">
|
142 | 142 | {{svg "octicon-issue-opened"}} {{ctx.Locale.Tr "repo.issues"}}
|
143 | 143 | {{if .Repository.NumOpenIssues}}
|
|
146 | 146 | </a>
|
147 | 147 | {{end}}
|
148 | 148 |
|
149 |
| - {{if .Permission.CanRead $.UnitTypeExternalTracker}} |
| 149 | + {{if .Permission.CanRead ctx.Consts.RepoUnitTypeExternalTracker}} |
150 | 150 | <a class="{{if .PageIsIssueList}}active {{end}}item" href="{{.RepoExternalIssuesLink}}" target="_blank" rel="noopener noreferrer">
|
151 | 151 | {{svg "octicon-link-external"}} {{ctx.Locale.Tr "repo.issues"}}
|
152 | 152 | </a>
|
153 | 153 | {{end}}
|
154 | 154 |
|
155 |
| - {{if and .Repository.CanEnablePulls (.Permission.CanRead $.UnitTypePullRequests)}} |
| 155 | + {{if and .Repository.CanEnablePulls (.Permission.CanRead ctx.Consts.RepoUnitTypePullRequests)}} |
156 | 156 | <a class="{{if .PageIsPullList}}active {{end}}item" href="{{.RepoLink}}/pulls">
|
157 | 157 | {{svg "octicon-git-pull-request"}} {{ctx.Locale.Tr "repo.pulls"}}
|
158 | 158 | {{if .Repository.NumOpenPulls}}
|
|
161 | 161 | </a>
|
162 | 162 | {{end}}
|
163 | 163 |
|
164 |
| - {{if and .EnableActions (not .UnitActionsGlobalDisabled) (.Permission.CanRead $.UnitTypeActions)}} |
| 164 | + {{if and .EnableActions (not .UnitActionsGlobalDisabled) (.Permission.CanRead ctx.Consts.RepoUnitTypeActions)}} |
165 | 165 | <a class="{{if .PageIsActions}}active {{end}}item" href="{{.RepoLink}}/actions">
|
166 | 166 | {{svg "octicon-play"}} {{ctx.Locale.Tr "actions.actions"}}
|
167 | 167 | {{if .Repository.NumOpenActionRuns}}
|
|
170 | 170 | </a>
|
171 | 171 | {{end}}
|
172 | 172 |
|
173 |
| - {{if .Permission.CanRead $.UnitTypePackages}} |
| 173 | + {{if .Permission.CanRead ctx.Consts.RepoUnitTypePackages}} |
174 | 174 | <a href="{{.RepoLink}}/packages" class="{{if .IsPackagesPage}}active {{end}}item">
|
175 | 175 | {{svg "octicon-package"}} {{ctx.Locale.Tr "packages.title"}}
|
176 | 176 | </a>
|
177 | 177 | {{end}}
|
178 | 178 |
|
179 |
| - {{$projectsUnit := .Repository.MustGetUnit $.Context $.UnitTypeProjects}} |
180 |
| - {{if and (not .UnitProjectsGlobalDisabled) (.Permission.CanRead $.UnitTypeProjects) ($projectsUnit.ProjectsConfig.IsProjectsAllowed "repo")}} |
| 179 | + {{$projectsUnit := .Repository.MustGetUnit $.Context ctx.Consts.RepoUnitTypeProjects}} |
| 180 | + {{if and (not .UnitProjectsGlobalDisabled) (.Permission.CanRead ctx.Consts.RepoUnitTypeProjects) ($projectsUnit.ProjectsConfig.IsProjectsAllowed "repo")}} |
181 | 181 | <a href="{{.RepoLink}}/projects" class="{{if .IsProjectsPage}}active {{end}}item">
|
182 | 182 | {{svg "octicon-project"}} {{ctx.Locale.Tr "repo.project_board"}}
|
183 | 183 | {{if .Repository.NumOpenProjects}}
|
|
186 | 186 | </a>
|
187 | 187 | {{end}}
|
188 | 188 |
|
189 |
| - {{if and (.Permission.CanRead $.UnitTypeReleases) (not .IsEmptyRepo)}} |
| 189 | + {{if and (.Permission.CanRead ctx.Consts.RepoUnitTypeReleases) (not .IsEmptyRepo)}} |
190 | 190 | <a class="{{if or .PageIsReleaseList .PageIsTagList}}active {{end}}item" href="{{.RepoLink}}/releases">
|
191 | 191 | {{svg "octicon-tag"}} {{ctx.Locale.Tr "repo.releases"}}
|
192 | 192 | {{if .NumReleases}}
|
|
195 | 195 | </a>
|
196 | 196 | {{end}}
|
197 | 197 |
|
198 |
| - {{if .Permission.CanRead $.UnitTypeWiki}} |
| 198 | + {{if .Permission.CanRead ctx.Consts.RepoUnitTypeWiki}} |
199 | 199 | <a class="{{if .PageIsWiki}}active {{end}}item" href="{{.RepoLink}}/wiki">
|
200 | 200 | {{svg "octicon-book"}} {{ctx.Locale.Tr "repo.wiki"}}
|
201 | 201 | </a>
|
202 | 202 | {{end}}
|
203 | 203 |
|
204 |
| - {{if .Permission.CanRead $.UnitTypeExternalWiki}} |
205 |
| - <a class="item" href="{{(.Repository.MustGetUnit $.Context $.UnitTypeExternalWiki).ExternalWikiConfig.ExternalWikiURL}}" target="_blank" rel="noopener noreferrer"> |
| 204 | + {{if .Permission.CanRead ctx.Consts.RepoUnitTypeExternalWiki}} |
| 205 | + <a class="item" href="{{(.Repository.MustGetUnit $.Context ctx.Consts.RepoUnitTypeExternalWiki).ExternalWikiConfig.ExternalWikiURL}}" target="_blank" rel="noopener noreferrer"> |
206 | 206 | {{svg "octicon-link-external"}} {{ctx.Locale.Tr "repo.wiki"}}
|
207 | 207 | </a>
|
208 | 208 | {{end}}
|
209 | 209 |
|
210 |
| - {{if and (.Permission.CanReadAny $.UnitTypePullRequests $.UnitTypeIssues $.UnitTypeReleases) (not .IsEmptyRepo)}} |
| 210 | + {{if and (.Permission.CanReadAny ctx.Consts.RepoUnitTypePullRequests ctx.Consts.RepoUnitTypeIssues ctx.Consts.RepoUnitTypeReleases) (not .IsEmptyRepo)}} |
211 | 211 | <a class="{{if .PageIsActivity}}active {{end}}item" href="{{.RepoLink}}/activity">
|
212 | 212 | {{svg "octicon-pulse"}} {{ctx.Locale.Tr "repo.activity"}}
|
213 | 213 | </a>
|
|
0 commit comments