Skip to content

Commit 0a9794a

Browse files
6543lafriks
authored andcommitted
hide delete/restore button on archived repos [backport] (#7660)
* hide delete/restore button on archived repos close issue #7653 * backport vor v1.9 * hide column also * move protected icon to first colum backport parts of #7461 * backport comit divergenze fix #7625
1 parent d4044b9 commit 0a9794a

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

templates/repo/branch/list.tmpl

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@
1212
<table class="ui very basic striped fixed table single line">
1313
<tbody>
1414
<tr>
15-
<td>{{.DefaultBranch}}</td>
15+
<td>
16+
{{if .IsProtected}}
17+
<i class="octicon octicon-shield"></i>
18+
{{end}}
19+
{{.DefaultBranch}}
20+
</td>
1621
</tr>
1722
</tbody>
1823
</table>
@@ -27,9 +32,9 @@
2732
<thead>
2833
<tr>
2934
<th class="six wide">{{.i18n.Tr "repo.branch.name"}}</th>
35+
<th class="three wide"></th>
3036
<th class="two wide"></th>
31-
<th class="two wide"></th>
32-
{{if and $.IsWriter (not $.IsMirror)}}
37+
{{if and $.IsWriter (not $.IsMirror) (not $.Repository.IsArchived)}}
3338
<th class="one wide right aligned">{{.i18n.Tr "repo.branch.delete_head"}}</th>
3439
{{end}}
3540
</tr>
@@ -43,6 +48,9 @@
4348
<s><a href="{{$.RepoLink}}/src/branch/{{.Name | EscapePound}}">{{.Name}}</a></s>
4449
<p class="time">{{$.i18n.Tr "repo.branch.deleted_by" .DeletedBranch.DeletedBy.Name}} {{TimeSinceUnix .DeletedBranch.DeletedUnix $.i18n.Lang}}</p>
4550
{{else}}
51+
{{if .IsProtected}}
52+
<i class="octicon octicon-shield"></i>
53+
{{end}}
4654
<a href="{{$.RepoLink}}/src/branch/{{.Name | EscapePound}}">{{.Name}}</a>
4755
<p class="time">{{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Commit.Committer.When $.i18n.Lang}}</p>
4856
{{end}}
@@ -79,13 +87,11 @@
7987
{{end}}
8088
{{end}}
8189
</td>
82-
{{if and $.IsWriter (not $.IsMirror)}}
90+
{{if and $.IsWriter (not $.IsMirror) (not $.Repository.IsArchived)}}
8391
<td class="right aligned">
84-
{{if .IsProtected}}
85-
<i class="octicon octicon-shield"></i>
86-
{{else if .IsDeleted}}
92+
{{if and .IsDeleted (not .IsProtected)}}
8793
<a class="undo-button" href data-url="{{$.Link}}/restore?branch_id={{.DeletedBranch.ID | urlquery}}&name={{.DeletedBranch.Name | urlquery}}"><i class="octicon octicon-reply"></i></a>
88-
{{else}}
94+
{{else if (not .IsProtected)}}
8995
<a class="delete-branch-button" href data-url="{{$.Link}}/delete?name={{.Name | urlquery}}" data-name="{{.Name}}"><i class="trash icon text red"></i></a>
9096
{{end}}
9197
</td>

0 commit comments

Comments
 (0)