mirror of
https://github.com/moodle/moodle.git
synced 2025-04-24 18:04:43 +02:00
MDL-43334 backup: Fix cancel JS
The cancel button is a form element within a div that has the confirmcancel class. When we accept a cancel modal, we should attempt to click the most specific form element of the div, not the entire div.
This commit is contained in:
parent
ddd7ff1827
commit
6fea9dc4b3
backup/util/ui/yui
build/moodle-backup-confirmcancel
moodle-backup-confirmcancel-debug.jsmoodle-backup-confirmcancel-min.jsmoodle-backup-confirmcancel.js
src/confirmcancel/js
11
backup/util/ui/yui/build/moodle-backup-confirmcancel/moodle-backup-confirmcancel-debug.js
vendored
11
backup/util/ui/yui/build/moodle-backup-confirmcancel/moodle-backup-confirmcancel-debug.js
vendored
@ -68,8 +68,17 @@ M.core_backup.confirmcancel = {
|
||||
// Detach the listeners for the confirm box so they don't fire again.
|
||||
new Y.EventHandle(M.core_backup.confirmcancel.listeners).detach();
|
||||
|
||||
// The currentTarget is a div surrounding the form elements. Simulating a click on the div is
|
||||
// not going to submit a form so we need to find the form element to click.
|
||||
var element = e.currentTarget.one('input, select, button');
|
||||
|
||||
// Simulate the original cancel button click.
|
||||
e.currentTarget.simulate('click');
|
||||
if (element) {
|
||||
element.simulate('click');
|
||||
} else {
|
||||
// Backwards compatibility only.
|
||||
e.currentTarget.simulate('click');
|
||||
}
|
||||
}, this);
|
||||
|
||||
|
||||
|
@ -1 +1 @@
|
||||
YUI.add("moodle-backup-confirmcancel",function(e,t){M.core_backup=M.core_backup||{},M.core_backup.confirmcancel={listeners:[],config:{},watch_cancel_buttons:function(t){this.config=t,this.listeners.push(e.one(e.config.doc.body).delegate("click",this.confirm_cancel,".confirmcancel",this))},confirm_cancel:function(t){t.preventDefault();var n=new M.core.confirm(this.config);n.on("complete-yes",function(){(new e.EventHandle(M.core_backup.confirmcancel.listeners)).detach(),t.currentTarget.simulate("click")},this),n.show()}}},"@VERSION@",{requires:["node","node-event-simulate","moodle-core-notification-confirm"]});
|
||||
YUI.add("moodle-backup-confirmcancel",function(e,t){M.core_backup=M.core_backup||{},M.core_backup.confirmcancel={listeners:[],config:{},watch_cancel_buttons:function(t){this.config=t,this.listeners.push(e.one(e.config.doc.body).delegate("click",this.confirm_cancel,".confirmcancel",this))},confirm_cancel:function(t){t.preventDefault();var n=new M.core.confirm(this.config);n.on("complete-yes",function(){(new e.EventHandle(M.core_backup.confirmcancel.listeners)).detach();var n=t.currentTarget.one("input, select, button");n?n.simulate("click"):t.currentTarget.simulate("click")},this),n.show()}}},"@VERSION@",{requires:["node","node-event-simulate","moodle-core-notification-confirm"]});
|
||||
|
@ -68,8 +68,17 @@ M.core_backup.confirmcancel = {
|
||||
// Detach the listeners for the confirm box so they don't fire again.
|
||||
new Y.EventHandle(M.core_backup.confirmcancel.listeners).detach();
|
||||
|
||||
// The currentTarget is a div surrounding the form elements. Simulating a click on the div is
|
||||
// not going to submit a form so we need to find the form element to click.
|
||||
var element = e.currentTarget.one('input, select, button');
|
||||
|
||||
// Simulate the original cancel button click.
|
||||
e.currentTarget.simulate('click');
|
||||
if (element) {
|
||||
element.simulate('click');
|
||||
} else {
|
||||
// Backwards compatibility only.
|
||||
e.currentTarget.simulate('click');
|
||||
}
|
||||
}, this);
|
||||
|
||||
|
||||
|
@ -66,8 +66,17 @@ M.core_backup.confirmcancel = {
|
||||
// Detach the listeners for the confirm box so they don't fire again.
|
||||
new Y.EventHandle(M.core_backup.confirmcancel.listeners).detach();
|
||||
|
||||
// The currentTarget is a div surrounding the form elements. Simulating a click on the div is
|
||||
// not going to submit a form so we need to find the form element to click.
|
||||
var element = e.currentTarget.one('input, select, button');
|
||||
|
||||
// Simulate the original cancel button click.
|
||||
e.currentTarget.simulate('click');
|
||||
if (element) {
|
||||
element.simulate('click');
|
||||
} else {
|
||||
// Backwards compatibility only.
|
||||
e.currentTarget.simulate('click');
|
||||
}
|
||||
}, this);
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user