mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-23 08:47:42 -05:00
c9e402afdc
Modifies forms: - (new) org team - (new) repo webhook - (new) repo protected branch The forms are not completely rewritten to semantic HTML yet. The focus of this change was on standard elements, some custom solutions were left untouched for now. - swaps the order fo permission radio buttons as per https://codeberg.org/forgejo/forgejo/issues/4983 - uses fieldsets to group related inputs - ensures consistent styling across forms - can be improved later, e.g. using horizontal lines between sections - fixes: previous font size of labels was smaller than the font size of the help text - help text are now part of the label, clicking them now also activates the input - drop unused CSS (no required checkboxes in grouped class remain) - playwright testing: - move login boilerplate to utils - automated form accessibility checking - allow defining the scope, because legacy parts of the forms are not yet accessible - assert some CSS properties that should not be overriden - the Makefile adjustment was necessary, because eslint scanned some internal files in the tests/e2e/reports directory
281 lines
11 KiB
Go HTML Template
281 lines
11 KiB
Go HTML Template
{{$isNew:=or .PageIsSettingsHooksNew .PageIsAdminDefaultHooksNew .PageIsAdminSystemHooksNew}}
|
|
<div class="field">
|
|
<fieldset class="event type">
|
|
<legend>{{ctx.Locale.Tr "repo.settings.event_desc"}}</legend>
|
|
<label class="non-events">
|
|
<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 class="non-events">
|
|
<input name="events" type="radio" value="send_everything" {{if .Webhook.SendEverything}}checked{{end}}>
|
|
{{ctx.Locale.Tr "repo.settings.event_send_everything"}}
|
|
</label>
|
|
<label class="events">
|
|
<input name="events" type="radio" value="choose_events" {{if .Webhook.ChooseEvents}}checked{{end}}>
|
|
{{ctx.Locale.Tr "repo.settings.event_choose"}}
|
|
</label>
|
|
</fieldset>
|
|
|
|
<div class="events fields ui grid {{if not .Webhook.ChooseEvents}}tw-hidden{{end}}">
|
|
<!-- Repository Events -->
|
|
<div class="fourteen wide column">
|
|
<label>{{ctx.Locale.Tr "repo.settings.event_header_repository"}}</label>
|
|
</div>
|
|
<!-- Create -->
|
|
<div class="seven wide column">
|
|
<div class="field">
|
|
<div class="ui checkbox">
|
|
<input name="create" type="checkbox" {{if .Webhook.Create}}checked{{end}}>
|
|
<label>{{ctx.Locale.Tr "repo.settings.event_create"}}</label>
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_create_desc"}}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Delete -->
|
|
<div class="seven wide column">
|
|
<div class="field">
|
|
<div class="ui checkbox">
|
|
<input name="delete" type="checkbox" {{if .Webhook.Delete}}checked{{end}}>
|
|
<label>{{ctx.Locale.Tr "repo.settings.event_delete"}}</label>
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_delete_desc"}}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Fork -->
|
|
<div class="seven wide column">
|
|
<div class="field">
|
|
<div class="ui checkbox">
|
|
<input name="fork" type="checkbox" {{if .Webhook.Fork}}checked{{end}}>
|
|
<label>{{ctx.Locale.Tr "repo.settings.event_fork"}}</label>
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_fork_desc"}}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Push -->
|
|
<div class="seven wide column">
|
|
<div class="field">
|
|
<div class="ui checkbox">
|
|
<input name="push" type="checkbox" {{if .Webhook.Push}}checked{{end}}>
|
|
<label>{{ctx.Locale.Tr "repo.settings.event_push"}}</label>
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_push_desc"}}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Repository -->
|
|
<div class="seven wide column">
|
|
<div class="field">
|
|
<div class="ui checkbox">
|
|
<input name="repository" type="checkbox" {{if .Webhook.Repository}}checked{{end}}>
|
|
<label>{{ctx.Locale.Tr "repo.settings.event_repository"}}</label>
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_repository_desc"}}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Release -->
|
|
<div class="seven wide column">
|
|
<div class="field">
|
|
<div class="ui checkbox">
|
|
<input name="release" type="checkbox" {{if .Webhook.Release}}checked{{end}}>
|
|
<label>{{ctx.Locale.Tr "repo.settings.event_release"}}</label>
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_release_desc"}}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Package -->
|
|
<div class="seven wide column">
|
|
<div class="field">
|
|
<div class="ui checkbox">
|
|
<input name="package" type="checkbox" {{if .Webhook.Package}}checked{{end}}>
|
|
<label>{{ctx.Locale.Tr "repo.settings.event_package"}}</label>
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_package_desc"}}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Wiki -->
|
|
<div class="seven wide column">
|
|
<div class="field">
|
|
<div class="ui checkbox">
|
|
<input name="wiki" type="checkbox" {{if .Webhook.Wiki}}checked{{end}}>
|
|
<label>{{ctx.Locale.Tr "repo.settings.event_wiki"}}</label>
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_wiki_desc"}}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Issue Events -->
|
|
<div class="fourteen wide column">
|
|
<label>{{ctx.Locale.Tr "repo.settings.event_header_issue"}}</label>
|
|
</div>
|
|
<!-- Issues -->
|
|
<div class="seven wide column">
|
|
<div class="field">
|
|
<div class="ui checkbox">
|
|
<input name="issues" type="checkbox" {{if .Webhook.Issues}}checked{{end}}>
|
|
<label>{{ctx.Locale.Tr "repo.settings.event_issues"}}</label>
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_issues_desc"}}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Issue Assign -->
|
|
<div class="seven wide column">
|
|
<div class="field">
|
|
<div class="ui checkbox">
|
|
<input name="issue_assign" type="checkbox" {{if .Webhook.IssueAssign}}checked{{end}}>
|
|
<label>{{ctx.Locale.Tr "repo.settings.event_issue_assign"}}</label>
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_issue_assign_desc"}}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Issue Label -->
|
|
<div class="seven wide column">
|
|
<div class="field">
|
|
<div class="ui checkbox">
|
|
<input name="issue_label" type="checkbox" {{if .Webhook.IssueLabel}}checked{{end}}>
|
|
<label>{{ctx.Locale.Tr "repo.settings.event_issue_label"}}</label>
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_issue_label_desc"}}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Issue Milestone -->
|
|
<div class="seven wide column">
|
|
<div class="field">
|
|
<div class="ui checkbox">
|
|
<input name="issue_milestone" type="checkbox" {{if .Webhook.IssueMilestone}}checked{{end}}>
|
|
<label>{{ctx.Locale.Tr "repo.settings.event_issue_milestone"}}</label>
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_issue_milestone_desc"}}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Issue Comment -->
|
|
<div class="seven wide column">
|
|
<div class="field">
|
|
<div class="ui checkbox">
|
|
<input name="issue_comment" type="checkbox" {{if .Webhook.IssueComment}}checked{{end}}>
|
|
<label>{{ctx.Locale.Tr "repo.settings.event_issue_comment"}}</label>
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_issue_comment_desc"}}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Pull Request Events -->
|
|
<div class="fourteen wide column">
|
|
<label>{{ctx.Locale.Tr "repo.settings.event_header_pull_request"}}</label>
|
|
</div>
|
|
<!-- Pull Request -->
|
|
<div class="seven wide column">
|
|
<div class="field">
|
|
<div class="ui checkbox">
|
|
<input name="pull_request" type="checkbox" {{if .Webhook.PullRequest}}checked{{end}}>
|
|
<label>{{ctx.Locale.Tr "repo.settings.event_pull_request"}}</label>
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_desc"}}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Pull Request Assign -->
|
|
<div class="seven wide column">
|
|
<div class="field">
|
|
<div class="ui checkbox">
|
|
<input name="pull_request_assign" type="checkbox" {{if .Webhook.PullRequestAssign}}checked{{end}}>
|
|
<label>{{ctx.Locale.Tr "repo.settings.event_pull_request_assign"}}</label>
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_assign_desc"}}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Pull Request Label -->
|
|
<div class="seven wide column">
|
|
<div class="field">
|
|
<div class="ui checkbox">
|
|
<input name="pull_request_label" type="checkbox" {{if .Webhook.PullRequestLabel}}checked{{end}}>
|
|
<label>{{ctx.Locale.Tr "repo.settings.event_pull_request_label"}}</label>
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_label_desc"}}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Pull Request Milestone -->
|
|
<div class="seven wide column">
|
|
<div class="field">
|
|
<div class="ui checkbox">
|
|
<input name="pull_request_milestone" type="checkbox" {{if .Webhook.PullRequestMilestone}}checked{{end}}>
|
|
<label>{{ctx.Locale.Tr "repo.settings.event_pull_request_milestone"}}</label>
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_milestone_desc"}}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Pull Request Comment -->
|
|
<div class="seven wide column">
|
|
<div class="field">
|
|
<div class="ui checkbox">
|
|
<input name="pull_request_comment" type="checkbox" {{if .Webhook.PullRequestComment}}checked{{end}}>
|
|
<label>{{ctx.Locale.Tr "repo.settings.event_pull_request_comment"}}</label>
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_comment_desc"}}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Pull Request Review -->
|
|
<div class="seven wide column">
|
|
<div class="field">
|
|
<div class="ui checkbox">
|
|
<input name="pull_request_review" type="checkbox" {{if .Webhook.PullRequestReview}}checked{{end}}>
|
|
<label>{{ctx.Locale.Tr "repo.settings.event_pull_request_review"}}</label>
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_review_desc"}}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Pull Request Sync -->
|
|
<div class="seven wide column">
|
|
<div class="field">
|
|
<div class="ui checkbox">
|
|
<input name="pull_request_sync" type="checkbox" {{if .Webhook.PullRequestSync}}checked{{end}}>
|
|
<label>{{ctx.Locale.Tr "repo.settings.event_pull_request_sync"}}</label>
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_sync_desc"}}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Pull Request Review Request -->
|
|
<div class="seven wide column">
|
|
<div class="field">
|
|
<div class="ui checkbox">
|
|
<input name="pull_request_review_request" type="checkbox" {{if .Webhook.PullRequestReviewRequest}}checked{{end}}>
|
|
<label>{{ctx.Locale.Tr "repo.settings.event_pull_request_review_request"}}</label>
|
|
<span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_review_request_desc"}}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</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"}}</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" .}}
|