* Adjust code.

This commit is contained in:
leiyong
2021-01-04 14:22:54 +08:00
parent 0d65efe2d5
commit d83350c5e7
2 changed files with 75 additions and 6 deletions
+1 -2
View File
@@ -23,7 +23,7 @@
#userNav>li .lang .dropdown-menu, #userNav>li .theme .dropdown-menu{top: -60px}
#userNav .dropdown-menu>li>a>.icon { position: initial; display: inline;}
#userNav li.open>a{background:#0c64eb}
#userNav li.divider{opacity: .24;}
#userNav li.divider{opacity: .24; border-top: 1px solid; height: 0px;}
#poweredBy{width: 55%; position: absolute; top: 4px; right: 0; padding: 0;}
#globalSearchDiv{width:50%; float: right;}
@@ -38,4 +38,3 @@
#menuToggle .is-unfold, .menu-hide #menuToggle .is-collapse {display: none}
.menu-hide #menuToggle .is-unfold {display: inline}
#menuNav>.nav>li.divider {margin: 2px 8px;}
+74 -4
View File
@@ -34,10 +34,10 @@
<p><span class="text-muted"><?php echo $lang->task->noTask;?></span></p>
</div>
<?php else:?>
<form id='myTaskForm' class="main-table table-task" data-ride="table" method="post">
<form id='myTaskForm' class="main-table table-task" method="post">
<?php $canBatchEdit = common::hasPriv('task', 'batchEdit');?>
<?php $canBatchClose = (common::hasPriv('task', 'batchClose') and $type != 'closedBy');?>
<table class="table has-sort-head table-fixed" id='tasktable'>
<table class="table has-sort-head table-fixed" id='taskTable'>
<?php $vars = "mode=$mode&type=$type&orderBy=%s&recTotal=$recTotal&recPerPage=$recPerPage&pageID=$pageID"; ?>
<thead>
<tr>
@@ -72,7 +72,7 @@
<tbody>
<?php foreach($tasks as $task):?>
<?php $canBeChanged = common::canBeChanged('task', $task);?>
<tr>
<tr data-id='<?php echo $task->id;?>' data-status='<?php echo $task->status?>' data-estimate='<?php echo $task->estimate?>' data-consumed='<?php echo $task->consumed?>' data-left='<?php echo $task->left?>'>
<td class="c-id">
<?php if($canBatchEdit or $canBatchClose):?>
<div class="checkbox-primary">
@@ -152,5 +152,75 @@
</form>
<?php endif;?>
</div>
<?php js::set('listName', 'tasktable')?>
<script>
$(function()
{
// Update table summary text.
var checkedSummary = '<?php echo $lang->project->checkedSummary?>';
var pageSummary = '<?php echo $lang->project->pageSummary?>';
$('#myTaskForm').table(
{
statisticCreator: function(table)
{
var $table = table.getTable();
var $checkedRows = $table.find(table.isDataTable ? '.datatable-row-left.checked' : 'tbody>tr.checked');
var $originTable = table.isDataTable ? table.$.find('.datatable-origin') : null;
var checkedTotal = $checkedRows.length;
var $rows = checkedTotal ? $checkedRows : $table.find(table.isDataTable ? '.datatable-rows .datatable-row-left' : 'tbody>tr');
var checkedWait = 0;
var checkedDoing = 0;
var checkedEstimate = 0;
var checkedConsumed = 0;
var checkedLeft = 0;
var taskIdList = [];
$rows.each(function()
{
var $row = $(this);
if ($originTable)
{
$row = $originTable.find('tbody>tr[data-id="' + $row.data('id') + '"]');
}
var data = $row.data();
taskIdList.push(data.id);
var status = data.status;
if(status === 'wait') checkedWait++;
if(status === 'doing') checkedDoing++;
var canStatistics = false;
if(!$row.hasClass('table-children'))
{
canStatistics = true;
}
else
{
/* Fix bug #2579. When only child task is checked then statistics it. */
var parentID = 0;
var classes = $row.attr('class').split(' ');
for(i in classes)
{
if(classes[i].indexOf('parent-') >= 0) parentID = classes[i].replace('parent-', '');
}
if(parentID && taskIdList.indexOf(parseInt(parentID)) < 0) canStatistics = true;
}
if(canStatistics)
{
checkedEstimate += Number(data.estimate);
checkedConsumed += Number(data.consumed);
if(status != 'cancel' && status != 'closed') checkedLeft += Number(data.left);
}
});
return (checkedTotal ? checkedSummary : pageSummary).replace('%total%', $rows.length).replace('%wait%', checkedWait)
.replace('%doing%', checkedDoing)
.replace('%estimate%', checkedEstimate.toFixed(1))
.replace('%consumed%', checkedConsumed.toFixed(1))
.replace('%left%', checkedLeft.toFixed(1));
}
})
});
</script>
<?php include '../../common/view/footer.html.php';?>