* Adjust story and testcase page for my module.

This commit is contained in:
holan20180123
2020-09-02 14:37:50 +08:00
parent 7877f31e6f
commit d9dbbad25b
5 changed files with 79 additions and 22 deletions
+11
View File
@@ -0,0 +1,11 @@
.table-children {border-left: 2px solid #cbd0db; border-right: 2px solid #cbd0db;}
.table tbody > tr.table-children.table-child-top {border-top: 2px solid #cbd0db;}
.table tbody > tr.table-children.table-child-bottom {border-bottom: 2px solid #cbd0db;}
.table td.has-child > a:not(.story-toggle) {max-width: 90%; max-width: calc(100% - 30px); display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
.table td.has-child > .story-toggle {color: #838a9d; position: relative; top: 1px;}
.table td.has-child > .story-toggle:hover {color: #006af1; cursor: pointer;}
.table td.has-child > .story-toggle > .icon {font-size: 16px; display: inline-block; transition: transform .2s; -ms-transform:rotate(-90deg); -moz-transform:rotate(-90deg); -o-transform:rotate(-90deg); -webkit-transform:rotate(-90deg); transform: rotate(-90deg);}
.table td.has-child > .story-toggle > .icon:before {text-align: left;}
.table td.has-child > .story-toggle.collapsed > .icon {-ms-transform:rotate(90deg); -moz-transform:rotate(90deg); -o-transform:rotate(90deg); -webkit-transform:rotate(90deg); transform: rotate(90deg);}
.main-table tbody > tr.table-children > td:first-child::before {width: 3px;}
@-moz-document url-prefix() {.main-table tbody > tr.table-children > td:first-child::before {width: 4px;}}
+20
View File
@@ -0,0 +1,20 @@
$(function()
{
$('#storyList td.has-child .story-toggle').each(function()
{
var $td = $(this).closest('td');
var labelWidth = 0;
if($td.find('.label').length > 0) labelWidth = $td.find('.label').width();
$td.find('a').eq(0).css('max-width', $td.width() - labelWidth - 60);
});
$(document).on('click', '.story-toggle', function(e)
{
var $toggle = $(this);
var id = $(this).data('id');
var isCollapsed = $toggle.toggleClass('collapsed').hasClass('collapsed');
$toggle.closest('[data-ride="table"]').find('tr.parent-' + id).toggle(!isCollapsed);
e.stopPropagation();
e.preventDefault();
});
})
+46 -2
View File
@@ -29,7 +29,7 @@
</div>
<?php else:?>
<form id='myStoryForm' class="main-table table-story" data-ride="table" method="post">
<table class="table has-sort-head table-fixed">
<table id='storyList' class="table has-sort-head table-fixed">
<?php $vars = "type=$type&orderBy=%s&recTotal=$recTotal&recPerPage=$recPerPage&pageID=$pageID"; ?>
<?php
$canBatchEdit = common::hasPriv('story', 'batchEdit');
@@ -77,7 +77,10 @@
<td class='c-pri'><span class='label-pri <?php echo 'label-pri-' . $story->pri;?>' title='<?php echo zget($lang->story->priList, $story->pri, $story->pri);?>'><?php echo zget($lang->story->priList, $story->pri, $story->pri);?></span></td>
<td class='c-product'><?php echo zget($programs, $story->program, '');?></td>
<td class='c-product'><?php echo $story->productTitle;?></td>
<td class='c-name nobr'><?php echo html::a($storyLink, $story->title, null, "style='color: $story->color'");?></td>
<td class='c-name nobr <?php if(!empty($story->children)) echo "has-child" ?>'>
<?php echo html::a($storyLink, $story->title, null, "style='color: $story->color'");?>
<?php if(!empty($story->children)) echo '<a class="story-toggle" data-id="' . $story->id . '"><i class="icon icon-angle-double-right"></i></a>';;?>
</td>
<td class='c-plan'><?php echo $story->planTitle;?></td>
<td class='c-user'><?php echo zget($users, $story->openedBy);?></td>
<td class='c-hours'><?php echo $story->estimate;?></td>
@@ -94,6 +97,47 @@
?>
</td>
</tr>
<?php if(!empty($story->children)):?>
<?php $i = 0;?>
<?php foreach($story->children as $key => $child):?>
<?php $storyLink = $this->createLink('story', 'view', "id=$child->id", '', '', $child->program);?>
<?php $class = $i == 0 ? ' table-child-top' : '';?>
<?php $class .= ($i + 1 == count($story->children)) ? ' table-child-bottom' : '';?>
<tr class='table-children<?php echo $class;?> parent-<?php echo $story->id;?>' data-id='<?php echo $child->id?>' data-status='<?php echo $child->status?>' data-estimate='<?php echo $child->estimate?>'>
<td class="c-id">
<?php if($canBatchAction):?>
<div class="checkbox-primary">
<input type='checkbox' name='storyIdList[<?php echo $child->id;?>]' value='<?php echo $child->id;?>' />
<label></label>
</div>
<?php endif;?>
<?php printf('%03d', $child->id);?>
</td>
<td class='c-pri'><span class='label-pri <?php echo 'label-pri-' . $child->pri;?>' title='<?php echo zget($lang->story->priList, $child->pri, $child->pri);?>'><?php echo zget($lang->story->priList, $child->pri, $child->pri);?></span></td>
<td class='c-product'><?php echo zget($programs, $child->program, '');?></td>
<td class='c-product'><?php echo $child->productTitle;?></td>
<td class='c-name nobr'>
<?php echo '<span class="label label-badge label-light" title="' . $this->lang->story->children .'">' . $this->lang->story->childrenAB . '</span> ' . html::a($storyLink, $child->title, null, "style='color: $child->color'");?>
</td>
<td class='c-plan'><?php echo $child->planTitle;?></td>
<td class='c-user'><?php echo zget($users, $child->openedBy);?></td>
<td class='c-hours'><?php echo $child->estimate;?></td>
<td class='c-status'><span class='status-story status-<?php echo $child->status;?>'> <?php echo $this->processStatus('story', $child);?></span></td>
<td class='c-stage'><?php echo zget($lang->story->stageList, $child->stage);?></td>
<td class='c-actions'>
<?php
$vars = "story={$child->id}";
common::printIcon('story', 'change', $vars, $child, 'list', 'fork', '', '', '', '', '', $child->program);
common::printIcon('story', 'review', $vars, $child, 'list', 'glasses', '', '', '', '', '', $child->program);
common::printIcon('story', 'close', $vars, $child, 'list', '', '', 'iframe', true, '', '', $child->program);
common::printIcon('story', 'edit', $vars, $child, 'list', '', '', '', '', '', '', $child->program);
common::printIcon('story', 'createCase', "productID=$child->product&branch=$child->branch&module=0&from=&param=0&$vars", $child, 'list', 'sitemap', '', '', '', '', '', $child->program);
?>
</td>
</tr>
<?php $i ++;?>
<?php endforeach;?>
<?php endif;?>
<?php endforeach;?>
</tbody>
</table>
+1 -19
View File
@@ -47,7 +47,6 @@
<thead>
<tr>
<th class='w-100px'>
<?php if($canBatchAction) echo "<div class='checkbox-primary check-all' title='{$lang->selectAll}'><label></label></div>";?>
<?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?>
</th>
<th class='w-50px'> <?php common::printOrderLink('pri', $orderBy, $vars, $lang->priAB);?></th>
@@ -69,7 +68,7 @@
?>
<tr>
<td class="c-id">
<?php echo html::checkbox('caseIDList', array($case->id => '')) . html::a(helper::createLink('testcase', 'view', "caseID =$case->id"), sprintf('%03d', $case->id)); ?>
<?php echo sprintf('%03d', $case->id); ?>
</td>
<td><span class='label-pri <?php echo 'label-pri-' . $case->pri?>' title='<?php echo zget($lang->testcase->priList, $case->pri, $case->pri);?>'><?php echo zget($lang->testcase->priList, $case->pri, $case->pri)?></span></td>
<?php $params = "testcaseID=$caseID&version=$case->version";?>
@@ -95,23 +94,6 @@
</tbody>
</table>
<div class="table-footer">
<?php if($canBatchAction):?>
<div class="checkbox-primary check-all"><label><?php echo $lang->selectAll?></label></div>
<?php endif;?>
<div class='table-actions btn-toolbar'>
<div class='btn-group dropup'>
<?php
$actionLink = $this->createLink('testtask', 'batchRun', "productID=0&orderBy=$orderBy");
$misc = $canBatchRun ? "onclick=\"setFormAction('$actionLink')\"" : "disabled='disabled'";
echo html::commonButton($lang->testtask->runCase, $misc);
$actionLink = $this->createLink('testcase', 'batchEdit');
$misc = $canBatchEdit ? "onclick=\"setFormAction('$actionLink')\"" : "disabled='disabled'";
echo html::commonButton($lang->edit, $misc);
?>
</div>
</div>
<div class="table-statistic"><?php echo $summary;?></div>
<?php $pager->show('right', 'pagerjs');?>
</div>
</form>
+1 -1
View File
@@ -1857,7 +1857,7 @@ class userModel extends model
$personalData = array();
$personalData['createdTodo'] = $this->dao->select($count)->from(TABLE_TODO)->where('account')->eq($account)->fetch('count');
$personalData['createdStory'] = $this->dao->select($count)->from(TABLE_STORY)->where('openedBy')->eq($account)->andWhere('deleted')->eq('0')->fetch('count');
$personalData['createdStory'] = $this->dao->select($count)->from(TABLE_STORY)->where('openedBy')->eq($account)->andWhere('deleted')->eq('0')->andWhere('type')->eq('story')->fetch('count');
$personalData['resolvedBug'] = $this->dao->select($count)->from(TABLE_BUG)->where('resolvedBy')->eq($account)->andWhere('deleted')->eq('0')->fetch('count');
$personalData['createdCase'] = $this->dao->select($count)->from(TABLE_CASE)->where('openedBy')->eq($account)->andWhere('deleted')->eq('0')->andWhere('product')->ne(0)->fetch('count');
$personalData['finishedTask'] = $this->dao->select($count)->from(TABLE_TASK)->where('deleted')->eq('0')