[FIX] base: settings view match on label.text

Before this commit, search was broken because containsLike was searching on
the innerHtml. (3dd93ed129)

Settings use _wordHighlighter to change the background of the matching text
into the label, so the label was not only text, but html.

<label><span class="highlighter">Mul</span>ti-company</label>
    : looking for (mul)

After this commit, the match is based on the text content and not on the html.
This commit is contained in:
Jeremy Kersten
2018-03-22 11:22:33 +01:00
parent a8230853e8
commit 38e339258c
2 changed files with 4 additions and 1 deletions
+3
View File
@@ -11,6 +11,9 @@ $.extend($.expr[':'], {
containsLike: function (element, index, matches){
return element.innerHTML.toUpperCase().indexOf(matches[3].toUpperCase()) >= 0;
},
containsTextLike: function (element, index, matches){
return element.innerText.toUpperCase().indexOf(matches[3].toUpperCase()) >= 0;
},
containsExact: function (element, index, matches){
return $.trim(element.innerHTML) === matches[3];
},
@@ -277,7 +277,7 @@ var BaseSettingRenderer = FormRenderer.extend({
module.settingView.find('h2').addClass('o_hidden');
module.settingView.find('.settingSearchHeader').addClass('o_hidden');
module.settingView.find('.o_settings_container').removeClass('mt16');
var resultSetting = module.settingView.find("label:containsLike('" + self.searchText + "')");
var resultSetting = module.settingView.find("label:containsTextLike('" + self.searchText + "')");
if (resultSetting.length > 0) {
resultSetting.each(function () {
var settingBox = $(this).closest('.o_setting_box');