MDL-56640 yui: remove moodle-core-formautosubmit
authorDan Poltawski <dan@moodle.com>
Fri, 28 Oct 2016 14:27:01 +0000 (15:27 +0100)
committerDan Poltawski <dan@moodle.com>
Tue, 20 Dec 2016 10:02:06 +0000 (10:02 +0000)
It's easily achieved with jquery primatives

lib/upgrade.txt
lib/yui/build/moodle-core-formautosubmit/moodle-core-formautosubmit-debug.js [deleted file]
lib/yui/build/moodle-core-formautosubmit/moodle-core-formautosubmit-min.js [deleted file]
lib/yui/build/moodle-core-formautosubmit/moodle-core-formautosubmit.js [deleted file]
lib/yui/src/formautosubmit/build.json [deleted file]
lib/yui/src/formautosubmit/js/formautosubmit.js [deleted file]
lib/yui/src/formautosubmit/meta/formautosubmit.json [deleted file]

index 39481d3..2ab1711 100644 (file)
@@ -1,6 +1,10 @@
 This files describes API changes in core libraries and APIs,
 information provided here is intended especially for developers.
 
+=== 3.3 ===
+* YUI module moodle-core-formautosubmit has been removed, use jquery .change() instead (see lib/templates/url_select.mustache for
+  an example)
+
 === 3.2 ===
 
 * Custom roles with access to any part of site administration that do not use the manager archetype will need
diff --git a/lib/yui/build/moodle-core-formautosubmit/moodle-core-formautosubmit-debug.js b/lib/yui/build/moodle-core-formautosubmit/moodle-core-formautosubmit-debug.js
deleted file mode 100644 (file)
index d32468f..0000000
Binary files a/lib/yui/build/moodle-core-formautosubmit/moodle-core-formautosubmit-debug.js and /dev/null differ
diff --git a/lib/yui/build/moodle-core-formautosubmit/moodle-core-formautosubmit-min.js b/lib/yui/build/moodle-core-formautosubmit/moodle-core-formautosubmit-min.js
deleted file mode 100644 (file)
index bbe45e4..0000000
Binary files a/lib/yui/build/moodle-core-formautosubmit/moodle-core-formautosubmit-min.js and /dev/null differ
diff --git a/lib/yui/build/moodle-core-formautosubmit/moodle-core-formautosubmit.js b/lib/yui/build/moodle-core-formautosubmit/moodle-core-formautosubmit.js
deleted file mode 100644 (file)
index c8cefb5..0000000
Binary files a/lib/yui/build/moodle-core-formautosubmit/moodle-core-formautosubmit.js and /dev/null differ
diff --git a/lib/yui/src/formautosubmit/build.json b/lib/yui/src/formautosubmit/build.json
deleted file mode 100644 (file)
index 2bfd035..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-{
-  "name": "moodle-core-formautosubmit",
-  "builds": {
-    "moodle-core-formautosubmit": {
-      "jsfiles": [
-        "formautosubmit.js"
-      ]
-    }
-  }
-}
diff --git a/lib/yui/src/formautosubmit/js/formautosubmit.js b/lib/yui/src/formautosubmit/js/formautosubmit.js
deleted file mode 100644 (file)
index d4c41d4..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-var CSS,
-    FORMAUTOSUBMITNAME = 'core-formautosubmit',
-    FORMAUTOSUBMIT,
-    INITIALIZED = false;
-
-// The CSS selectors we use
-CSS = {
-    AUTOSUBMIT: 'autosubmit'
-};
-
-FORMAUTOSUBMIT = function() {
-    FORMAUTOSUBMIT.superclass.constructor.apply(this, arguments);
-};
-
-Y.extend(FORMAUTOSUBMIT, Y.Base, {
-
-    /*
-     * Initialize the module
-     */
-    initializer: function() {
-        // Set up local variables
-        var applyto,
-            thisselect;
-        // We only apply the delegation once
-        if (!INITIALIZED) {
-            INITIALIZED = true;
-            applyto = Y.one('body');
-
-            // We don't listen for change events by default as using the keyboard triggers these too.
-            applyto.delegate('key', this.process_changes, 'press:13', 'select.' + CSS.AUTOSUBMIT, this);
-            applyto.delegate('click', this.process_changes, 'select.' + CSS.AUTOSUBMIT, this);
-
-            if (Y.UA.os === 'macintosh' && Y.UA.webkit) {
-                // Macintosh webkit browsers like change events, but non-macintosh webkit browsers don't.
-                applyto.delegate('change', this.process_changes, 'select.' + CSS.AUTOSUBMIT, this);
-            }
-            if (Y.UA.touchEnabled) {
-                // IOS and Android trigger touch events.
-                applyto.delegate('change', this.process_changes, 'select.' + CSS.AUTOSUBMIT, this);
-            }
-        }
-
-        // Assign this select items 'nothing' value and lastindex (current value)
-        if (this.get('selectid')) {
-            thisselect = Y.one('select#' + this.get('selectid'));
-            if (thisselect) {
-                if (this.get('nothing')) {
-                    thisselect.setData('nothing', this.get('nothing'));
-                }
-                thisselect.setData('startindex', thisselect.get('selectedIndex'));
-            } else {
-                Y.log("Warning: A single_select element was renderered, but the output is not displayed on the page.");
-            }
-        }
-    },
-
-    /*
-     * Check whether the select element was changed
-     */
-    check_changed: function(e) {
-        var select,
-            nothing,
-            startindex,
-            currentindex,
-            previousindex;
-        select = e.target.ancestor('select.' + CSS.AUTOSUBMIT, true);
-        if (!select) {
-            return false;
-        }
-
-        nothing = select.getData('nothing');
-        startindex = select.getData('startindex');
-        currentindex = select.get('selectedIndex');
-
-        previousindex = parseInt(select.getData('previousindex'), 10);
-        select.setData('previousindex', currentindex);
-        if (!previousindex) {
-            previousindex = startindex;
-        }
-
-        // Check whether the field has changed, and is not the 'nothing' value
-        if ((nothing === false || select.get('value') !== nothing)
-                && startindex !== select.get('selectedIndex') && currentindex !== previousindex) {
-            return select;
-        }
-        return false;
-    },
-
-    /*
-     * Process any changes
-     */
-    process_changes: function(e) {
-        var select = this.check_changed(e),
-            form;
-        if (select) {
-            form = select.ancestor('form', true);
-            form.submit();
-        }
-    }
-},
-{
-    NAME: FORMAUTOSUBMITNAME,
-    ATTRS: {
-        selectid: {
-            'value': ''
-        },
-        nothing: {
-            'value': ''
-        },
-        ignorechangeevent: {
-            'value': false
-        }
-    }
-});
-
-M.core = M.core || {};
-M.core.init_formautosubmit = M.core.init_formautosubmit || function(config) {
-    return new FORMAUTOSUBMIT(config);
-};
diff --git a/lib/yui/src/formautosubmit/meta/formautosubmit.json b/lib/yui/src/formautosubmit/meta/formautosubmit.json
deleted file mode 100644 (file)
index f034605..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-{
-  "moodle-core-formautosubmit": {
-    "requires": [
-      "base",
-      "event-key"
-    ]
-  }
-}