mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-28 13:49:13 -05:00
13ca6c14f1
This commit allows chaning default branch update style through global and repository settings. The setting affects "Update branch" button in PR view (button shows when some commits are ahead of master branch). When default update style is set to "rebase", dropdown button updates branch by rebase by default. When update style is set to other value, dropdown button updates branch by merge. Any of these actions may be selected using dropdown in any case. Signed-off-by: George Bartolomey <george@bh4.ru>
155 lines
8.3 KiB
Go HTML Template
155 lines
8.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_fast_forward_only" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowFastForwardOnly)}}checked{{end}}>
|
|
<label>{{ctx.Locale.Tr "repo.pulls.fast_forward_only_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>
|
|
<option value="fast-forward-only" {{if or (not $pullRequestEnabled) (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "fast-forward-only")}}selected{{end}}>{{ctx.Locale.Tr "repo.pulls.fast_forward_only_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}}
|
|
{{if (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "fast-forward-only")}}
|
|
{{ctx.Locale.Tr "repo.pulls.fast_forward_only_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 class="item" data-value="fast-forward-only">{{ctx.Locale.Tr "repo.pulls.fast_forward_only_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">
|
|
<p>
|
|
{{ctx.Locale.Tr "repo.settings.default_update_style_desc"}}
|
|
</p>
|
|
<div class="ui dropdown selection">
|
|
<select name="pulls_default_update_style">
|
|
<option value="merge" {{if or (not $pullRequestEnabled) (eq $prUnit.PullRequestsConfig.DefaultUpdateStyle "merge")}}selected{{end}}>{{ctx.Locale.Tr "repo.pulls.update_branch"}}</option>
|
|
<option value="rebase" {{if or (not $pullRequestEnabled) (eq $prUnit.PullRequestsConfig.DefaultUpdateStyle "rebase")}}selected{{end}}>{{ctx.Locale.Tr "repo.pulls.update_branch_rebase"}}</option>
|
|
</select>{{svg "octicon-triangle-down" 14 "dropdown icon"}}
|
|
<div class="default text">
|
|
{{if (eq $prUnit.PullRequestsConfig.DefaultUpdateStyle "merge")}}
|
|
{{ctx.Locale.Tr "repo.pulls.update_branch"}}
|
|
{{end}}
|
|
{{if (eq $prUnit.PullRequestsConfig.DefaultUpdateStyle "rebase")}}
|
|
{{ctx.Locale.Tr "repo.pulls.update_branch_rebase"}}
|
|
{{end}}
|
|
</div>
|
|
<div class="menu">
|
|
<div class="item" data-value="merge">{{ctx.Locale.Tr "repo.pulls.update_branch"}}</div>
|
|
<div class="item" data-value="rebase">{{ctx.Locale.Tr "repo.pulls.update_branch_rebase"}}</div>
|
|
</div>
|
|
</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>
|