* adjust for scroll to selected.

This commit is contained in:
wangyidong
2022-10-26 09:39:05 +08:00
parent 585b12838e
commit d6dc22d7e0
8 changed files with 80 additions and 33 deletions
+17 -6
View File
@@ -1,10 +1,11 @@
<?php js::set('productID', $productID);?>
<?php
$iCharges = 0;
$others = 0;
$closeds = 0;
$tab = 'project';
$productNames = array();
$iCharges = 0;
$others = 0;
$closeds = 0;
$tab = 'project';
$productNames = array();
$currentProduct = '';
foreach($products as $product)
{
@@ -20,6 +21,7 @@ $closedProductsHtml = '';
foreach($products as $product)
{
if($product->id == $productID) $currentProduct = $product;
$selected = $product->id == $productID ? 'selected' : '';
$productName = $product->name;
$linkHtml = sprintf($link, $product->id);
@@ -61,4 +63,13 @@ foreach($products as $product)
<div class='list-group'><?php echo $closedProductsHtml;?></div>
</div>
</div>
<script>scrollToSelected();</script>
<script>
$(function()
{
<?php if($currentProduct->status == 'closed'):?>
$('.col-footer .toggle-right-col').click(function(){ scrollToSelected(); })
<?php else:?>
scrollToSelected();
<?php endif;?>
});
</script>
+1 -4
View File
@@ -46,10 +46,7 @@ $('#pageNav .btn-group.angle-btn').click(function()
if($(this).hasClass('opened')) return;
$(this).addClass('opened');
setTimeout(function()
{
scrollToSelected();
}, 100);
scrollToSelected();
})
</script>
<?php include '../../common/view/footer.html.php';?>
+9
View File
@@ -124,4 +124,13 @@ if(empty($type)) $type = 'product';
</div>
</div>
</div>
<script>
$('#pageNav .btn-group.angle-btn').click(function()
{
if($(this).hasClass('opened')) return;
$(this).addClass('opened');
scrollToSelected();
})
</script>
<?php include '../../common/view/footer.html.php';?>
@@ -31,6 +31,7 @@
<?php
$executionCounts = array();
$executionNames = array();
$currentExecution = '';
$tabActive = '';
$myExecutions = 0;
$others = 0;
@@ -82,11 +83,13 @@ foreach($executions as $projectID => $projectExecutions)
if(isset($execution->type) and $execution->type == 'kanban' and !$isKanbanMethod) $executionLink = $kanbanLink;
if(isset($execution->type) and $execution->type != 'kanban' and strpos(',kanban,cfd,', ",$method,") !== false) $executionLink = $taskLink;
if($execution->id == $executionID) $currentExecution = $execution;
$selected = $execution->id == $executionID ? 'selected' : '';
if(!empty($execution->children))
{
foreach($execution->children as $id)
{
if($execution->id == $executionID) $currentExecution = $execution;
$selected = $id == $executionID ? 'selected' : '';
if($execution->status != 'done' and $execution->status != 'closed' and ($execution->PM == $this->app->user->account or isset($execution->teams[$this->app->user->account])))
{
@@ -180,10 +183,14 @@ $closedExecutionsHtml .= '</ul>';
<div class='list-group executions'><?php echo $closedExecutionsHtml;?></div>
</div>
</div>
<script>scrollToSelected();</script>
<script>
$(function()
{
<?php if($currentExecution->status == 'done' or $currentExecution->status == 'closed'):?>
$('.col-footer .toggle-right-col').click(function(){ scrollToSelected(); })
<?php else:?>
scrollToSelected();
<?php endif;?>
$('.nav-tabs li span').hide();
$('.nav-tabs li.active').find('span').show();
+14 -7
View File
@@ -23,12 +23,13 @@
#swapper .tree li>.list-toggle {top: -1px;}
</style>
<?php
$kanbanCounts = array();
$kanbanNames = array();
$tabActive = '';
$myKanbans = 0;
$others = 0;
$dones = 0;
$kanbanCounts = array();
$kanbanNames = array();
$tabActive = '';
$myKanbans = 0;
$others = 0;
$dones = 0;
$currentKanban = '';
foreach($kanbanList as $spaceID => $spaceKanbans)
{
@@ -64,6 +65,7 @@ foreach($kanbanList as $spaceID => $spaceKanbans)
foreach($spaceKanbans as $index => $kanban)
{
if($kanban->id == $kanbanID) $currentKanban = $kanban;
$selected = $kanban->id == $kanbanID ? 'selected' : '';
$link = helper::createLink('kanban', 'view', "kanbanID=%s", '', '', $kanban->id);
$kanbanName = '<i class="icon icon-kanban"></i> ' . $kanban->name;
@@ -132,10 +134,15 @@ $closedKanbansHtml .= '</ul>';
<div class='list-group kanbans'><?php echo $closedKanbansHtml;?></div>
</div>
</div>
<script>scrollToSelected();</script>
<script>
$(function()
{
<?php if($currentKanban->status == 'closed'):?>
$('.col-footer .toggle-right-col').click(function(){ scrollToSelected(); })
<?php else:?>
scrollToSelected();
<?php endif;?>
$('#dropMenu .nav-tabs li span').hide();
$('#dropMenu .nav-tabs li.active').find('span').show();
+8 -1
View File
@@ -37,6 +37,7 @@ $tabActive = '';
$myProducts = 0;
$others = 0;
$closeds = 0;
$currentProduct = '';
foreach($products as $programID => $programProducts)
{
@@ -72,6 +73,7 @@ foreach($products as $programID => $programProducts)
foreach($programProducts as $index => $product)
{
if($product->id == $productID) $currentProduct = $product;
$selected = $product->id == $productID ? 'selected' : '';
$productName = ($config->systemMode == 'new' and $product->line) ? zget($lines, $product->line, '') . ' / ' . $product->name : $product->name;
$linkHtml = $this->product->setParamsForLink($module, $link, $projectID, $product->id);
@@ -144,10 +146,15 @@ $closedProductsHtml .= '</ul>';
<div class='list-group products'><?php echo $closedProductsHtml;?></div>
</div>
</div>
<script>scrollToSelected();</script>
<script>
$(function()
{
<?php if($currentProduct->status == 'closed'):?>
$('.col-footer .toggle-right-col').click(function(){ scrollToSelected(); })
<?php else:?>
scrollToSelected();
<?php endif;?>
$('.nav-tabs li span').hide();
$('.nav-tabs li.active').find('span').show();
+10 -3
View File
@@ -35,6 +35,7 @@ $tabActive = '';
$myProjects = 0;
$others = 0;
$dones = 0;
$currentProject = '';
foreach($projects as $programID => $programProjects)
{
@@ -70,8 +71,9 @@ foreach($projects as $programID => $programProjects)
foreach($programProjects as $index => $project)
{
$selected = $project->id == $projectID ? 'selected' : '';
$icon = '<i class="icon icon-sprint"></i> ';
if($project->id == $projectID) $currentProject = $project;
$selected = $project->id == $projectID ? 'selected' : '';
$icon = '<i class="icon icon-sprint"></i> ';
if($project->model != 'waterfall' and (in_array($module, $config->waterfallModules) or $method == 'track'))
{
@@ -163,10 +165,15 @@ $closedProjectsHtml .= '</ul>';
<div class='list-group projects'><?php echo $closedProjectsHtml;?></div>
</div>
</div>
<script>scrollToSelected();</script>
<script>
$(function()
{
<?php if($currentProject->status == 'done' or $currentProject->status == 'closed'):?>
$('.col-footer .toggle-right-col').click(function(){ scrollToSelected(); })
<?php else:?>
scrollToSelected();
<?php endif;?>
$('.nav-tabs li span').hide();
$('.nav-tabs li.active').find('span').show();
+13 -11
View File
@@ -930,19 +930,21 @@ function adjustMenuWidth()
* @access public
* @return void
*/
function scrollToSelected(id)
function scrollToSelected()
{
if(typeof(id) == 'undefined') id = '#dropMenu .table-col .list-group'
$id = $(id);
$selected = $id.find('.selected');
$id.mouseout(function(){$(this).find('a.active:not(.not-list-item)').removeClass('active')});
if($selected.length > 0)
setTimeout(function()
{
var offsetHeight = 75;
$id.scrollTop($selected.position().top - offsetHeight);
}
$selected = $('#dropMenu .selected');
if($selected.length == 0) return;
$id = $selected.closest('.list-group');
$id.mouseout(function(){$(this).find('a.active:not(.not-list-item)').removeClass('active')});
var fixOffset = 160;
offsetTop = $selected.offset().top;
if(offsetTop < fixOffset) return;
$id.scrollTop(offsetTop - fixOffset);
}, 100);
}
/**