summaryrefslogtreecommitdiffstats
path: root/public/javascripts
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-11-26 08:16:15 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-11-26 08:16:15 +0000
commit62823442d369705290807fa2a5191a1a67d6ee09 (patch)
treef50e09ed18bbb7fdef85f0fe21d8d18d0a8202b9 /public/javascripts
parentbac3ac738a5cad495eb5862bad4e58cca02c8c6d (diff)
downloadredmine-62823442d369705290807fa2a5191a1a67d6ee09.tar.gz
redmine-62823442d369705290807fa2a5191a1a67d6ee09.zip
Replaces project jump select with custom dropdown (#23310).
git-svn-id: http://svn.redmine.org/redmine/trunk@15994 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'public/javascripts')
-rw-r--r--public/javascripts/application.js63
1 files changed, 63 insertions, 0 deletions
diff --git a/public/javascripts/application.js b/public/javascripts/application.js
index 3d1ad43cd..ad7109e2b 100644
--- a/public/javascripts/application.js
+++ b/public/javascripts/application.js
@@ -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")) {