mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-25 03:06:10 +01:00
83d2b3b7fa
UX/Translation changes: - new teams: remove redundant tooltips that don't add meaningful information - move general information to table fieldset - new teams: rename "general" to "custom" access for clarity - new teams: show labels beside options on mobile Accessibility: - semantic form elements allow easier navigation (fieldset, mostly) - improve better labelling of new teams table - fix accessibility scan issues - TODO: the parts that "disable" form elements were not yet touched and are not really accessible to screenreaders Technical: - replace two JavaScript solutions with one CSS standard - implement a simpler grid (.simple-grid) - simplify markup - remove some webhook settings specific CSS Testing: - check more form content for accessibility issues - but exclude tooltips from the scan :( - reuse existing form tests from previous PR
194 lines
8.9 KiB
Go HTML Template
194 lines
8.9 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>
|
|
<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"}}</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" .}}
|