mirror of
https://github.com/redmine/redmine.git
synced 2026-07-06 23:58:39 +02:00
Replaces project jump select with custom dropdown (#23310).
git-svn-id: http://svn.redmine.org/redmine/trunk@15994 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -572,6 +572,69 @@ function observeSearchfield(fieldId, targetId, url) {
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
$(".drdn .autocomplete").val('');
|
||||
|
||||
$(".drdn-trigger").click(function(e){
|
||||
var drdn = $(this).closest(".drdn");
|
||||
if (drdn.hasClass("expanded")) {
|
||||
drdn.removeClass("expanded");
|
||||
} else {
|
||||
$(".drdn").removeClass("expanded");
|
||||
drdn.addClass("expanded");
|
||||
if (!isMobile()) {
|
||||
drdn.find(".autocomplete").focus();
|
||||
}
|
||||
e.stopPropagation();
|
||||
}
|
||||
});
|
||||
$(document).click(function(e){
|
||||
if ($(e.target).closest(".drdn").length < 1) {
|
||||
$(".drdn.expanded").removeClass("expanded");
|
||||
}
|
||||
});
|
||||
|
||||
observeSearchfield('projects-quick-search', null, $('#projects-quick-search').data('automcomplete-url'));
|
||||
|
||||
$(".drdn-content").keydown(function(event){
|
||||
var items = $(this).find(".drdn-items");
|
||||
var focused = items.find("a:focus");
|
||||
switch (event.which) {
|
||||
case 40: //down
|
||||
if (focused.length > 0) {
|
||||
focused.nextAll("a").first().focus();;
|
||||
} else {
|
||||
items.find("a").first().focus();;
|
||||
}
|
||||
event.preventDefault();
|
||||
break;
|
||||
case 38: //up
|
||||
if (focused.length > 0) {
|
||||
var prev = focused.prevAll("a");
|
||||
if (prev.length > 0) {
|
||||
prev.first().focus();
|
||||
} else {
|
||||
$(this).find(".autocomplete").focus();
|
||||
}
|
||||
event.preventDefault();
|
||||
}
|
||||
break;
|
||||
case 35: //end
|
||||
if (focused.length > 0) {
|
||||
focused.nextAll("a").last().focus();
|
||||
event.preventDefault();
|
||||
}
|
||||
break;
|
||||
case 36: //home
|
||||
if (focused.length > 0) {
|
||||
focused.prevAll("a").last().focus();
|
||||
event.preventDefault();
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function beforeShowDatePicker(input, inst) {
|
||||
var default_date = null;
|
||||
switch ($(input).attr("id")) {
|
||||
|
||||
Reference in New Issue
Block a user