Skip to content

Commit

Permalink
MDL-82294 core_form: Implement form JS as ECMAScript
Browse files Browse the repository at this point in the history
  • Loading branch information
Chocolate-lightning committed Jan 17, 2025
1 parent a2653cc commit 41981a5
Show file tree
Hide file tree
Showing 19 changed files with 1,153 additions and 11 deletions.
7 changes: 7 additions & 0 deletions .upgradenotes/MDL-82294-2024080705300128.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
issueNumber: MDL-82294
notes:
core_form:
- message: >-
Begin the migration of forum YUI to ECMAScript, this is currently in
alpha and needs further testing
type: improved
4 changes: 2 additions & 2 deletions backup/util/ui/amd/build/schema_backup_form.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion backup/util/ui/amd/build/schema_backup_form.min.js.map

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions backup/util/ui/amd/src/schema_backup_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

import Notification from 'core/notification';
import * as Templates from 'core/templates';
import Form from 'core_form/form';

const Selectors = {
action: '[data-mdl-action]',
Expand Down Expand Up @@ -142,10 +143,9 @@ export default class BackupFormController {
}

// At this point, we really need to persuade the form we are part of to
// update all of its disabledIf rules. However, as far as I can see,
// given the way that lib/form/form.js is written, that is impossible.
if (formId && M.form) {
M.form.updateFormState(formId);
// update all of its disabledIf rules.
if (formId) {
Form.getInstance(formId)?.formUpdatedExternally();
}
}

Expand Down
2 changes: 1 addition & 1 deletion backup/util/ui/tests/behat/schema_select_all.feature
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Feature: Schema form selectors
And the "Include Test data 2 user data" "checkbox" should be enabled

@javascript
Scenario: The type options panell allow to select all and none of one activity type
Scenario: The type options panel allow to select all and none of one activity type
Given the field "Section 1" matches value "1"
And the field "Test assign 1" matches value "1"
And the field "Test data 1" matches value "1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@core @core_grades @javascript @testtt
@core @core_grades @javascript
Feature: We carry over data from modal to advanced grade item settings
In order to setup grade items quickly
As an teacher
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,7 @@ public function js_call_amd($fullmodule, $func = null, $params = []) {
$jsonparams[] = json_encode($param);
}
$strparams = implode(', ', $jsonparams);
if ($CFG->debugdeveloper) {
if ($CFG->debugdeveloper && $fullmodule !== 'core_form/form') {
$toomanyparamslimit = 1024;
if (strlen($strparams) > $toomanyparamslimit) {
debugging('Too much data passed as arguments to js_call_amd("' . $fullmodule . '", "' . $func .
Expand Down
Loading

0 comments on commit 41981a5

Please sign in to comment.