Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2382,6 +2382,8 @@ settings.event_desc = Trigger On:
settings.event_push_only = Push Events
settings.event_send_everything = All Events
settings.event_choose = Custom Events…
settings.event_button_select_all = Select All
settings.event_button_deselect_all = Deselect All
settings.event_header_repository = Repository Events
settings.event_create = Create
settings.event_create_desc = Branch or tag created.
Expand Down
27 changes: 27 additions & 0 deletions templates/repo/settings/webhook/settings.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@
</div>

<div class="events fields ui grid {{if not .Webhook.ChooseEvents}}tw-hidden{{end}}">
<div class="fourteen wide column">
<div class="field">
<button type="button" class="ui tiny button" id="event-select-all">
{{ctx.Locale.Tr "repo.settings.event_button_select_all"}}
</button>
<button type="button" class="ui tiny button" id="event-deselect-all">
{{ctx.Locale.Tr "repo.settings.event_button_deselect_all"}}
</button>
</div>
</div>
Copy link
Member

@silverwind silverwind Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move it to line 97. It's more logical for it to be after the "Repository Events" header.

<!-- Repository Events -->
<div class="fourteen wide column">
<label>{{ctx.Locale.Tr "repo.settings.event_header_repository"}}</label>
Expand Down Expand Up @@ -354,3 +364,20 @@
>{{ctx.Locale.Tr "repo.settings.delete_webhook"}}</a>
{{end}}
</div>

<script>
(function () {
const section = document.querySelector('.events.fields.ui.grid');
if (!section) return;
const all = section.querySelectorAll('input[type="checkbox"]');
document.getElementById('event-select-all')?.addEventListener('click', () => {
all.forEach(i => { i.checked = true; });
});
document.getElementById('event-deselect-all')?.addEventListener('click', () => {
all.forEach(i => { i.checked = false; });
});
})();
</script>
Copy link
Member

@silverwind silverwind Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. We need to move this code to web_src/js/features/repo-settings.ts. We avoid inline scripts because they are problematic with CSP and also the linter does not lint them.
  2. Use for-of loops instead of forEach, but the linter will also tell you that 😉.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it better to place this code to web_src/js/features/comp/WebHookEditor.ts? There is already 'custom events' switch logic presented and webhooks are not bound to repos.