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 https://github.com/go-gitea/gitea/pull/7461

* backport comit divergenze fix
https://github.com/go-gitea/gitea/issues/7625
This commit is contained in:
6543 2019-07-29 23:20:39 +02:00 committed by Lauris BH
parent d4044b9c98
commit 0a9794a6bc

View file

@ -12,7 +12,12 @@
<table class="ui very basic striped fixed table single line">
<tbody>
<tr>
<td>{{.DefaultBranch}}</td>
<td>
{{if .IsProtected}}
<i class="octicon octicon-shield"></i>
{{end}}
{{.DefaultBranch}}
</td>
</tr>
</tbody>
</table>
@ -27,9 +32,9 @@
<thead>
<tr>
<th class="six wide">{{.i18n.Tr "repo.branch.name"}}</th>
<th class="three wide"></th>
<th class="two wide"></th>
<th class="two wide"></th>
{{if and $.IsWriter (not $.IsMirror)}}
{{if and $.IsWriter (not $.IsMirror) (not $.Repository.IsArchived)}}
<th class="one wide right aligned">{{.i18n.Tr "repo.branch.delete_head"}}</th>
{{end}}
</tr>
@ -43,6 +48,9 @@
<s><a href="{{$.RepoLink}}/src/branch/{{.Name | EscapePound}}">{{.Name}}</a></s>
<p class="time">{{$.i18n.Tr "repo.branch.deleted_by" .DeletedBranch.DeletedBy.Name}} {{TimeSinceUnix .DeletedBranch.DeletedUnix $.i18n.Lang}}</p>
{{else}}
{{if .IsProtected}}
<i class="octicon octicon-shield"></i>
{{end}}
<a href="{{$.RepoLink}}/src/branch/{{.Name | EscapePound}}">{{.Name}}</a>
<p class="time">{{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Commit.Committer.When $.i18n.Lang}}</p>
{{end}}
@ -79,13 +87,11 @@
{{end}}
{{end}}
</td>
{{if and $.IsWriter (not $.IsMirror)}}
{{if and $.IsWriter (not $.IsMirror) (not $.Repository.IsArchived)}}
<td class="right aligned">
{{if .IsProtected}}
<i class="octicon octicon-shield"></i>
{{else if .IsDeleted}}
{{if and .IsDeleted (not .IsProtected)}}
<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>
{{else}}
{{else if (not .IsProtected)}}
<a class="delete-branch-button" href data-url="{{$.Link}}/delete?name={{.Name | urlquery}}" data-name="{{.Name}}"><i class="trash icon text red"></i></a>
{{end}}
</td>