* finish task #2889.
This commit is contained in:
@@ -260,4 +260,4 @@ $lang->project->treeLevel = array();
|
||||
$lang->project->treeLevel['root'] = '全部折叠';
|
||||
$lang->project->treeLevel['story'] = '显示需求';
|
||||
$lang->project->treeLevel['task'] = '显示任务';
|
||||
|
||||
$lang->project->treeLevel['all'] = '全部展开';
|
||||
|
||||
@@ -2277,7 +2277,7 @@ class projectModel extends model
|
||||
elseif($node->type == 'product')
|
||||
{
|
||||
$node->title = $node->name;
|
||||
if(empty($node->children[0]->children)) array_shift($node->children);
|
||||
if(isset($node->children[0]) and empty($node->children[0]->children)) array_shift($node->children);
|
||||
}
|
||||
|
||||
$node->actions = false;
|
||||
@@ -2361,7 +2361,7 @@ class projectModel extends model
|
||||
$fullTrees[$i] = $fullTree;
|
||||
}
|
||||
}
|
||||
if(empty($fullTrees[0]->children)) array_shift($fullTrees);
|
||||
if(isset($fullTrees[0]) and empty($fullTrees[0]->children)) array_shift($fullTrees);
|
||||
return array_values($fullTrees);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ include './taskheader.html.php';
|
||||
<div class='panel-actions pull-right'>
|
||||
<div class='btn-group'>
|
||||
<?php foreach ($lang->project->treeLevel as $name => $btnLevel):?>
|
||||
<?php if($name == 'all') continue;?>
|
||||
<button type='button' class='btn btn-sm tree-view-btn' data-type='<?php echo $name ?>'><?php echo $btnLevel ?></button>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
@@ -163,6 +164,7 @@ $(function()
|
||||
|
||||
$(document).on('click', '.tree-view-btn', function()
|
||||
{
|
||||
var hasActive = $(this).hasClass('active');
|
||||
$('.tree-view-btn.active').removeClass('active');
|
||||
var level = $(this).addClass('active').data('type');
|
||||
if(level === 'task')
|
||||
@@ -170,7 +172,19 @@ $(function()
|
||||
tree.collapse();
|
||||
tree.show($('.item-type-tasks, .item-type-task').parent().parent());
|
||||
}
|
||||
if(level === 'root') tree.collapse();
|
||||
if(level === 'root')
|
||||
{
|
||||
tree.collapse();
|
||||
$(this).html(treeLevel.all);
|
||||
if(hasActive)
|
||||
{
|
||||
$(this).removeClass('active');
|
||||
$(this).html(treeLevel.root);
|
||||
tree.show($('.item-type-tasks, .item-type-task').parent().parent());
|
||||
tree.show($('.item-type-module').parent().parent());
|
||||
tree.show($('.item-type-story').parent().parent());
|
||||
}
|
||||
}
|
||||
else if(level === 'module')
|
||||
{
|
||||
tree.collapse();
|
||||
@@ -186,4 +200,5 @@ $(function()
|
||||
setModalInTree(tree);
|
||||
});
|
||||
</script>
|
||||
<?php js::set('treeLevel', $lang->project->treeLevel);?>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
Reference in New Issue
Block a user