Changed used tags in autocomplete to be grayed-out

This commit is contained in:
Marcin Kurczewski 2014-11-30 12:45:44 +01:00
parent bc757dd883
commit b70231bd7e
2 changed files with 12 additions and 0 deletions

View file

@ -17,6 +17,7 @@ App.Controls.AutoCompleteInput = function($input) {
maxResults: 15, maxResults: 15,
minLengthToArbitrarySearch: 3, minLengthToArbitrarySearch: 3,
onApply: null, onApply: null,
onRender: null,
additionalFilter: null, additionalFilter: null,
}; };
var showTimeout = null; var showTimeout = null;
@ -222,6 +223,9 @@ App.Controls.AutoCompleteInput = function($input) {
}); });
$list.append($listItem); $list.append($listItem);
}); });
if (options.onRender) {
options.onRender($list);
}
refreshActiveResult(); refreshActiveResult();
$div.css({ $div.css({
left: ($input.offset().left) + 'px', left: ($input.offset().left) + 'px',

View file

@ -83,6 +83,14 @@ App.Controls.TagInput = function($underlyingInput) {
return !_.contains(getTags(), resultItem[0]); return !_.contains(getTags(), resultItem[0]);
}); });
}; };
autoComplete.onRender = function($list) {
$list.find('li').each(function() {
var $li = jQuery(this);
if (isTaggedWith($li.attr('data-key'))) {
$li.css('opacity', '0.5');
}
});
};
} }
$input.bind('focus', function(e) { $input.bind('focus', function(e) {