mirror of
https://github.com/go-gitea/gitea
synced 2024-11-19 05:29:26 +01:00
Allow set branch protection in an empty repository (#32095)
This commit is contained in:
parent
3f2d8f8730
commit
6eb5950835
@ -1069,7 +1069,7 @@ func registerRoutes(m *web.Router) {
|
|||||||
m.Combo("/edit").Get(repo_setting.SettingsProtectedBranch).
|
m.Combo("/edit").Get(repo_setting.SettingsProtectedBranch).
|
||||||
Post(web.Bind(forms.ProtectBranchForm{}), context.RepoMustNotBeArchived(), repo_setting.SettingsProtectedBranchPost)
|
Post(web.Bind(forms.ProtectBranchForm{}), context.RepoMustNotBeArchived(), repo_setting.SettingsProtectedBranchPost)
|
||||||
m.Post("/{id}/delete", repo_setting.DeleteProtectedBranchRulePost)
|
m.Post("/{id}/delete", repo_setting.DeleteProtectedBranchRulePost)
|
||||||
}, repo.MustBeNotEmpty)
|
})
|
||||||
|
|
||||||
m.Group("/tags", func() {
|
m.Group("/tags", func() {
|
||||||
m.Get("", repo_setting.ProtectedTags)
|
m.Get("", repo_setting.ProtectedTags)
|
||||||
|
@ -15,19 +15,17 @@
|
|||||||
<form class="tw-flex" action="{{.Link}}" method="post">
|
<form class="tw-flex" action="{{.Link}}" method="post">
|
||||||
{{.CsrfTokenHtml}}
|
{{.CsrfTokenHtml}}
|
||||||
<input type="hidden" name="action" value="default_branch">
|
<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">
|
||||||
<div class="ui dropdown selection search tw-flex-1 tw-mr-2 tw-max-w-96">
|
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
|
||||||
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
|
<input type="hidden" name="branch" value="{{.Repository.DefaultBranch}}">
|
||||||
<input type="hidden" name="branch" value="{{.Repository.DefaultBranch}}">
|
<div class="default text">{{.Repository.DefaultBranch}}</div>
|
||||||
<div class="default text">{{.Repository.DefaultBranch}}</div>
|
<div class="menu">
|
||||||
<div class="menu">
|
{{range .Branches}}
|
||||||
{{range .Branches}}
|
<div class="item" data-value="{{.}}">{{.}}</div>
|
||||||
<div class="item" data-value="{{.}}">{{.}}</div>
|
{{end}}
|
||||||
{{end}}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<button class="ui primary button">{{ctx.Locale.Tr "repo.settings.branches.update_default_branch"}}</button>
|
</div>
|
||||||
{{end}}
|
<button class="ui primary button"{{if .Repository.IsEmpty}} disabled{{end}}>{{ctx.Locale.Tr "repo.settings.branches.update_default_branch"}}</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -13,11 +13,9 @@
|
|||||||
</a>
|
</a>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{if .Repository.UnitEnabled $.Context ctx.Consts.RepoUnitTypeCode}}
|
{{if .Repository.UnitEnabled $.Context ctx.Consts.RepoUnitTypeCode}}
|
||||||
{{if not .Repository.IsEmpty}}
|
<a class="{{if .PageIsSettingsBranches}}active {{end}}item" href="{{.RepoLink}}/settings/branches">
|
||||||
<a class="{{if .PageIsSettingsBranches}}active {{end}}item" href="{{.RepoLink}}/settings/branches">
|
{{ctx.Locale.Tr "repo.settings.branches"}}
|
||||||
{{ctx.Locale.Tr "repo.settings.branches"}}
|
</a>
|
||||||
</a>
|
|
||||||
{{end}}
|
|
||||||
<a class="{{if .PageIsSettingsTags}}active {{end}}item" href="{{.RepoLink}}/settings/tags">
|
<a class="{{if .PageIsSettingsTags}}active {{end}}item" href="{{.RepoLink}}/settings/tags">
|
||||||
{{ctx.Locale.Tr "repo.settings.tags"}}
|
{{ctx.Locale.Tr "repo.settings.tags"}}
|
||||||
</a>
|
</a>
|
||||||
|
Loading…
Reference in New Issue
Block a user