MDL-47870 tool_monitor: Fix event select dropdown
This commit is contained in:
Vendored
+17
@@ -57,6 +57,9 @@ Y.extend(DropDown, Y.Base, {
|
||||
initializer: function() {
|
||||
this.plugin = Y.one(SELECTORS.PLUGIN);
|
||||
this.eventname = Y.one(SELECTORS.EVENTNAME);
|
||||
var selection = this.eventname.get('value'); // Get selected event name.
|
||||
this.updateEventsList();
|
||||
this.updateSelection(selection);
|
||||
this.plugin.on('change', this.updateEventsList, this);
|
||||
},
|
||||
|
||||
@@ -85,6 +88,20 @@ Y.extend(DropDown, Y.Base, {
|
||||
}
|
||||
}, this);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Method to update the selected node from the options list.
|
||||
*
|
||||
* @method updateSelection
|
||||
* @param {string} selection The options node value that should be selected.
|
||||
*/
|
||||
updateSelection: function(selection) {
|
||||
this.eventname.get('options').each(function(opt) {
|
||||
if (opt.get('value') === selection) {
|
||||
opt.set('selected', 'selected');
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
}, {
|
||||
NAME: 'dropDown',
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
YUI.add("moodle-tool_monitor-dropdown",function(e,t){function n(){n.superclass.constructor.apply(this,arguments)}var r={PLUGIN:"#id_plugin",EVENTNAME:"#id_eventname",OPTION:"option",CHOOSE:'option[value=""]'};e.extend(n,e.Base,{plugin:null,eventname:null,initializer:function(){this.plugin=e.one(r.PLUGIN),this.eventname=e.one(r.EVENTNAME),this.plugin.on("change",this.updateEventsList,this)},updateEventsList:function(){var t,n,i,s=this.plugin.get("value"),o="\\"+s+"\\";this.eventname.all(r.OPTION).remove(!0),n=this.get("eventlist"),i=e.Node.create('<option value="">'+n[""]+"</option>"),i.set("selected","selected"),this.eventname.appendChild(i),e.Object.each(n,function(n,r){r.substring(0,o.length)===o&&(t=e.Node.create('<option value="'+r+'">'+n+"</option>"),this.eventname.appendChild(t))},this)}},{NAME:"dropDown",ATTRS:{eventlist:null}}),e.namespace("M.tool_monitor.DropDown").init=function(e){return new n(e)}},"@VERSION@",{requires:["base","event","node"]});
|
||||
YUI.add("moodle-tool_monitor-dropdown",function(e,t){function n(){n.superclass.constructor.apply(this,arguments)}var r={PLUGIN:"#id_plugin",EVENTNAME:"#id_eventname",OPTION:"option",CHOOSE:'option[value=""]'};e.extend(n,e.Base,{plugin:null,eventname:null,initializer:function(){this.plugin=e.one(r.PLUGIN),this.eventname=e.one(r.EVENTNAME);var t=this.eventname.get("value");this.updateEventsList(),this.updateSelection(t),this.plugin.on("change",this.updateEventsList,this)},updateEventsList:function(){var t,n,i,s=this.plugin.get("value"),o="\\"+s+"\\";this.eventname.all(r.OPTION).remove(!0),n=this.get("eventlist"),i=e.Node.create('<option value="">'+n[""]+"</option>"),i.set("selected","selected"),this.eventname.appendChild(i),e.Object.each(n,function(n,r){r.substring(0,o.length)===o&&(t=e.Node.create('<option value="'+r+'">'+n+"</option>"),this.eventname.appendChild(t))},this)},updateSelection:function(e){this.eventname.get("options").each(function(t){t.get("value")===e&&t.set("selected","selected")},this)}},{NAME:"dropDown",ATTRS:{eventlist:null}}),e.namespace("M.tool_monitor.DropDown").init=function(e){return new n(e)}},"@VERSION@",{requires:["base","event","node"]});
|
||||
|
||||
+17
@@ -57,6 +57,9 @@ Y.extend(DropDown, Y.Base, {
|
||||
initializer: function() {
|
||||
this.plugin = Y.one(SELECTORS.PLUGIN);
|
||||
this.eventname = Y.one(SELECTORS.EVENTNAME);
|
||||
var selection = this.eventname.get('value'); // Get selected event name.
|
||||
this.updateEventsList();
|
||||
this.updateSelection(selection);
|
||||
this.plugin.on('change', this.updateEventsList, this);
|
||||
},
|
||||
|
||||
@@ -85,6 +88,20 @@ Y.extend(DropDown, Y.Base, {
|
||||
}
|
||||
}, this);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Method to update the selected node from the options list.
|
||||
*
|
||||
* @method updateSelection
|
||||
* @param {string} selection The options node value that should be selected.
|
||||
*/
|
||||
updateSelection: function(selection) {
|
||||
this.eventname.get('options').each(function(opt) {
|
||||
if (opt.get('value') === selection) {
|
||||
opt.set('selected', 'selected');
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
}, {
|
||||
NAME: 'dropDown',
|
||||
|
||||
@@ -55,6 +55,9 @@ Y.extend(DropDown, Y.Base, {
|
||||
initializer: function() {
|
||||
this.plugin = Y.one(SELECTORS.PLUGIN);
|
||||
this.eventname = Y.one(SELECTORS.EVENTNAME);
|
||||
var selection = this.eventname.get('value'); // Get selected event name.
|
||||
this.updateEventsList();
|
||||
this.updateSelection(selection);
|
||||
this.plugin.on('change', this.updateEventsList, this);
|
||||
},
|
||||
|
||||
@@ -83,6 +86,20 @@ Y.extend(DropDown, Y.Base, {
|
||||
}
|
||||
}, this);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Method to update the selected node from the options list.
|
||||
*
|
||||
* @method updateSelection
|
||||
* @param {string} selection The options node value that should be selected.
|
||||
*/
|
||||
updateSelection: function(selection) {
|
||||
this.eventname.get('options').each(function(opt) {
|
||||
if (opt.get('value') === selection) {
|
||||
opt.set('selected', 'selected');
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
}, {
|
||||
NAME: 'dropDown',
|
||||
|
||||
Reference in New Issue
Block a user