* Finish task #81192.

This commit is contained in:
孙广明
2022-12-29 10:55:03 +08:00
parent cb75585308
commit 9b3d6387a5
3 changed files with 40 additions and 11 deletions
+16 -3
View File
@@ -1909,7 +1909,6 @@ class story extends control
/* Get edited stories. */
$stories = $this->story->getByList($storyIdList);
$productStoryList = array();
$productList = array();
$ignoreTwins = array();
$twinsCount = array();
@@ -1934,7 +1933,6 @@ class story extends control
$storyProduct = isset($productList[$story->product]) ? $productList[$story->product] : $this->product->getByID($story->product);
$branch = $storyProduct->type == 'branch' ? ($story->branch > 0 ? $story->branch : '0') : 'all';
if(!isset($productStoryList[$story->product][$story->branch])) $productStoryList[$story->product][$story->branch] = $this->story->getProductStoryPairs($story->product, $branch, 0, 'all', 'id_desc', 0, '', $story->type);
if(!empty($story->twins))
{
@@ -2030,7 +2028,6 @@ class story extends control
$this->view->storyIdList = $storyIdList;
$this->view->storyType = $storyType;
$this->view->reasonList = $this->lang->story->reasonList;
$this->view->productStoryList = $productStoryList;
$this->view->twinsCount = $twinsCount;
$this->display();
@@ -3065,4 +3062,20 @@ class story extends control
if(!dao::isError()) $this->loadModel('action')->create('story', $twinID, 'relieved');
return $this->send(array('result' => 'success', 'silbingsCount' => count($twins)-1));
}
/**
* Ajax get story pairs.
*
* @param int $storyID
* @access public
* @return void
*/
public function ajaxGetStoryPairs($storyID)
{
$this->app->loadLang('bug');
$story = $this->story->getByID($storyID);
$stories = $this->story->getProductStoryPairs($story->product, $story->branch, 0, 'all', 'id_desc', 0, '', $story->type);
return print html::select("duplicateStoryIDList[$storyID]", $stories, '', "class='form-control' placeholder='{$this->lang->bug->duplicateTip}'");
}
}
+23 -7
View File
@@ -27,14 +27,30 @@ function setDuplicateAndChild(resolution, storyID)
$(function()
{
$('select[id^="duplicateStoryIDList"]').picker(
$('td[id^="duplicateStoryBox"]').on('mouseenter', 'select[id^="duplicateStoryIDList"]', function()
{
disableEmptySearch : true,
dropWidth : 'auto',
onReady: function(event)
var options = $(this).find('option').length;
if(options <= 1)
{
$(event.picker.$container).addClass('required');
}
var id = $(this).attr('id');
var storyID = id.replace('duplicateStoryIDList', '');
var link = createLink('story', 'ajaxGetStoryPairs', 'storyID=' + storyID);
var that = $(this);
});
$.get(link, function(data)
{
that.replaceWith(data);
$("#duplicateStoryIDList" + storyID).picker(
{
disableEmptySearch : true,
dropWidth : 'auto',
onReady: function(event)
{
$(event.picker.$container).addClass('required');
}
});
})
}
})
});
+1 -1
View File
@@ -49,7 +49,7 @@
<?php echo html::select("closedReasons[$storyID]", $reasonList, 'done', "class=form-control onchange=setDuplicateAndChild(this.value,$storyID) style='min-width: 80px'");?>
</td>
<td class='pd-0 w-p60 text-left' id='<?php echo 'duplicateStoryBox' . $storyID;?>' <?php if($story->closedReason != 'duplicate') echo "style='display:none'";?>>
<?php echo html::select("duplicateStoryIDList[$storyID]", array('' => '') + $productStoryList[$story->product][$story->branch], $story->duplicateStory ? $story->duplicateStory : '', "class='form-control' placeholder='{$lang->bug->duplicateTip}'");?>
<?php echo html::select("duplicateStoryIDList[$storyID]", '', '', "class='form-control' placeholder='{$lang->bug->duplicateTip}'");?>
</td>
<td class='pd-0' id='<?php echo 'childStoryBox' . $storyID;?>' <?php if($story->closedReason != 'subdivided') echo "style='display:none'";?>>
<?php echo html::input("childStoriesIDList[$storyID]", '', "class='form-control' placeholder='{$lang->idAB}'");?>