This commit is contained in:
liumengyi
2023-03-13 05:10:04 +00:00
parent e291cd91f5
commit 7578a4a7cc
6 changed files with 123 additions and 44 deletions
+10 -17
View File
@@ -255,6 +255,7 @@ class release extends control
$this->view->leftBugPager = $leftBugPager;
$this->view->builds = $this->loadModel('build')->getBuildPairs($release->product, 'all', 'withbranch|hasproject', 0, 'execution', '', false);
$this->view->summary = $this->product->summary($stories);
$this->view->storyCases = $this->loadModel('testcase')->getStoryCaseCounts(array_keys($stories));
if($this->app->getViewType() == 'json')
{
@@ -562,26 +563,18 @@ class release extends control
* @access public
* @return void
*/
public function unlinkStory($releaseID, $storyID)
public function unlinkStory($releaseID, $storyID, $confirm = 'no')
{
$this->release->unlinkStory($releaseID, $storyID);
/* if ajax request, send result. */
if($this->server->ajax)
if($confirm == 'no')
{
if(dao::isError())
{
$response['result'] = 'fail';
$response['message'] = dao::getError();
}
else
{
$response['result'] = 'success';
$response['message'] = '';
}
return $this->send($response);
return print(js::confirm($this->lang->release->confirmUnlinkStory, inlink('unlinkstory', "releaseID=$releaseID&storyID=$storyID&confirm=yes")));
}
else
{
$this->release->unlinkStory($releaseID, $storyID);
return print(js::reload('parent'));
}
echo js::reload('parent');
}
/**
+42
View File
@@ -69,4 +69,46 @@ $(function()
infoShowed = true;
}
});
$('.table-story').table(
{
statisticCreator: function(table)
{
var $checkedRows = table.getTable().find(table.isDataTable ? '.datatable-row-left.checked' : 'tbody>tr.checked');
var $originTable = table.isDataTable ? table.$.find('.datatable-origin') : null;
var checkedTotal = $checkedRows.length;
if(!checkedTotal) return;
var checkedEstimate = 0;
var checkedCase = 0;
var rateCount = checkedTotal;
$checkedRows.each(function()
{
var $row = $(this);
if($originTable)
{
$row = $originTable.find('tbody>tr[data-id="' + $row.data('id') + '"]');
}
var data = $row.data();
checkedEstimate += data.estimate;
if(data.cases > 0)
{
checkedCase += 1;
}
else if(data.children != undefined && data.children > 0)
{
rateCount -= 1;
}
});
var rate = '0%';
if(rateCount) rate = Math.round(checkedCase / rateCount * 100) + '%';
if(checkedTotal == 0) return storySummary;
return checkedSummary.replace('%total%', checkedTotal)
.replace('%estimate%', checkedEstimate.toFixed(1))
.replace('%rate%', rate);
}
});
})
+8 -3
View File
@@ -14,6 +14,9 @@
<?php include '../../common/view/tablesorter.html.php';?>
<?php js::set('confirmUnlinkStory', $lang->release->confirmUnlinkStory)?>
<?php js::set('confirmUnlinkBug', $lang->release->confirmUnlinkBug)?>
<?php js::set('storySummary', $summary);?>
<?php js::set('storyCommon', $lang->SRCommon);?>
<?php js::set('checkedSummary', str_replace('%storyCommon%', $lang->SRCommon, $lang->product->checkedSummary));?>
<?php $canBeChanged = common::canBeChanged('release', $release);?>
<div id='mainMenu' class='clearfix'>
<div class='btn-toolbar pull-left'>
@@ -54,7 +57,7 @@
<div class='actions'><?php echo html::a("javascript:showLink({$release->id}, \"story\")", '<i class="icon-link"></i> ' . $lang->release->linkStory, '', "class='btn btn-primary'");?></div>
<div class='linkBox cell hidden'></div>
<?php endif;?>
<form class='main-table table-story no-stash<?php if($link === 'true' and $type == 'story') echo " hidden";?>' method='post' id='linkedStoriesForm' data-ride="table">
<form class='main-table table-story no-stash<?php if($link === 'true' and $type == 'story') echo " hidden";?>' method='post' id='linkedStoriesForm' data-ride="">
<table class='table has-sort-head' id='storyList'>
<?php
$canBatchUnlink = common::hasPriv('release', 'batchUnlinkStory');
@@ -84,7 +87,7 @@
<tbody class='text-center'>
<?php foreach($stories as $storyID => $story):?>
<?php $storyLink = $this->createLink('story', 'view', "storyID=$story->id", '', true);?>
<tr>
<tr data-id='<?php echo $story->id;?>' data-estimate='<?php echo $story->estimate?>' <?php if(!empty($story->children)) echo "data-children=" . count($story->children);?> data-cases='<?php echo zget($storyCases, $story->id, 0);?>'>
<td class='c-id text-left'>
<?php if(($canBatchUnlink or $canBatchClose) and $canBeChanged):?>
<div class="checkbox-primary">
@@ -113,7 +116,7 @@
if(common::hasPriv('release', 'unlinkStory') and $canBeChanged)
{
$unlinkURL = $this->createLink('release', 'unlinkStory', "releaseID=$release->id&story=$story->id");
echo html::a("javascript:ajaxDelete(\"$unlinkURL\", \"storyList\", confirmUnlinkStory)", '<i class="icon-unlink"></i>', '', "class='btn' title='{$lang->release->unlinkStory}'");
echo html::a($unlinkURL, '<i class="icon-unlink"></i>', 'hiddenwin', "class='btn' title='{$lang->release->unlinkStory}'");
}
?>
</td>
@@ -139,6 +142,8 @@
}
?>
</div>
<?php endif;?>
<?php if($this->app->getViewType() != 'xhtml'):?>
<div class='table-statistic'><?php echo $summary;?></div>
<?php endif;?>
<?php