From cdc9bdcf2df70d6493f38711aa49fb0b79e3e86a Mon Sep 17 00:00:00 2001 From: tanghucheng Date: Mon, 31 Oct 2022 17:23:33 +0800 Subject: [PATCH] * Code for task#74145. --- module/story/control.php | 66 +++++++++++++++---------- module/story/css/common.css | 10 ++++ module/story/js/common.js | 28 +++++++++++ module/story/view/blocksibling.html.php | 13 +++++ module/story/view/view.html.php | 13 ++++- 5 files changed, 102 insertions(+), 28 deletions(-) create mode 100644 module/story/view/blocksibling.html.php diff --git a/module/story/control.php b/module/story/control.php index 050312a13b..a5d4018aab 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -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'); + } } diff --git a/module/story/css/common.css b/module/story/css/common.css index 3baf85cc15..1eb34136d8 100644 --- a/module/story/css/common.css +++ b/module/story/css/common.css @@ -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;} diff --git a/module/story/js/common.js b/module/story/js/common.js index 5e6525c4eb..9b595ec82b 100644 --- a/module/story/js/common.js +++ b/module/story/js/common.js @@ -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: '
孪生关系解除后无法恢复,需求的内容不再同步,是否解除?
解除 取消
' + }); +}) + +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'); +} diff --git a/module/story/view/blocksibling.html.php b/module/story/view/blocksibling.html.php new file mode 100644 index 0000000000..47b3e85fd7 --- /dev/null +++ b/module/story/view/blocksibling.html.php @@ -0,0 +1,13 @@ + $story) +{ + $title = $id . ' '. $story->title; + echo "
  • "; + echo "{$branches[$story->branch]} "; + echo ($canViewLinkStory ? html::a($this->createLink('story', 'view', "id=$id", '', true), "$title", '', "class='iframe' data-width='80%'") : "$id $title"); + echo ""; + echo "
  • "; +} +?> diff --git a/module/story/view/view.html.php b/module/story/view/view.html.php index a4d3d9b26f..c53a567f8f 100644 --- a/module/story/view/view.html.php +++ b/module/story/view/view.html.php @@ -401,6 +401,9 @@
    + type != 'normal'):?> +
    +
      + +
    +
    + config->URAndSR):?>
      @@ -639,7 +649,6 @@ js::set('unlink', $lang->story->unlink); js::set('cancel', $lang->cancel); js::set('rawModule', $this->app->rawModule); ?> - +