mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-10-31 22:38:58 +00:00
fa73375e13
This splits out the repository unit settings (formerly "Advanced settings" under the repository settings page) into their own, separate page. The primary reason for this is that the settings page became long and complicated, with a structure that not always made sense. A secondary reason is that toggling units on and off should not necessarily be an "advanced" setting. We want to make doing that easier, and having the units on their own page helps with that. This is basically a refactor, there is no new functionality introduced, just an extra pair of routes for the new page, and the supporting code. Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
121 lines
6.3 KiB
Go HTML Template
121 lines
6.3 KiB
Go HTML Template
<h4 class="ui top attached header" id="pulls">
|
|
{{ctx.Locale.Tr "repo.pulls"}}
|
|
</h4>
|
|
<div class="ui attached segment">
|
|
{{$pullRequestEnabled := .Repository.UnitEnabled $.Context $.UnitTypePullRequests}}
|
|
{{$pullRequestGlobalDisabled := .UnitTypePullRequests.UnitGlobalDisabled}}
|
|
{{$prUnit := .Repository.MustGetUnit $.Context $.UnitTypePullRequests}}
|
|
<div class="inline field">
|
|
<label>{{ctx.Locale.Tr "repo.pulls"}}</label>
|
|
<div class="ui checkbox{{if $pullRequestGlobalDisabled}} disabled{{end}}"{{if $pullRequestGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
|
|
<input class="enable-system" name="enable_pulls" type="checkbox" data-target="#pull_box" {{if $pullRequestEnabled}}checked{{end}}>
|
|
<label>{{ctx.Locale.Tr "repo.settings.pulls_desc"}}</label>
|
|
</div>
|
|
</div>
|
|
<div class="field{{if not $pullRequestEnabled}} disabled{{end}}" id="pull_box">
|
|
<div class="field">
|
|
<p>
|
|
{{ctx.Locale.Tr "repo.settings.merge_style_desc"}}
|
|
</p>
|
|
</div>
|
|
<div class="field">
|
|
<div class="ui checkbox">
|
|
<input name="pulls_allow_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowMerge)}}checked{{end}}>
|
|
<label>{{ctx.Locale.Tr "repo.pulls.merge_pull_request"}}</label>
|
|
</div>
|
|
</div>
|
|
<div class="field">
|
|
<div class="ui checkbox">
|
|
<input name="pulls_allow_rebase" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowRebase)}}checked{{end}}>
|
|
<label>{{ctx.Locale.Tr "repo.pulls.rebase_merge_pull_request"}}</label>
|
|
</div>
|
|
</div>
|
|
<div class="field">
|
|
<div class="ui checkbox">
|
|
<input name="pulls_allow_rebase_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowRebaseMerge)}}checked{{end}}>
|
|
<label>{{ctx.Locale.Tr "repo.pulls.rebase_merge_commit_pull_request"}}</label>
|
|
</div>
|
|
</div>
|
|
<div class="field">
|
|
<div class="ui checkbox">
|
|
<input name="pulls_allow_squash" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowSquash)}}checked{{end}}>
|
|
<label>{{ctx.Locale.Tr "repo.pulls.squash_merge_pull_request"}}</label>
|
|
</div>
|
|
</div>
|
|
<div class="field">
|
|
<div class="ui checkbox">
|
|
<input name="pulls_allow_manual_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowManualMerge)}}checked{{end}}>
|
|
<label>{{ctx.Locale.Tr "repo.pulls.merge_manually"}}</label>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="field">
|
|
<p>
|
|
{{ctx.Locale.Tr "repo.settings.default_merge_style_desc"}}
|
|
</p>
|
|
<div class="ui dropdown selection">
|
|
<select name="pulls_default_merge_style">
|
|
<option value="merge" {{if or (not $pullRequestEnabled) (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "merge")}}selected{{end}}>{{ctx.Locale.Tr "repo.pulls.merge_pull_request"}}</option>
|
|
<option value="rebase" {{if or (not $pullRequestEnabled) (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "rebase")}}selected{{end}}>{{ctx.Locale.Tr "repo.pulls.rebase_merge_pull_request"}}</option>
|
|
<option value="rebase-merge" {{if or (not $pullRequestEnabled) (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "rebase-merge")}}selected{{end}}>{{ctx.Locale.Tr "repo.pulls.rebase_merge_commit_pull_request"}}</option>
|
|
<option value="squash" {{if or (not $pullRequestEnabled) (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "squash")}}selected{{end}}>{{ctx.Locale.Tr "repo.pulls.squash_merge_pull_request"}}</option>
|
|
</select>{{svg "octicon-triangle-down" 14 "dropdown icon"}}
|
|
<div class="default text">
|
|
{{if (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "merge")}}
|
|
{{ctx.Locale.Tr "repo.pulls.merge_pull_request"}}
|
|
{{end}}
|
|
{{if (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "rebase")}}
|
|
{{ctx.Locale.Tr "repo.pulls.rebase_merge_pull_request"}}
|
|
{{end}}
|
|
{{if (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "rebase-merge")}}
|
|
{{ctx.Locale.Tr "repo.pulls.rebase_merge_commit_pull_request"}}
|
|
{{end}}
|
|
{{if (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "squash")}}
|
|
{{ctx.Locale.Tr "repo.pulls.squash_merge_pull_request"}}
|
|
{{end}}
|
|
</div>
|
|
<div class="menu">
|
|
<div class="item" data-value="merge">{{ctx.Locale.Tr "repo.pulls.merge_pull_request"}}</div>
|
|
<div class="item" data-value="rebase">{{ctx.Locale.Tr "repo.pulls.rebase_merge_pull_request"}}</div>
|
|
<div class="item" data-value="rebase-merge">{{ctx.Locale.Tr "repo.pulls.rebase_merge_commit_pull_request"}}</div>
|
|
<div class="item" data-value="squash">{{ctx.Locale.Tr "repo.pulls.squash_merge_pull_request"}}</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="field">
|
|
<div class="ui checkbox">
|
|
<input name="default_allow_maintainer_edit" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.DefaultAllowMaintainerEdit)}}checked{{end}}>
|
|
<label>{{ctx.Locale.Tr "repo.settings.pulls.default_allow_edits_from_maintainers"}}</label>
|
|
</div>
|
|
</div>
|
|
<div class="field">
|
|
<div class="ui checkbox">
|
|
<input name="pulls_allow_rebase_update" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowRebaseUpdate)}}checked{{end}}>
|
|
<label>{{ctx.Locale.Tr "repo.settings.pulls.allow_rebase_update"}}</label>
|
|
</div>
|
|
</div>
|
|
<div class="field">
|
|
<div class="ui checkbox">
|
|
<input name="default_delete_branch_after_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.DefaultDeleteBranchAfterMerge)}}checked{{end}}>
|
|
<label>{{ctx.Locale.Tr "repo.settings.pulls.default_delete_branch_after_merge"}}</label>
|
|
</div>
|
|
</div>
|
|
<div class="field">
|
|
<div class="ui checkbox">
|
|
<input name="enable_autodetect_manual_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AutodetectManualMerge)}}checked{{end}}>
|
|
<label>{{ctx.Locale.Tr "repo.settings.pulls.enable_autodetect_manual_merge"}}</label>
|
|
</div>
|
|
</div>
|
|
<div class="field">
|
|
<div class="ui checkbox">
|
|
<input name="pulls_ignore_whitespace" type="checkbox" {{if and $pullRequestEnabled ($prUnit.PullRequestsConfig.IgnoreWhitespaceConflicts)}}checked{{end}}>
|
|
<label>{{ctx.Locale.Tr "repo.settings.pulls.ignore_whitespace"}}</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="divider"></div>
|
|
<div class="field">
|
|
<button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button>
|
|
</div>
|
|
</div>
|