Remove highlight clicked favorite, it was conflicting with highlighting matching favorite if the clicked favorite was not valid for the results.

This commit is contained in:
nathangray 2016-05-24 16:27:27 -06:00
parent 0357d2bf84
commit 8dec95e4fc

View File

@ -515,15 +515,6 @@ var AppJS = (function(){ "use strict"; return Class.extend(
var li = $j(this); var li = $j(this);
li.siblings().removeClass('ui-state-highlight'); li.siblings().removeClass('ui-state-highlight');
// Wait an arbitrary 50ms to avoid having the class removed again
// by the change handler.
if(li.attr('data-id') !== 'blank')
{
window.setTimeout(function() {
li.addClass('ui-state-highlight');
},50);
}
var state = {}; var state = {};
var pref = egw.preference('favorite_' + this.dataset.id, self.appname); var pref = egw.preference('favorite_' + this.dataset.id, self.appname);
if(pref) if(pref)
@ -935,6 +926,10 @@ var AppJS = (function(){ "use strict"; return Class.extend(
{ {
match_count++; match_count++;
} }
else if (state_key == 'selectcols')
{
// Skip, might be set, might not
}
else if (typeof state[state_key] != 'undefined' && state[state_key] && typeof state[state_key] === 'object' else if (typeof state[state_key] != 'undefined' && state[state_key] && typeof state[state_key] === 'object'
&& typeof favorite.state != 'undefined' && typeof favorite.state[state_key] != 'undefined' && favorite.state[state_key] && typeof favorite.state[state_key] === 'object') && typeof favorite.state != 'undefined' && typeof favorite.state[state_key] != 'undefined' && favorite.state[state_key] && typeof favorite.state[state_key] === 'object')
{ {
@ -951,6 +946,13 @@ var AppJS = (function(){ "use strict"; return Class.extend(
// One has a value and the other doesn't, no match // One has a value and the other doesn't, no match
return; return;
} }
else if (state[state_key].length !== 'undefined' && typeof favorite.state[state_key].length !== 'undefined' &&
state[state_key].length === 0 && favorite.state[state_key].length === 0)
{
// Both set, but both empty
match_count++;
continue;
}
// Consider sub-objects (column filters) individually // Consider sub-objects (column filters) individually
for(var sub_key in state[state_key]) for(var sub_key in state[state_key])
{ {
@ -967,18 +969,13 @@ var AppJS = (function(){ "use strict"; return Class.extend(
match_count++; match_count++;
} }
} }
else if(state[state_key][sub_key] && state[state_key][sub_key] != favorite.state[state_key][sub_key]) else if(typeof state[state_key][sub_key] !== 'undefined' && state[state_key][sub_key] != favorite.state[state_key][sub_key])
{ {
// Different values, do not match // Different values, do not match
return; return;
} }
} }
} }
else if (state_key == 'selectcols')
{
// Skip, might be set, might not
}
else if (typeof state[state_key] !== 'undefined' else if (typeof state[state_key] !== 'undefined'
&& typeof favorite.state != 'undefined'&&typeof favorite.state[state_key] !== 'undefined' && typeof favorite.state != 'undefined'&&typeof favorite.state[state_key] !== 'undefined'
&& state[state_key] != favorite.state[state_key]) && state[state_key] != favorite.state[state_key])