applies changes from PR #61

bugfix to re-enable clicking "view all projects":

* adds missing open/close events to top menu
* removes select2's click filter as it masks our menu
pull/56/merge
Nils Kenneweg 12 years ago committed by Christian Ratz
parent 7ae570eb49
commit 686f21b5c9
  1. 50
      app/assets/javascripts/application.js
  2. 4
      app/assets/stylesheets/default/application.css.erb

@ -534,6 +534,14 @@ jQuery.viewportHeight = function() {
/* TODO: integrate with existing code and/or refactor */
jQuery(document).ready(function($) {
var propagateOpenClose = function () {
if ($(this).is(":visible")) {
$(this).parents('li.drop-down').trigger("opened");
} else {
$(this).parents('li.drop-down').trigger("closed");
}
};
$.extend($.fn.select2.defaults, {
formatNoMatches: function () {
return I18n.t("js.select2.no_matches");
@ -555,10 +563,10 @@ jQuery(document).ready(function($) {
$('#project-search-container .select2-select').each(function (ix, select) {
var PROJECT_JUMP_BOX_PAGE_SIZE = 50;
var select2, menu;
select = $(select);
menu = select.parents('li.drop-down');
var select2,
menu = select.parents('li.drop-down'),
that = this;
select.select2({
formatResult : OpenProject.Helpers.Search.formatter,
@ -576,7 +584,7 @@ jQuery(document).ready(function($) {
}).
on('close', function () {
if (menu.is('.open')) {
menu.slideAndFocus();
menu.slideAndFocus(that.propagateOpenClose);
}
});
@ -614,6 +622,10 @@ jQuery(document).ready(function($) {
// Open select2 element, when menu is opened
select2.open();
setTimeout(function () {
$("#select2-drop-mask").hide();
}, 50);
// Include input in tab cycle by attaching keydown handlers to previous
// and next interactive DOM element.
select2.container.previousElementInDom(":input:visible, a:visible").keydown(function (e) {
@ -696,7 +708,7 @@ jQuery(document).ready(function($) {
$.fn.onClickDropDown = function(){
var that = this;
$('html').click(function() {
that.find(" > li.drop-down.open").removeClass("open").find("> ul").mySlide();
that.find(" > li.drop-down.open").removeClass("open").find("> ul").mySlide(propagateOpenClose);
that.removeClass("hover");
});
@ -730,22 +742,10 @@ jQuery(document).ready(function($) {
$.fn.toggleSubmenu = function(menu){
if (menu.find(" > li.drop-down.open").get(0) !== $(this).get(0)){
menu.find(" > li.drop-down.open").removeClass("open").find("> ul").mySlide(function () {
if ($(this).is(":visible")) {
$(this).parents('li.drop-down').trigger("opened");
} else {
$(this).parents('li.drop-down').trigger("closed");
}
});
menu.find(" > li.drop-down.open").removeClass("open").find("> ul").mySlide(propagateOpenClose);
}
$(this).slideAndFocus(function () {
if ($(this).is(":visible")) {
$(this).parents('li.drop-down').trigger("opened");
} else {
$(this).parents('li.drop-down').trigger("closed");
}
});
$(this).slideAndFocus(propagateOpenClose);
menu.toggleClass("hover");
};
@ -756,7 +756,7 @@ jQuery(document).ready(function($) {
.append("<span class='toggler'></span>")
.click(function() {
$(this).toggleClass("open").parent().find("ul").not("ul ul ul").mySlide();
$(this).toggleClass("open").parent().find("ul").not("ul ul ul").mySlide(propagateOpenClose);
return false;
});
@ -778,13 +778,7 @@ jQuery(document).ready(function($) {
$(".title-bar-extras:hidden").slideDown(animationRate);
}
$(this).parent().find("ul").slideToggle(animationRate, function () {
if ($(this).is(":visible")) {
$(this).parents("li.drop-down").trigger("opened");
} else {
$(this).parents("li.drop-down").trigger("closed");
}
});
$(this).parent().find("ul").slideToggle(animationRate, propagateOpenClose);
return false;
});
@ -841,7 +835,7 @@ $(window).bind('resizeEnd', function() {
if ($(event.target).hasClass("toggler") ) {
var menuParent = $(this).toggleClass("open").parent().find("ul").not("ul ul ul");
menuParent.mySlide();
menuParent.mySlide(propagateOpenClose);
if ($(this).hasClass("open")) {
menuParent.find("li > a:first").focus();
}

@ -392,6 +392,10 @@ dt.time-entry { background-image: url(<%= asset_path 'time.png' %>); }
.search-pagination { text-align: center; }
.search-pagination a {padding: 0 5px; }
#project-search-container .select2-container {
display: block;
}
div#roadmap .related-issues {
border: 0;
margin-bottom: 1em;

Loading…
Cancel
Save