Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

do not prevent checking the checkbox

ulfertsc8b37fff9021
diff --git a/app/helpers/removed_js_helpers_helper.rb b/app/helpers/removed_js_helpers_helper.rb
index 47d646742f0..e63a0bf475b 100644
--- a/app/helpers/removed_js_helpers_helper.rb
+++ b/app/helpers/removed_js_helpers_helper.rb
@@ -42,9 +42,9 @@ module RemovedJsHelpersHelper
##
# Execute the callback on click
- def csp_onclick(callback_str, selector)
+ def csp_onclick(callback_str, selector, prevent_default: true)
content_for(:additional_js_dom_ready) do
- "jQuery('#{selector}').click(function() { #{callback_str}; return false; });\n".html_safe
+ "jQuery('#{selector}').click(function() { #{callback_str}; #{prevent_default ? 'return false;' : ''} });\n".html_safe
end
end
end
diff --git a/app/views/settings/_repositories.html.erb b/app/views/settings/_repositories.html.erb
index c9ce9d95124..a6549855938 100644
--- a/app/views/settings/_repositories.html.erb
+++ b/app/views/settings/_repositories.html.erb
@@ -47,7 +47,9 @@ See docs/COPYRIGHT.rdoc for more details.
</div>
<div class="form--field">
<%= setting_check_box :sys_api_enabled %>
- <% csp_onclick("jQuery('#settings_sys_api_key').prop('disabled', !this.checked)", '#settings_sys_api_enabled') %>
+ <% csp_onclick("jQuery('#settings_sys_api_key').prop('disabled', !this.checked)",
+ '#settings_sys_api_enabled',
+ prevent_default: false) %>
<div class="form--field-instructions">
<%= t(:setting_sys_api_description) %>
</div>