aboutsummaryrefslogtreecommitdiffstats
path: root/templates/repo
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2024-09-24 10:06:28 +0800
committerGitHub <noreply@github.com>2024-09-24 02:06:28 +0000
commit6eb5950835dd8e0eef2ef6d343af4acfce40a2fc (patch)
treecf84473a23fac1a2e255d1d4f00d368e7df5b605 /templates/repo
parent3f2d8f873035b614b4cdb447d8e16f5af82cefe8 (diff)
downloadgitea-6eb5950835dd8e0eef2ef6d343af4acfce40a2fc.tar.gz
gitea-6eb5950835dd8e0eef2ef6d343af4acfce40a2fc.zip
Allow set branch protection in an empty repository (#32095)
Diffstat (limited to 'templates/repo')
-rw-r--r--templates/repo/settings/branches.tmpl22
-rw-r--r--templates/repo/settings/navbar.tmpl8
2 files changed, 13 insertions, 17 deletions
diff --git a/templates/repo/settings/branches.tmpl b/templates/repo/settings/branches.tmpl
index 52c0c2c800..6f070ba61c 100644
--- a/templates/repo/settings/branches.tmpl
+++ b/templates/repo/settings/branches.tmpl
@@ -15,19 +15,17 @@
<form class="tw-flex" action="{{.Link}}" method="post">
{{.CsrfTokenHtml}}
<input type="hidden" name="action" value="default_branch">
- {{if not .Repository.IsEmpty}}
- <div class="ui dropdown selection search tw-flex-1 tw-mr-2 tw-max-w-96">
- {{svg "octicon-triangle-down" 14 "dropdown icon"}}
- <input type="hidden" name="branch" value="{{.Repository.DefaultBranch}}">
- <div class="default text">{{.Repository.DefaultBranch}}</div>
- <div class="menu">
- {{range .Branches}}
- <div class="item" data-value="{{.}}">{{.}}</div>
- {{end}}
- </div>
+ <div class="ui dropdown selection search tw-flex-1 tw-mr-2 tw-max-w-96">
+ {{svg "octicon-triangle-down" 14 "dropdown icon"}}
+ <input type="hidden" name="branch" value="{{.Repository.DefaultBranch}}">
+ <div class="default text">{{.Repository.DefaultBranch}}</div>
+ <div class="menu">
+ {{range .Branches}}
+ <div class="item" data-value="{{.}}">{{.}}</div>
+ {{end}}
</div>
- <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.branches.update_default_branch"}}</button>
- {{end}}
+ </div>
+ <button class="ui primary button"{{if .Repository.IsEmpty}} disabled{{end}}>{{ctx.Locale.Tr "repo.settings.branches.update_default_branch"}}</button>
</form>
</div>
diff --git a/templates/repo/settings/navbar.tmpl b/templates/repo/settings/navbar.tmpl
index b9105bb8ed..e46273aff0 100644
--- a/templates/repo/settings/navbar.tmpl
+++ b/templates/repo/settings/navbar.tmpl
@@ -13,11 +13,9 @@
</a>
{{end}}
{{if .Repository.UnitEnabled $.Context ctx.Consts.RepoUnitTypeCode}}
- {{if not .Repository.IsEmpty}}
- <a class="{{if .PageIsSettingsBranches}}active {{end}}item" href="{{.RepoLink}}/settings/branches">
- {{ctx.Locale.Tr "repo.settings.branches"}}
- </a>
- {{end}}
+ <a class="{{if .PageIsSettingsBranches}}active {{end}}item" href="{{.RepoLink}}/settings/branches">
+ {{ctx.Locale.Tr "repo.settings.branches"}}
+ </a>
<a class="{{if .PageIsSettingsTags}}active {{end}}item" href="{{.RepoLink}}/settings/tags">
{{ctx.Locale.Tr "repo.settings.tags"}}
</a>