Skip to content

Commit

Permalink
Fix module search under add deadline deviations to be case insensitive
Browse files Browse the repository at this point in the history
Fixes #1280
  • Loading branch information
ashi006 authored and ihalaij1 committed Nov 20, 2023
1 parent 798d358 commit 115687c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion assets/js/ajax_search_select.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ $(function() {

$('.search-select').aplusSearchSelect();
$('.search-select-ajax').aplusSearchSelectAjax();

jQuery.expr[':'].icontains = function(element, index, match) {
/**
* - 'element' represents the current DOM element that the filter is applied to.
* - 'index' represents the index of the current element in the set of matched elements.
* - 'match' is an array containing information about the filter, where match[3] is the search
* string provided in the filter.
*/
return jQuery(element).text().toUpperCase().indexOf(match[3].toUpperCase()) >= 0;
};
});

(function($) {
Expand Down Expand Up @@ -284,6 +294,7 @@ $(function() {
* building selectors that return <option> elements matching the user's
* queries.
*/

function AplusSearchSelect(element, options) {
AplusSearchSelectBase.call(this, element, options);
}
Expand All @@ -301,7 +312,7 @@ $(function() {
getSearchResults: function(query, callback) {
let selector = "option";
if (query.length > 0) {
selector += ":contains(" + this.field.val() + ")";
selector += ":icontains(" + this.field.val() + ")";
}
const options = this.inner_element.find(selector);
callback(options);
Expand Down

0 comments on commit 115687c

Please sign in to comment.