0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-05-15 23:40:58 +02:00

Hide delete directory button for mirror or archive repository and disable the menu item if user have no permission

This commit is contained in:
Lunny Xiao 2026-01-15 10:56:12 -08:00
parent 4a9ac53862
commit 43ed2000f5
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A

View File

@ -100,9 +100,9 @@
<a class="item" data-clipboard-text="{{.Repository.Link}}/src/commit/{{.CommitID}}/{{PathEscapeSegments .TreePath}}" data-clipboard-text-type="url">
{{svg "octicon-link" 16}}{{ctx.Locale.Tr "repo.file_copy_permalink"}}
</a>
{{if and (.Permission.CanWrite ctx.Consts.RepoUnitTypeCode) (not .Repository.IsArchived) (not $isTreePathRoot)}}
{{if and (.Repository.CanContentChange) (not $isTreePathRoot)}}
<div class="divider"></div>
<a class="item tw-text-danger" href="{{.RepoLink}}/_delete/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}">
<a class="item tw-text-danger{{if not (.Permission.CanWrite ctx.Consts.RepoUnitTypeCode)}} disabled{{end}}" href="{{.RepoLink}}/_delete/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}">
{{svg "octicon-trash" 16}}{{ctx.Locale.Tr "repo.editor.delete_this_directory"}}
</a>
{{end}}