* Code for task#74145.

This commit is contained in:
tanghucheng
2022-10-31 17:23:33 +08:00
parent bb390ecd9c
commit cdc9bdcf2d
5 changed files with 102 additions and 28 deletions
+40 -26
View File
@@ -1296,32 +1296,33 @@ class story extends control
$position[] = $this->lang->story->common;
$position[] = $this->lang->story->view;
$this->view->title = $title;
$this->view->position = $position;
$this->view->product = $product;
$this->view->branches = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($product->id);
$this->view->plan = $plan;
$this->view->bugs = $bugs;
$this->view->fromBug = $fromBug;
$this->view->cases = $cases;
$this->view->story = $story;
$this->view->linkedMRs = $linkedMRs;
$this->view->track = $this->story->getTrackByID($story->id);
$this->view->users = $this->user->getPairs('noletter');
$this->view->reviewers = $reviewers;
$this->view->relations = $this->story->getStoryRelation($story->id, $story->type);
$this->view->executions = $this->execution->getPairs(0, 'all', 'nocode');
$this->view->execution = empty($story->execution) ? array() : $this->dao->findById($story->execution)->from(TABLE_EXECUTION)->fetch();
$this->view->actions = $this->action->getList('story', $storyID);
$this->view->storyModule = $storyModule;
$this->view->modulePath = $modulePath;
$this->view->storyProducts = $storyProducts;
$this->view->version = $version;
$this->view->preAndNext = $this->loadModel('common')->getPreAndNextObject('story', $storyID);
$this->view->from = $from;
$this->view->param = $param;
$this->view->builds = $this->loadModel('build')->getStoryBuilds($storyID);
$this->view->releases = $this->loadModel('release')->getStoryReleases($storyID);
$this->view->title = $title;
$this->view->position = $position;
$this->view->product = $product;
$this->view->branches = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($product->id);
$this->view->siblings = !empty($story->sibling) ? $this->story->getByList($story->sibling) : array();
$this->view->plan = $plan;
$this->view->bugs = $bugs;
$this->view->fromBug = $fromBug;
$this->view->cases = $cases;
$this->view->story = $story;
$this->view->linkedMRs = $linkedMRs;
$this->view->track = $this->story->getTrackByID($story->id);
$this->view->users = $this->user->getPairs('noletter');
$this->view->reviewers = $reviewers;
$this->view->relations = $this->story->getStoryRelation($story->id, $story->type);
$this->view->executions = $this->execution->getPairs(0, 'all', 'nocode');
$this->view->execution = empty($story->execution) ? array() : $this->dao->findById($story->execution)->from(TABLE_EXECUTION)->fetch();
$this->view->actions = $this->action->getList('story', $storyID);
$this->view->storyModule = $storyModule;
$this->view->modulePath = $modulePath;
$this->view->storyProducts = $storyProducts;
$this->view->version = $version;
$this->view->preAndNext = $this->loadModel('common')->getPreAndNextObject('story', $storyID);
$this->view->from = $from;
$this->view->param = $param;
$this->view->builds = $this->loadModel('build')->getStoryBuilds($storyID);
$this->view->releases = $this->loadModel('release')->getStoryReleases($storyID);
$this->display();
}
@@ -2741,4 +2742,17 @@ class story extends control
return print(html::select('URS[]', $URS, $requirementList, "class='form-control chosen' multiple"));
}
/**
* AJAX: Deleted story sibling.
*
* @access public
* @return void
*/
public function ajaxRelieveSibling()
{
$storyID = !empty($_POST['storyID']) ? $_POST['storyID'] : 0;
$this->dao->update(TABLE_STORY)->set('SIBLING')->eq('')->where('id')->eq($_POST['storyID'])->exec();
return print('success');
}
}
+10
View File
@@ -17,3 +17,13 @@
.c-source {width: 130px}
.c-note {width: 100px}
.c-category {width: 90px}
.icon-info {color: #ff9800; border-color: #ff9800;}
.text-active {text-decoration: underline;}
.text-cancel {text-decoration: underline;color:#838a9d;margin-left:10px;}
.popover {border:unset;}
.popover.bottom .arrow{border-bottom-color:#ffffff;}
.popover-icon {float:left;}
.popover .content {margin-left:20px;overflow: overlay;}
.hide {display:none !important;}
.sibling {padding:6px;}
+28
View File
@@ -86,3 +86,31 @@ function loadURS()
$('#URS').chosen();
});
}
$('.sibling').mouseover(function() {
$(this).find('.unlink').removeClass('hide');
});
$('.sibling').mouseout(function() {
$(this).find('.unlink').addClass('hide');
});
$('[data-toggle="popover"]').each(function(item) {
$index = $(this).attr('data-id');
$(this).popover({
placement: 'bottom',
html: true,
content: '<div class="popover-icon"><i class="icon-info"></i></div><div class="content">孪生关系解除后无法恢复,需求的内容不再同步,是否解除?</div><div class="popover-custom text-right"><a href="javascript:relieve(' + $index + ')" class="text-active btn-info">解除</a> <a href="javascript:popoverCancel(' + $index + ');" class="text-cancel">取消</a></div>'
});
})
function relieve(index)
{
$.post(relieveURL, {storyID:index}, function(data){
if(data == 'success') $('[data-id="' + index + '"]').popover('hide').parent('li').remove();
});
}
function popoverCancel(index)
{
$('[data-id="' + index + '"]').popover('hide').addClass('hide');
}
+13
View File
@@ -0,0 +1,13 @@
<?php
js::set('relieveURL', inlink('ajaxRelieveSibling'));
$canViewLinkStory = common::hasPriv('story', 'view');
foreach($siblings as $id => $story)
{
$title = $id . ' '. $story->title;
echo "<li title='$title' class='sibling'>";
echo "<span class='label label-outline label-badge'>{$branches[$story->branch]}</span> ";
echo ($canViewLinkStory ? html::a($this->createLink('story', 'view', "id=$id", '', true), "$title", '', "class='iframe' data-width='80%'") : "$id $title");
echo "<a class='unlink hide' data-id='$id' data-toggle='popover'><i class='icon icon-unlink'></i></a>";
echo "</li>";
}
?>
+11 -2
View File
@@ -401,6 +401,9 @@
<div class="cell">
<div class='tabs'>
<ul class='nav nav-tabs'>
<?php if($product->type != 'normal'):?>
<li><a href='#legendSiblings' data-toggle='tab'><?php echo $lang->story->legendRelated;?></a></li>
<?php endif;?>
<?php if($this->config->URAndSR):?>
<li class='active'><a href='#legendStories' data-toggle='tab'><?php echo $story->type == 'story' ? $lang->story->requirement : $lang->story->story;?></a></li>
<?php endif;?>
@@ -410,6 +413,13 @@
<li><a href='#legendRelated' data-toggle='tab'><?php echo $lang->story->legendRelated;?></a></li>
</ul>
<div class='tab-content'>
<?php if($product->type != 'normal'):?>
<div class='tab-pane' id='legendSiblings'>
<ul class="list-unstyled">
<?php include './blocksibling.html.php';?>
</ul>
</div>
<?php endif;?>
<?php if($this->config->URAndSR):?>
<div class='tab-pane active' id='legendStories'>
<ul class="list-unstyled">
@@ -639,7 +649,6 @@ js::set('unlink', $lang->story->unlink);
js::set('cancel', $lang->cancel);
js::set('rawModule', $this->app->rawModule);
?>
<script>
</script>
<?php include '../../common/view/syntaxhighlighter.html.php';?>
<?php include '../../common/view/footer.html.php';?>