change the repo settings form over to the new data model, presenting the two settings as one composite

This commit is contained in:
Gogs 2025-02-23 21:41:43 +01:00
parent ed9ad914c2
commit c0df133804
3 changed files with 26 additions and 5 deletions

View File

@ -758,7 +758,10 @@ settings.tracker_issue_style.alphanumeric = Alphanumeric
settings.tracker_url_format_desc = You can use placeholder <code>{user} {repo} {index}</code> for user name, repository name and issue index.
settings.pulls_desc = Enable pull requests to accept contributions between repositories and branches
settings.pulls.ignore_whitespace = Ignore changes in whitespace
settings.pulls.allow_rebase_merge = Allow use rebase to merge commits
settings.pulls.merge_only = Always use merge to merge commits
settings.pulls.merge_default = Merge by default, but allow to use rebase to merge commits
settings.pulls.rebase_default = Rebase by default, but allow to use merge to merge commits
settings.pulls.rebase_only = Always use rebase to merge commits
settings.danger_zone = Danger Zone
settings.cannot_fork_to_same_owner = You cannot fork a repository to its original owner.
settings.new_owner_has_same_repo = The new owner already has a repository with same name. Please choose another name.

View File

@ -117,7 +117,7 @@ type RepoSetting struct {
TrackerIssueStyle string
EnablePulls bool
PullsIgnoreWhitespace bool
PullsAllowRebase bool
PullsMergeType string
}
func (f *RepoSetting) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {

View File

@ -231,9 +231,27 @@
</div>
</div>
<div class="field">
<div class="ui checkbox">
<input name="pulls_allow_rebase" type="checkbox" {{if .Repository.PullsAllowRebase}}checked{{end}}>
<label>{{.i18n.Tr "repo.settings.pulls.allow_rebase_merge"}}</label>
<div class="ui radio checkbox">
<input name="pulls_merge_type" type="radio" value="merge_only" {{if and (not .Repository.PullsPreferRebase) (not .Repository.PullsAllowAlt)}}checked{{end}}>
<label>{{.i18n.Tr "repo.settings.pulls.merge_only"}}</label>
</div>
</div>
<div class="field">
<div class="ui radio checkbox">
<input name="pulls_merge_type" type="radio" value="merge_default" {{if and (not .Repository.PullsPreferRebase) .Repository.PullsAllowAlt}}checked{{end}}>
<label>{{.i18n.Tr "repo.settings.pulls.merge_default"}}</label>
</div>
</div>
<div class="field">
<div class="ui radio checkbox">
<input name="pulls_merge_type" type="radio" value="rebase_default" {{if and .Repository.PullsPreferRebase .Repository.PullsAllowAlt}}checked{{end}}>
<label>{{.i18n.Tr "repo.settings.pulls.rebase_default"}}</label>
</div>
</div>
<div class="field">
<div class="ui radio checkbox">
<input name="pulls_merge_type" type="radio" value="rebase_only" {{if and .Repository.PullsPreferRebase (not .Repository.PullsAllowAlt)}}checked{{end}}>
<label>{{.i18n.Tr "repo.settings.pulls.rebase_only"}}</label>
</div>
</div>
</div>