View Issue Details

IDProjectCategoryView StatusLast Update
0024402mantisbtuipublic2019-09-19 04:52
Reporterkae_verens Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
Status newResolutionopen 
Summary0024402: tree-based project navigation
Description

instead of having to read through or search through a long list of projects, why not have them automatically hidden/shown by hierarchy?

I wrote a small script which, when attached to the layout, will transform the HTML of the projects menu and add some jQuery toggle events.

screenshots show before, after (with sub-menus collapsed), and after (with a sub-menu expanded)

The code is in the Additional Information section below.

I put that in a file (/js/project-navigation.js), and then in core/layout_api.js, I put the following line after line 632 (where the "projects-list" div is echoed)
<pre> echo '<script src="/js/project-navigation.js"></script>';</pre>

Additional Information

my code:
<pre>
$(function() {
var $menu=$('#projects-list>ul');
$menu.find('>li').each(function() { // transform the menu into something that can be opened/closed
var $this=$(this), id_postfix=$this.find('a').attr('href').replace(/.=/, '').replace(/;/g, '-');
$this.attr('id', 'projects-list-'+id_postfix);
if (/-/.test(id_postfix)) {
var id_parent=id_postfix.replace(/-[0-9]
$/, '');
var $item_wrapper=$('#projects-list-wrapper-'+id_parent);
if (!$item_wrapper.length) {
var $parent_item=$('#projects-list-'+id_parent);
var $item_wrapper=$('<ul class="list dropdown-yellow no-margin" id="projects-list-wrapper-'+id_parent+'" style="display:none"/>').insertAfter($parent_item);
$('<button style="float:right;padding:0 5px;margin:0;">☰</button>').prependTo($parent_item).click(function() {
$(this).closest('li').next().toggle();
return false;
});
}
$this.appendTo($item_wrapper);
}
});
$menu.find('.active').parents('.list').each(function() { // expand the parents of the active item
$(this).css('display', 'block');
});
});
</pre>

TagsNo tags attached.

Activities

kae_verens

kae_verens

2018-05-07 16:25

reporter  

screen1.png (24,179 bytes)   
screen1.png (24,179 bytes)   
screen2.png (20,947 bytes)   
screen2.png (20,947 bytes)   
screen3.png (23,384 bytes)   
screen3.png (23,384 bytes)   
tedritheni

tedritheni

2019-07-22 19:31

reporter   ~0062415

Nice - is this likely to make it to the core product?

Issue History

Date Modified Username Field Change
2018-05-07 16:25 kae_verens New Issue
2018-05-07 16:25 kae_verens File Added: screen1.png
2018-05-07 16:25 kae_verens File Added: screen2.png
2018-05-07 16:25 kae_verens File Added: screen3.png
2019-07-22 19:31 tedritheni Note Added: 0062415