MDL-56640 yui: remove moodle-core-formautosubmit
It's easily achieved with jquery primatives
This commit is contained in:
@@ -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
|
||||
|
||||
-124
@@ -1,124 +0,0 @@
|
||||
YUI.add('moodle-core-formautosubmit', function (Y, NAME) {
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["base", "event-key"]});
|
||||
@@ -1 +0,0 @@
|
||||
YUI.add("moodle-core-formautosubmit",function(e,t){var n,r="core-formautosubmit",i,s=!1;n={AUTOSUBMIT:"autosubmit"},i=function(){i.superclass.constructor.apply(this,arguments)},e.extend(i,e.Base,{initializer:function(){var t,r;s||(s=!0,t=e.one("body"),t.delegate("key",this.process_changes,"press:13","select."+n.AUTOSUBMIT,this),t.delegate("click",this.process_changes,"select."+n.AUTOSUBMIT,this),e.UA.os==="macintosh"&&e.UA.webkit&&t.delegate("change",this.process_changes,"select."+n.AUTOSUBMIT,this),e.UA.touchEnabled&&t.delegate("change",this.process_changes,"select."+n.AUTOSUBMIT,this)),this.get("selectid")&&(r=e.one("select#"+this.get("selectid")),r&&(this.get("nothing")&&r.setData("nothing",this.get("nothing")),r.setData("startindex",r.get("selectedIndex"))))},check_changed:function(e){var t,r,i,s,o;return t=e.target.ancestor("select."+n.AUTOSUBMIT,!0),t?(r=t.getData("nothing"),i=t.getData("startindex"),s=t.get("selectedIndex"),o=parseInt(t.getData("previousindex"),10),t.setData("previousindex",s),o||(o=i),r!==!1&&t.get("value")===r||i===t.get("selectedIndex")||s===o?!1:t):!1},process_changes:function(e){var t=this.check_changed(e),n;t&&(n=t.ancestor("form",!0),n.submit())}},{NAME:r,ATTRS:{selectid:{value:""},nothing:{value:""},ignorechangeevent:{value:!1}}}),M.core=M.core||{},M.core.init_formautosubmit=M.core.init_formautosubmit||function(e){return new i(e)}},"@VERSION@",{requires:["base","event-key"]});
|
||||
@@ -1,123 +0,0 @@
|
||||
YUI.add('moodle-core-formautosubmit', function (Y, NAME) {
|
||||
|
||||
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 {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/*
|
||||
* 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);
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["base", "event-key"]});
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"name": "moodle-core-formautosubmit",
|
||||
"builds": {
|
||||
"moodle-core-formautosubmit": {
|
||||
"jsfiles": [
|
||||
"formautosubmit.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
-119
@@ -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);
|
||||
};
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"moodle-core-formautosubmit": {
|
||||
"requires": [
|
||||
"base",
|
||||
"event-key"
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user