summaryrefslogtreecommitdiffstats
path: root/templates/repo/settings/units/pulls.tmpl
blob: 4e9c53e0f4787f0e51d212ec56cd15f66f0917cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<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">
			<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>