* change blocks UI.

This commit is contained in:
Catouse
2016-04-14 11:50:13 +08:00
parent 3462afd856
commit c81ef5564d
6 changed files with 85 additions and 45 deletions
+75 -36
View File
@@ -10,41 +10,80 @@
* @link http://www.zentao.net
*/
?>
<table class='table table-data table-hover table-striped table-fixed block-project'>
<thead>
<tr class='text-center'>
<th><div class='text-left'><i class="icon-folder-close-alt icon"></i> <?php echo $lang->project->name;?></div></th>
<th width='80'><?php echo $lang->project->end;?></th>
<th width='50'><?php echo $lang->statusAB;?></th>
<th width='45'><?php echo $lang->project->totalEstimate;?></th>
<th width='45'><?php echo $lang->project->totalConsumed;?></th>
<th width='45'><?php echo $lang->project->totalLeft;?></th>
<th width='45'><?php echo $lang->project->progess;?></th>
</tr>
</thead>
<tbody>
<?php $id = 0; ?>
<?php foreach($projectStats as $project):?>
<?php
$appid = isset($_GET['entry']) ? "class='app-btn text-center' data-id='{$this->get->entry}'" : "class='text-center'";
$viewLink = $this->createLink('project', 'task', 'project=' . $project->id);
?>
<tr data-url='<?php echo empty($sso) ? $viewLink : $sso . $sign . 'referer=' . base64_encode($viewLink); ?>' <?php echo $appid?>>
<td class='text-left' title='<?php echo $project->name;?>'><?php echo $project->name;?></td>
<td><?php echo $project->end;?></td>
<?php if(isset($project->delay)):?>
<td><?php echo $lang->project->delayed;?></td>
<?php else:?>
<td><?php echo $lang->project->statusList[$project->status];?></td>
<?php endif;?>
<td><?php echo $project->hours->totalEstimate;?></td>
<td><?php echo $project->hours->totalConsumed;?></td>
<td><?php echo $project->hours->totalLeft;?></td>
<td class='text-left'><?php echo $project->hours->progress;?>%</td>
</tr>
<?php endforeach;?>
</tbody>
</table>
<?php $projectboxId = 'projectbox-' . rand(); ?>
<div id='<?php echo $projectboxId ?>'>
<table class='table table-data table-hover table-striped table-fixed block-project'>
<thead>
<tr class='text-center'>
<th><div class='text-left'><?php echo $lang->project->name;?></div></th>
<th width='80'><?php echo $lang->project->end;?></th>
<th width='50'><?php echo $lang->statusAB;?></th>
<th width='45'><?php echo $lang->project->totalEstimate;?></th>
<th width='45'><?php echo $lang->project->totalConsumed;?></th>
<th width='45'><?php echo $lang->project->totalLeft;?></th>
<th width='100'><?php echo $lang->project->progess;?></th>
<th width='100'><?php echo $lang->project->burn;?></th>
</tr>
</thead>
<tbody>
<?php $id = 0; ?>
<?php foreach($projectStats as $project):?>
<?php
$appid = isset($_GET['entry']) ? "class='app-btn text-center' data-id='{$this->get->entry}'" : "class='text-center'";
$viewLink = $this->createLink('project', 'task', 'project=' . $project->id);
?>
<tr data-url='<?php echo empty($sso) ? $viewLink : $sso . $sign . 'referer=' . base64_encode($viewLink); ?>' <?php echo $appid?>>
<td class='text-left' title='<?php echo $project->name;?>'><?php echo html::a($this->createLink('project', 'task', 'project=' . $project->id), $project->name, '', "title='$project->name'");?></td>
<td><?php echo $project->end;?></td>
<?php if(isset($project->delay)):?>
<td><?php echo $lang->project->delayed;?></td>
<?php else:?>
<td class='status-<?php echo $project->status?>'><?php echo $lang->project->statusList[$project->status];?></td>
<?php endif;?>
<td><?php echo $project->hours->totalEstimate;?></td>
<td><?php echo $project->hours->totalConsumed;?></td>
<td><?php echo $project->hours->totalLeft;?></td>
<td class='text-left'>
<img class='progressbar' src='<?php echo $this->app->getWebRoot();?>theme/default/images/main/green.png' alt='' height='16' width='<?php echo $project->hours->progress == 0 ? 1 : round($project->hours->progress);?>'>
<small><?php echo $project->hours->progress;?>%</small>
</td>
<td id='spark-<?php echo $id++?>' class='spark text-left pd-0' values='<?php echo join(',', $project->burns);?>'></td>
</tr>
<?php endforeach;?>
</tbody>
</table>
</div>
<script>
if(typeof(dataTable) == 'function')$('.block-project').dataTable();
$(function()
{
var $projectbox = $('#<?php echo $projectboxId ?>');
var $sparks = $projectbox.find('.spark');
$sparks.filter(':lt(6)').addClass('sparked').projectLine();
$sparks = $sparks.not('.sparked');
var rowHeight = $sparks.first().closest('tr').outerHeight() - ($.zui.browser.ie === 8 ? 0.3 : 0);
var scrollFn = false, scrollStart, i, id, $spark;
$projectbox.parent().on('scroll.spark', function(e)
{
if(!$sparks.length)
{
$projectbox.off('scroll.spark');
return;
}
if(scrollFn) clearTimeout(scrollFn);
scrollFn = setTimeout(function()
{
scrollStart = Math.floor(($projectbox.scrollTop() - 30) / (rowHeight)) + 1;
for(i = scrollStart; i <= scrollStart + 7; i++)
{
id = '#spark-' + i;
$spark = $(id);
if($spark.hasClass('sparked')) continue;
$spark.addClass('sparked').projectLine();
$sparks = $sparks.not(id);
}
},100);
});
});
</script>