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

Remove jQuery from global helpers

Alexander Brandon Coles5cc71d4c1bc2
diff --git a/frontend/src/app/core/setup/globals/global-helpers.ts b/frontend/src/app/core/setup/globals/global-helpers.ts
index abe5958ecd3..d74475153c3 100644
--- a/frontend/src/app/core/setup/globals/global-helpers.ts
+++ b/frontend/src/app/core/setup/globals/global-helpers.ts
@@ -33,22 +33,15 @@
* It is used in some `link_to_function` helpers in Rails templates
*/
export class GlobalHelpers {
- public checkAll(selector:any, checked:any) {
- document
- .querySelectorAll(`#${selector} input[type="checkbox"]:not([disabled])`)
- .forEach((el:HTMLInputElement) => el.checked = checked);
+ public checkAll(selector:string, checked:boolean) {
+ document
+ .querySelectorAll<HTMLInputElement>(`#${selector} input[type="checkbox"]:not([disabled])`)
+ .forEach((el) => { el.checked = checked; });
}
- public toggleCheckboxesBySelector(selector:any) {
- const boxes = jQuery(selector);
- let all_checked = true;
- for (let i = 0; i < boxes.length; i++) {
- if (boxes[i].checked === false) {
- all_checked = false;
- }
- }
- for (let i = 0; i < boxes.length; i++) {
- boxes[i].checked = !all_checked;
- }
+ public toggleCheckboxesBySelector(selector:string) {
+ const checkboxes = Array.from(document.querySelectorAll<HTMLInputElement>(selector));
+ const allChecked = checkboxes.every((el) => el.checked);
+ checkboxes.forEach((el) => { el.checked = !allChecked; });
}
}