Skip to content

Commit aaa6894

Browse files
committed
Add branch protection information to branches page
This change will add a tag on the ui that indicates whether a branch is protected on the repository branches page. Signed-off-by: Gary Kim <[email protected]>
1 parent 2186a99 commit aaa6894

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

templates/repo/branch/list.tmpl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,14 @@
1212
<table class="ui very basic striped fixed table single line">
1313
<tbody>
1414
<tr>
15-
<td>{{.DefaultBranch}}</td>
15+
<td>
16+
{{range $branch := .Branches}}
17+
{{if and .IsProtected (eq .Name $.DefaultBranch)}}
18+
<i class="octicon octicon-shield"></i>
19+
{{end}}
20+
{{end}}
21+
{{.DefaultBranch}}
22+
</td>
1623
</tr>
1724
</tbody>
1825
</table>
@@ -43,6 +50,9 @@
4350
<s><a href="{{$.RepoLink}}/src/branch/{{.Name | EscapePound}}">{{.Name}}</a></s>
4451
<p class="time">{{$.i18n.Tr "repo.branch.deleted_by" .DeletedBranch.DeletedBy.Name}} {{TimeSinceUnix .DeletedBranch.DeletedUnix $.i18n.Lang}}</p>
4552
{{else}}
53+
{{if .IsProtected}}
54+
<i class="octicon octicon-shield"></i>
55+
{{end}}
4656
<a href="{{$.RepoLink}}/src/branch/{{.Name | EscapePound}}">{{.Name}}</a>
4757
<p class="time">{{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Commit.Committer.When $.i18n.Lang}}</p>
4858
{{end}}

0 commit comments

Comments
 (0)