Apply original option classes to Chosen's search results.
This commit is contained in:
parent
cde5fc8e69
commit
7dd29088e8
7 changed files with 15 additions and 4 deletions
|
@ -300,6 +300,9 @@
|
||||||
if (option.group_array_index != null) {
|
if (option.group_array_index != null) {
|
||||||
classes.push("group-option");
|
classes.push("group-option");
|
||||||
}
|
}
|
||||||
|
if (option.classes !== "") {
|
||||||
|
classes.push(option.classes);
|
||||||
|
}
|
||||||
return '<li id="' + option.dom_id + '" class="' + classes.join(' ') + '">' + option.html + '</li>';
|
return '<li id="' + option.dom_id + '" class="' + classes.join(' ') + '">' + option.html + '</li>';
|
||||||
} else {
|
} else {
|
||||||
return "";
|
return "";
|
||||||
|
@ -819,7 +822,8 @@
|
||||||
html: option.innerHTML,
|
html: option.innerHTML,
|
||||||
selected: option.selected,
|
selected: option.selected,
|
||||||
disabled: group_disabled === true ? group_disabled : option.disabled,
|
disabled: group_disabled === true ? group_disabled : option.disabled,
|
||||||
group_array_index: group_position
|
group_array_index: group_position,
|
||||||
|
classes: option.className
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.parsed.push({
|
this.parsed.push({
|
||||||
|
|
2
chosen/chosen.jquery.min.js
vendored
2
chosen/chosen.jquery.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -288,6 +288,9 @@
|
||||||
if (option.group_array_index != null) {
|
if (option.group_array_index != null) {
|
||||||
classes.push("group-option");
|
classes.push("group-option");
|
||||||
}
|
}
|
||||||
|
if (option.classes !== "") {
|
||||||
|
classes.push(option.classes);
|
||||||
|
}
|
||||||
return '<li id="' + option.dom_id + '" class="' + classes.join(' ') + '">' + option.html + '</li>';
|
return '<li id="' + option.dom_id + '" class="' + classes.join(' ') + '">' + option.html + '</li>';
|
||||||
} else {
|
} else {
|
||||||
return "";
|
return "";
|
||||||
|
@ -808,7 +811,8 @@
|
||||||
html: option.innerHTML,
|
html: option.innerHTML,
|
||||||
selected: option.selected,
|
selected: option.selected,
|
||||||
disabled: group_disabled === true ? group_disabled : option.disabled,
|
disabled: group_disabled === true ? group_disabled : option.disabled,
|
||||||
group_array_index: group_position
|
group_array_index: group_position,
|
||||||
|
classes: option.className
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.parsed.push({
|
this.parsed.push({
|
||||||
|
|
2
chosen/chosen.proto.min.js
vendored
2
chosen/chosen.proto.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -236,6 +236,7 @@ class Chosen
|
||||||
classes = if option.selected and @is_multiple then [] else ["active-result"]
|
classes = if option.selected and @is_multiple then [] else ["active-result"]
|
||||||
classes.push "result-selected" if option.selected
|
classes.push "result-selected" if option.selected
|
||||||
classes.push "group-option" if option.group_array_index?
|
classes.push "group-option" if option.group_array_index?
|
||||||
|
classes.push option.classes if option.classes != ""
|
||||||
|
|
||||||
'<li id="' + option.dom_id + '" class="' + classes.join(' ') + '">' + option.html + '</li>'
|
'<li id="' + option.dom_id + '" class="' + classes.join(' ') + '">' + option.html + '</li>'
|
||||||
else
|
else
|
||||||
|
|
|
@ -230,6 +230,7 @@ class Chosen
|
||||||
classes = if option.selected and @is_multiple then [] else ["active-result"]
|
classes = if option.selected and @is_multiple then [] else ["active-result"]
|
||||||
classes.push "result-selected" if option.selected
|
classes.push "result-selected" if option.selected
|
||||||
classes.push "group-option" if option.group_array_index?
|
classes.push "group-option" if option.group_array_index?
|
||||||
|
classes.push option.classes if option.classes != ""
|
||||||
|
|
||||||
'<li id="' + option.dom_id + '" class="' + classes.join(' ') + '">' + option.html + '</li>'
|
'<li id="' + option.dom_id + '" class="' + classes.join(' ') + '">' + option.html + '</li>'
|
||||||
else
|
else
|
||||||
|
|
|
@ -34,6 +34,7 @@ class SelectParser
|
||||||
selected: option.selected
|
selected: option.selected
|
||||||
disabled: if group_disabled is true then group_disabled else option.disabled
|
disabled: if group_disabled is true then group_disabled else option.disabled
|
||||||
group_array_index: group_position
|
group_array_index: group_position
|
||||||
|
classes: option.className
|
||||||
else
|
else
|
||||||
@parsed.push
|
@parsed.push
|
||||||
array_index: @parsed.length
|
array_index: @parsed.length
|
||||||
|
|
Loading…
Reference in a new issue