mirror of
https://github.com/moodle/moodle.git
synced 2025-04-25 10:26:17 +02:00
MDL-40368 tool_capability: fixed regression marking single result selected
This commit is contained in:
parent
76149901a9
commit
858fc79db8
@ -122,6 +122,7 @@ SEARCH.prototype = {
|
||||
for (capability in this.selectoptions) {
|
||||
if (capability.indexOf(search) >= 0) {
|
||||
matching++;
|
||||
last = this.selectoptions[capability];
|
||||
this.select.append(this.selectoptions[capability]);
|
||||
}
|
||||
}
|
||||
@ -160,4 +161,5 @@ M.tool_capability.init_capability_search = function(options) {
|
||||
new SEARCH(options);
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["base", "node"]});
|
||||
|
@ -1 +1 @@
|
||||
YUI.add("moodle-tool_capability-search",function(e,t){var n=function(){n.superclass.constructor.apply(this,arguments)};n.prototype={form:null,select:null,selectoptions:{},input:null,button:null,lastsearch:null,initializer:function(){this.form=e.one("#capability-overview-form"),this.select=this.form.one("select[data-search=capability]"),this.select.setStyle("minWidth",this.select.get("offsetWidth")),this.select.get("options").each(function(e){var t=e.get("value");this.selectoptions[t]=e},this),this.button=this.form.all("input[type=submit]"),this.lastsearch=this.form.one("input[name=search]");var t=e.Node.create('<div id="capabilitysearchui"></div>'),n=e.Node.create('<label for="capabilitysearch">'+this.get("strsearch")+"</label>");this.input=e.Node.create('<input type="text" id="capabilitysearch" />'),t.append(n).append(this.input),this.select.insert(t,"before"),this.select.one("option").setStyle("display","none"),this.input.on("keyup",this.typed,this),this.select.on("change",this.validate,this),this.lastsearch&&(this.input.set("value",this.lastsearch.get("value")),this.typed(),this.select.one("option[selected]")&&this.select.set("scrollTop",this.select.one("option[selected]").get("getX"))),this.validate()},validate:function(){this.button.set("disabled",this.select.get("value")==="")},typed:function(){var e=this.input.get("value"),t=0,n=null,r;this.lastsearch&&this.lastsearch.set("value",e),this.select.all("option").remove();for(r in this.selectoptions)r.indexOf(e)>=0&&(t++,this.select.append(this.selectoptions[r]));t===0?this.input.addClass("error"):(this.input.removeClass("error"),t===1&&n.set("selected",!0)),this.validate()}},e.extend(n,e.Base,n.prototype,{NAME:"tool_capability-search",ATTRS:{strsearch:{}}}),M.tool_capability=M.tool_capability||{},M.tool_capability.init_capability_search=function(e){new n(e)}},"@VERSION@",{requires:["base","node"]});
|
||||
YUI.add("moodle-tool_capability-search",function(e,t){var n=function(){n.superclass.constructor.apply(this,arguments)};n.prototype={form:null,select:null,selectoptions:{},input:null,button:null,lastsearch:null,initializer:function(){this.form=e.one("#capability-overview-form"),this.select=this.form.one("select[data-search=capability]"),this.select.setStyle("minWidth",this.select.get("offsetWidth")),this.select.get("options").each(function(e){var t=e.get("value");this.selectoptions[t]=e},this),this.button=this.form.all("input[type=submit]"),this.lastsearch=this.form.one("input[name=search]");var t=e.Node.create('<div id="capabilitysearchui"></div>'),n=e.Node.create('<label for="capabilitysearch">'+this.get("strsearch")+"</label>");this.input=e.Node.create('<input type="text" id="capabilitysearch" />'),t.append(n).append(this.input),this.select.insert(t,"before"),this.select.one("option").setStyle("display","none"),this.input.on("keyup",this.typed,this),this.select.on("change",this.validate,this),this.lastsearch&&(this.input.set("value",this.lastsearch.get("value")),this.typed(),this.select.one("option[selected]")&&this.select.set("scrollTop",this.select.one("option[selected]").get("getX"))),this.validate()},validate:function(){this.button.set("disabled",this.select.get("value")==="")},typed:function(){var e=this.input.get("value"),t=0,n=null,r;this.lastsearch&&this.lastsearch.set("value",e),this.select.all("option").remove();for(r in this.selectoptions)r.indexOf(e)>=0&&(t++,n=this.selectoptions[r],this.select.append(this.selectoptions[r]));t===0?this.input.addClass("error"):(this.input.removeClass("error"),t===1&&n.set("selected",!0)),this.validate()}},e.extend(n,e.Base,n.prototype,{NAME:"tool_capability-search",ATTRS:{strsearch:{}}}),M.tool_capability=M.tool_capability||{},M.tool_capability.init_capability_search=function(e){new n(e)}},"@VERSION@",{requires:["base","node"]});
|
||||
|
@ -122,6 +122,7 @@ SEARCH.prototype = {
|
||||
for (capability in this.selectoptions) {
|
||||
if (capability.indexOf(search) >= 0) {
|
||||
matching++;
|
||||
last = this.selectoptions[capability];
|
||||
this.select.append(this.selectoptions[capability]);
|
||||
}
|
||||
}
|
||||
@ -160,4 +161,5 @@ M.tool_capability.init_capability_search = function(options) {
|
||||
new SEARCH(options);
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["base", "node"]});
|
||||
|
@ -120,6 +120,7 @@ SEARCH.prototype = {
|
||||
for (capability in this.selectoptions) {
|
||||
if (capability.indexOf(search) >= 0) {
|
||||
matching++;
|
||||
last = this.selectoptions[capability];
|
||||
this.select.append(this.selectoptions[capability]);
|
||||
}
|
||||
}
|
||||
@ -156,4 +157,4 @@ M.tool_capability = M.tool_capability || {};
|
||||
*/
|
||||
M.tool_capability.init_capability_search = function(options) {
|
||||
new SEARCH(options);
|
||||
};
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user