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.
95 lines
3.2 KiB
95 lines
3.2 KiB
function setExpandStatus(expanderObject) {
|
|
var expander = jQuery(expanderObject);
|
|
var menuItemWrapper = jQuery(expander).parent();
|
|
var expanded = jQuery(menuItemWrapper).hasClass('open');
|
|
var span = expander.find('span.hidden-for-sighted');
|
|
var title = expanded ? I18n.t('js.label_menu_collapse') : I18n.t('js.label_menu_expand');
|
|
|
|
expander.attr('title', title);
|
|
span.text(title);
|
|
}
|
|
|
|
function initMainMenuExpandStatus() {
|
|
jQuery('#main-menu .toggler').each(function(index) {
|
|
var menu_expander = jQuery(this);
|
|
var menu_item = menu_expander.closest('li').find('a.selected');
|
|
|
|
if (menu_item.length == 1) {
|
|
menu_expander.trigger('click');
|
|
} else {
|
|
setExpandStatus(menu_expander);
|
|
}
|
|
});
|
|
}
|
|
|
|
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"></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.show();
|
|
menuParent.find('li > a:first').focus();
|
|
} else {
|
|
menuParent.hide();
|
|
}
|
|
|
|
setExpandStatus(target);
|
|
}
|
|
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();
|
|
}
|
|
|
|
});
|
|
|