summaryrefslogtreecommitdiffstats
path: root/templates/webhook/shared-settings.tmpl
blob: b6c05b78edd5024e8c2950732efaf4345919f081 (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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
{{$isNew:=or .PageIsSettingsHooksNew .PageIsAdminDefaultHooksNew .PageIsAdminSystemHooksNew}}
<div class="field">
	<fieldset class="event type">
		<legend>{{ctx.Locale.Tr "repo.settings.event_desc"}}</legend>
		<label>
			<input name="events" type="radio" value="push_only" {{if or $isNew .Webhook.PushOnly}}checked{{end}}>
			{{ctx.Locale.Tr "repo.settings.event_push_only"}}
		</label>
		<label>
			<input name="events" type="radio" value="send_everything" {{if .Webhook.SendEverything}}checked{{end}}>
			{{ctx.Locale.Tr "repo.settings.event_send_everything"}}
		</label>
		<label>
			<input name="events" type="radio" value="choose_events" {{if .Webhook.ChooseEvents}}checked{{end}}>
			{{ctx.Locale.Tr "repo.settings.event_choose"}}
		</label>
		<fieldset class="hide-unless-checked">
			<!-- Repository Events -->
			<fieldset class="simple-grid grid-2">
				<legend>{{ctx.Locale.Tr "repo.settings.event_header_repository"}}</legend>
				<!-- Create -->
				<label>
					<input name="create" type="checkbox" {{if .Webhook.Create}}checked{{end}}>
					{{ctx.Locale.Tr "repo.settings.event_create"}}
					<span class="help">{{ctx.Locale.Tr "repo.settings.event_create_desc"}}</span>
				</label>
				<!-- Delete -->
				<label>
					<input name="delete" type="checkbox" {{if .Webhook.Delete}}checked{{end}}>
					{{ctx.Locale.Tr "repo.settings.event_delete"}}
					<span class="help">{{ctx.Locale.Tr "repo.settings.event_delete_desc"}}</span>
				</label>
				<!-- Fork -->
				<label>
					<input name="fork" type="checkbox" {{if .Webhook.Fork}}checked{{end}}>
					{{ctx.Locale.Tr "repo.settings.event_fork"}}
					<span class="help">{{ctx.Locale.Tr "repo.settings.event_fork_desc"}}</span>
				</label>
				<!-- Push -->
				<label>
					<input name="push" type="checkbox" {{if .Webhook.Push}}checked{{end}}>
					{{ctx.Locale.Tr "repo.settings.event_push"}}
					<span class="help">{{ctx.Locale.Tr "repo.settings.event_push_desc"}}</span>
				</label>
				<!-- Repository -->
				<label>
					<input name="repository" type="checkbox" {{if .Webhook.Repository}}checked{{end}}>
					{{ctx.Locale.Tr "repo.settings.event_repository"}}
					<span class="help">{{ctx.Locale.Tr "repo.settings.event_repository_desc"}}</span>
				</label>
				<!-- Release -->
				<label>
					<input name="release" type="checkbox" {{if .Webhook.Release}}checked{{end}}>
					{{ctx.Locale.Tr "repo.settings.event_release"}}
					<span class="help">{{ctx.Locale.Tr "repo.settings.event_release_desc"}}</span>
				</label>
				<!-- Package -->
				<label>
					<input name="package" type="checkbox" {{if .Webhook.Package}}checked{{end}}>
					{{ctx.Locale.Tr "repo.settings.event_package"}}
					<span class="help">{{ctx.Locale.Tr "repo.settings.event_package_desc"}}</span>
				</label>
				<!-- Wiki -->
				<label>
					<input name="wiki" type="checkbox" {{if .Webhook.Wiki}}checked{{end}}>
					{{ctx.Locale.Tr "repo.settings.event_wiki"}}
					<span class="help">{{ctx.Locale.Tr "repo.settings.event_wiki_desc"}}</span>
				</label>
			</fieldset>
			<!-- Issue Events -->
			<fieldset class="simple-grid grid-2">
				<legend>{{ctx.Locale.Tr "repo.settings.event_header_issue"}}</legend>
				<!-- Issues -->
				<label>
					<input name="issues" type="checkbox" {{if .Webhook.Issues}}checked{{end}}>
					{{ctx.Locale.Tr "repo.settings.event_issues"}}
					<span class="help">{{ctx.Locale.Tr "repo.settings.event_issues_desc"}}</span>
				</label>
				<!-- Issue Assign -->
				<label>
					<input name="issue_assign" type="checkbox" {{if .Webhook.IssueAssign}}checked{{end}}>
					{{ctx.Locale.Tr "repo.settings.event_issue_assign"}}
					<span class="help">{{ctx.Locale.Tr "repo.settings.event_issue_assign_desc"}}</span>
				</label>
				<!-- Issue Label -->
				<label>
					<input name="issue_label" type="checkbox" {{if .Webhook.IssueLabel}}checked{{end}}>
					{{ctx.Locale.Tr "repo.settings.event_issue_label"}}
					<span class="help">{{ctx.Locale.Tr "repo.settings.event_issue_label_desc"}}</span>
				</label>
				<!-- Issue Milestone -->
				<label>
					<input name="issue_milestone" type="checkbox" {{if .Webhook.IssueMilestone}}checked{{end}}>
					{{ctx.Locale.Tr "repo.settings.event_issue_milestone"}}
					<span class="help">{{ctx.Locale.Tr "repo.settings.event_issue_milestone_desc"}}</span>
				</label>
				<!-- Issue Comment -->
				<label>
					<input name="issue_comment" type="checkbox" {{if .Webhook.IssueComment}}checked{{end}}>
					{{ctx.Locale.Tr "repo.settings.event_issue_comment"}}
					<span class="help">{{ctx.Locale.Tr "repo.settings.event_issue_comment_desc"}}</span>
				</label>
			</fieldset>
			<!-- Pull Request Events -->
			<fieldset class="simple-grid grid-2">
				<legend>{{ctx.Locale.Tr "repo.settings.event_header_pull_request"}}</legend>
				<!-- Pull Request -->
				<label>
					<input name="pull_request" type="checkbox" {{if .Webhook.PullRequest}}checked{{end}}>
					{{ctx.Locale.Tr "repo.settings.event_pull_request"}}
					<span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_desc"}}</span>
				</label>
				<!-- Pull Request Assign -->
				<label>
					<input name="pull_request_assign" type="checkbox" {{if .Webhook.PullRequestAssign}}checked{{end}}>
					{{ctx.Locale.Tr "repo.settings.event_pull_request_assign"}}
					<span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_assign_desc"}}</span>
				</label>
				<!-- Pull Request Label -->
				<label>
					<input name="pull_request_label" type="checkbox" {{if .Webhook.PullRequestLabel}}checked{{end}}>
					{{ctx.Locale.Tr "repo.settings.event_pull_request_label"}}
					<span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_label_desc"}}</span>
				</label>
				<!-- Pull Request Milestone -->
				<label>
					<input name="pull_request_milestone" type="checkbox" {{if .Webhook.PullRequestMilestone}}checked{{end}}>
					{{ctx.Locale.Tr "repo.settings.event_pull_request_milestone"}}
					<span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_milestone_desc"}}</span>
				</label>
				<!-- Pull Request Comment -->
				<label>
					<input name="pull_request_comment" type="checkbox" {{if .Webhook.PullRequestComment}}checked{{end}}>
					{{ctx.Locale.Tr "repo.settings.event_pull_request_comment"}}
					<span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_comment_desc"}}</span>
				</label>
				<!-- Pull Request Review -->
				<label>
					<input name="pull_request_review" type="checkbox" {{if .Webhook.PullRequestReview}}checked{{end}}>
					{{ctx.Locale.Tr "repo.settings.event_pull_request_review"}}
					<span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_review_desc"}}</span>
				</label>
				<!-- Pull Request Sync -->
				<label>
					<input name="pull_request_sync" type="checkbox" {{if .Webhook.PullRequestSync}}checked{{end}}>
					{{ctx.Locale.Tr "repo.settings.event_pull_request_sync"}}
					<span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_sync_desc"}}</span>
				</label>
				<!-- Pull Request Review Request -->
				<label>
					<input name="pull_request_review_request" type="checkbox" {{if .Webhook.PullRequestReviewRequest}}checked{{end}}>
					{{ctx.Locale.Tr "repo.settings.event_pull_request_review_request"}}
					<span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_review_request_desc"}}</span>
				</label>
			</fieldset>
		</fieldset>
	</fieldset>
</div>

<!-- Branch filter -->
<div class="field">
	<label for="branch_filter">{{ctx.Locale.Tr "repo.settings.branch_filter"}}</label>
	<input id="branch_filter" name="branch_filter" type="text" value="{{or .Webhook.BranchFilter "*"}}">
	<span class="help">{{ctx.Locale.Tr "repo.settings.branch_filter_desc" "https://pkg.go.dev/github.com/gobwas/glob#Compile" "github.com/gobwas/glob"}}</span>
</div>

{{$skipAuthorizationHeader := or (eq .HookType "sourcehut_builds") (eq .HookType "matrix")}}
{{if not $skipAuthorizationHeader}}
	<!-- Authorization Header -->
	<div class="field {{if .Err_AuthorizationHeader}}error{{end}}">
		<label for="authorization_header">{{ctx.Locale.Tr "repo.settings.authorization_header"}}</label>
		<input id="authorization_header" name="authorization_header" type="text" value="{{.Webhook.HeaderAuthorization}}">
		<span class="help">{{ctx.Locale.Tr "repo.settings.authorization_header_desc" ("<code>Bearer token123456</code>, <code>Basic YWxhZGRpbjpvcGVuc2VzYW1l</code>" | SafeHTML)}}</span>
	</div>
{{end}}

<div class="divider"></div>

<fieldset>
	<label>
		<input name="active" type="checkbox" {{if or $isNew .Webhook.IsActive}}checked{{end}}>
		{{ctx.Locale.Tr "repo.settings.active"}}
		<span class="help">{{ctx.Locale.Tr "repo.settings.active_helper"}}</span>
	</label>
	{{if $isNew}}
		<button class="ui primary button">{{ctx.Locale.Tr "repo.settings.add_webhook"}}</button>
	{{else}}
		<button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_webhook"}}</button>
		<a class="ui red delete-button button" data-url="{{.BaseLink}}/delete" data-id="{{.Webhook.ID}}">{{ctx.Locale.Tr "repo.settings.delete_webhook"}}</a>
	{{end}}
</fieldset>

{{template "repo/settings/webhook/delete_modal" .}}