120 |
120 |
function addFilter(field, operator, values) {
|
121 |
121 |
var fieldId = field.replace('.', '_');
|
122 |
122 |
var tr = $('#tr_'+fieldId);
|
123 |
|
|
|
123 |
|
124 |
124 |
var filterOptions = availableFilters[field];
|
125 |
125 |
if (!filterOptions) return;
|
126 |
126 |
|
... | ... | |
587 |
587 |
$(document).ready(function(){
|
588 |
588 |
$(".drdn .autocomplete").val('');
|
589 |
589 |
|
|
590 |
// This variable is used to focus selected project
|
|
591 |
var selected;
|
590 |
592 |
$(".drdn-trigger").click(function(e){
|
591 |
593 |
var drdn = $(this).closest(".drdn");
|
592 |
594 |
if (drdn.hasClass("expanded")) {
|
... | ... | |
594 |
596 |
} else {
|
595 |
597 |
$(".drdn").removeClass("expanded");
|
596 |
598 |
drdn.addClass("expanded");
|
|
599 |
selected = $('.drdn-items a.selected'); // Store selected project
|
|
600 |
selected.focus(); // Calling focus to scroll to selected project
|
597 |
601 |
if (!isMobile()) {
|
598 |
602 |
drdn.find(".autocomplete").focus();
|
599 |
603 |
}
|
... | ... | |
603 |
607 |
$(document).click(function(e){
|
604 |
608 |
if ($(e.target).closest(".drdn").length < 1) {
|
605 |
609 |
$(".drdn.expanded").removeClass("expanded");
|
606 |
|
}
|
|
610 |
}
|
607 |
611 |
});
|
608 |
612 |
|
609 |
613 |
observeSearchfield('projects-quick-search', null, $('#projects-quick-search').data('automcomplete-url'));
|
610 |
614 |
|
611 |
615 |
$(".drdn-content").keydown(function(event){
|
612 |
616 |
var items = $(this).find(".drdn-items");
|
613 |
|
var focused = items.find("a:focus");
|
|
617 |
|
|
618 |
// If a project is selected set focused to selected only once
|
|
619 |
if (selected && selected.length > 0) {
|
|
620 |
var focused = selected;
|
|
621 |
selected = undefined;
|
|
622 |
}
|
|
623 |
else {
|
|
624 |
var focused = items.find("a:focus");
|
|
625 |
}
|
614 |
626 |
switch (event.which) {
|
615 |
627 |
case 40: //down
|
616 |
628 |
if (focused.length > 0) {
|