kanbanworkflowstimelinescrumrubyroadmapproject-planningproject-managementopenprojectangularissue-trackerifcgantt-chartganttbug-trackerboardsbcf
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
2.5 KiB
69 lines
2.5 KiB
<% environment.context_class.instance_eval { include ApplicationHelper } %>
|
|
|
|
jQuery(document).ready(function($) {
|
|
// rejigger the main-menu sub-menu functionality.
|
|
$("#main-menu .toggler").remove(); // remove the togglers so they're inserted properly later.
|
|
|
|
var toggler = $('<a class="toggler"><span class="icon6 icon-toggler icon-arrow-right5-2"/><span class="hidden-for-sighted">' + I18n.t("label_menu_item_toggle") + '</span></a>')
|
|
.click(function(event) {
|
|
var target = $(this);
|
|
|
|
if (target.hasClass('toggler')) {
|
|
var menuItemWrapper = target.parent();
|
|
var menuParent = menuItemWrapper.toggleClass('open').parent().find('ul').not('ul ul ul');
|
|
|
|
menuParent.mySlide();
|
|
if (menuItemWrapper.hasClass('open')) {
|
|
menuParent.find('li > a:first').focus();
|
|
}
|
|
}
|
|
return false;
|
|
});
|
|
|
|
$('#main-menu li > a').not('ul ul a').wrap('<div class="main-item-wrapper"/>');
|
|
|
|
$('#main-menu li:has(ul) .main-item-wrapper > a').not('ul ul a')
|
|
// 1. unbind the current click functions
|
|
.unbind('click')
|
|
// 2. wrap each in a span that we'll use for the new click element
|
|
.wrapInner('<span class="ellipsis"/>')
|
|
// 3. reinsert the <span class="toggler"> so that it sits outside of the above
|
|
.after(toggler);
|
|
|
|
|
|
// project menu
|
|
|
|
// Users of some old IEs are out of luck ATM. A userData implementation
|
|
// could be provided though, that would be great!
|
|
var remember_menu_state;
|
|
|
|
if (typeof window.sessionStorage !== 'undefined') {
|
|
remember_menu_state = function (match) {
|
|
if (typeof match === 'undefined') {
|
|
return sessionStorage.getItem('openproject:navigation-toggle');
|
|
} else {
|
|
return sessionStorage.setItem('openproject:navigation-toggle',
|
|
match.length > 0 ? 'collapsed' : 'expanded');
|
|
}
|
|
};
|
|
}
|
|
else {
|
|
remember_menu_state = function (match) {
|
|
return false;
|
|
};
|
|
}
|
|
|
|
var toggle_navigation = function() {
|
|
$('#wrapper').toggleClass('hidden-navigation');
|
|
$('#content, #breadcrumb').toggleClass('hidden-navigation');
|
|
$('#toggle-project-menu').removeAttr("style").toggleClass('show');
|
|
remember_menu_state($('#toggle-project-menu.show'));
|
|
};
|
|
|
|
// register toggler, and toggle for the first time if remembered to be closed.
|
|
jQuery('#toggle-project-menu .navigation-toggler').click(toggle_navigation);
|
|
if ($('#main-menu').length > 0 && remember_menu_state() === "collapsed") {
|
|
toggle_navigation();
|
|
}
|
|
|
|
});
|
|
|