Skip to content

js: Use ESM format for form.js#701

Merged
smbader merged 4 commits intoncstate-delta:mainfrom
jrchamp:fix/esm-format
Apr 2, 2026
Merged

js: Use ESM format for form.js#701
smbader merged 4 commits intoncstate-delta:mainfrom
jrchamp:fix/esm-format

Conversation

@jrchamp
Copy link
Copy Markdown
Collaborator

@jrchamp jrchamp commented Feb 16, 2026

Switching to ESM is primarily:

  • Switch from a define line to multiple import lines.
  • Items that were being returned, need to be exported.
  • var becomes const unless the value is modifiable, in which case it becomes let
  • function() becomes () =>; similarly function(arg1) becomes (arg1) =>
  • Avoid this, either by creating a real class or using parameters from the callable.

Other compatibility changes that I made:

  • Convert events like click( to on('click', .
  • Use catch() instead of fail() so we are prepared for real Promises.
  • Aliased get_string/get_strings to getString/getStrings so we continue to support Moodle <4.3.
    • When support for Moodle 4.2 is dropped, we can use the real getString/getStrings.

Bugs that testing identified and that are fixed in this PR:

  1. Breakout room tabs were not working in Moodle 5.x (Bootstrap 5).
    1. Add two rooms.
    2. Click on the first room tab.
    3. Expected: The first room details should display. Actual: The second room details are still visible and the browser has tried to navigate to #link2.
  2. Repeat options were not unhiding when switching from a more-restricted list to a less-restricted list.
    1. Choose recurring.
    2. Select monthly, notice that the limit is set to 3.
    3. Select weekly.
    4. Expected: The limit should be set to 12. Actual: The limit is still set to 3.

Fixes #571

@jrchamp jrchamp requested a review from a team February 16, 2026 16:32
@jrchamp jrchamp self-assigned this Feb 16, 2026
@jrchamp jrchamp added the bug Fixes problems or reduces technical debt label Feb 16, 2026
@smbader
Copy link
Copy Markdown
Contributor

smbader commented Feb 19, 2026

This contains some nice clean up work and includes the new data-bs-toggle used in Bootstrap 5 which is used in Moodle 5.x.

Testing needs to validate this continues to work on older versions and plays nicely with our breakout room feature request that is also being tested.

@smbader smbader requested a review from armccoy February 19, 2026 16:33
@smbader smbader requested a review from sgrandh3 March 19, 2026 15:12
@sgrandh3
Copy link
Copy Markdown
Collaborator

Hey @jrchamp , can you kindly eloborate " more-restricted list to a less-restricted list" in your description of the bugs. When creating a recurring zoom meeting, i do not see any options for the restrictions list.

@jrchamp
Copy link
Copy Markdown
Collaborator Author

jrchamp commented Mar 31, 2026

Hey @jrchamp , can you kindly eloborate " more-restricted list to a less-restricted list" in your description of the bugs. When creating a recurring zoom meeting, i do not see any options for the restrictions list.

Specifically, when Monthly is chosen, the repeat interval only allows options 1, 2 and 3. After choosing Monthly, choosing Weekly should show all options between 1 and 12. The bug is that options 4 through 12 stay hidden, which this PR fixes.

The underlying reason for the bug is that the code that modifies which options are visible is written in a way where the Monthly and Weekly choices only hide options and never show them. As the options available for Monthly are a subset of the options for Weekly, this problem is only apparent when switching from Monthly to Weekly. The term "restrictions" is causing unnecessary confusion in this context: I am only referring to the range of options that are allowed for the repetition intervals.

@smbader smbader merged commit c4d0f25 into ncstate-delta:main Apr 2, 2026
6 checks passed
@sgrandh3
Copy link
Copy Markdown
Collaborator

sgrandh3 commented Apr 2, 2026

After purging the cache, retested for Daily, weekly , monthly and no fixed time. Verified that in all meetings, the upcoming meeting is displayed. As a future enhancement, it would be nice to have all the recurring sessions also displayed .

@jrchamp jrchamp deleted the fix/esm-format branch April 12, 2026 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Fixes problems or reduces technical debt

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Cleanup: AMD modules should be in ESM format

3 participants