split icon indicating copy to clipboard operation
split copied to clipboard

Refactor Confirmation Dialogs and Event Handling in Dashboard

Open tofoli opened this issue 11 months ago • 0 comments

Summary

This pull request refactors the confirmation dialog handling in the Split dashboard. The changes improve the maintainability of the code by removing unused functions and replacing inline event handlers with class-based event listeners.

Changes Made

  • Removed the confirmStep function as it was not utilized.
  • Introduced a centralized event handler setup that listens for click events on elements with specific class names related to various actions (e.g., reopen, enable cohorting, disable cohorting, reset, delete, and confirm winner).
  • Updated the form elements in the _controls.erb and _experiment.erb views to use class names instead of inline onclick attributes for triggering confirmation dialogs.

Benefits

  • Enhances code readability and maintainability.
  • Reduces the amount of inline JavaScript, promoting a cleaner separation of concerns.
  • Simplifies the addition of new confirmation dialogs in the future.

tofoli avatar Feb 20 '25 12:02 tofoli