From 83e0a36d9d3393b99d59f28c0890f900eaa5d1ea Mon Sep 17 00:00:00 2001 From: daitingting Date: Wed, 11 Oct 2023 08:21:09 +0000 Subject: [PATCH] * Adjust the duplicate toggle and picker. --- module/bug/js/batchedit.ui.js | 17 ++++++----------- module/bug/ui/batchedit.html.php | 8 ++++---- module/bug/zen.php | 26 ++++++++++++++++++++------ 3 files changed, 30 insertions(+), 21 deletions(-) diff --git a/module/bug/js/batchedit.ui.js b/module/bug/js/batchedit.ui.js index 40a8bd94fa..9bdaf3bb7b 100644 --- a/module/bug/js/batchedit.ui.js +++ b/module/bug/js/batchedit.ui.js @@ -36,10 +36,11 @@ window.renderRowData = function($row, index, row) } /* Show the bugs of current bug's product. */ - if(productBugList[row.product] != undefined && productBugList[row.product][row.branch] != undefined) + if(productBugOptions[row.product] != undefined && productBugOptions[row.product][row.branch] != undefined) { - let duplicateBugs = productBugList[row.product][row.branch]; - $row.find('[data-name="duplicateBug"]').find('.picker-box').on('inited', function(e, info) + let duplicateBugs = productBugOptions[row.product][row.branch]; + + $row.find('[data-name="resolutionBox"]').find('.input-group').find('.duplicate-select').on('inited', function(e, info) { let $duplicateBug = info[0]; $duplicateBug.render({items: duplicateBugs}); @@ -91,12 +92,6 @@ function setDuplicate(event) const $target = $(event.target); const $currentRow = $target.closest('tr'); const resolution = $target.val(); - if(resolution == 'duplicate') - { - $currentRow.find('.form-batch-input[data-name="duplicateBug"]').removeClass('hidden'); - } - else - { - $currentRow.find('.form-batch-input[data-name="duplicateBug"]').addClass('hidden'); - } + + $currentRow.find('[data-name="duplicate"]').toggleClass('hidden', resolution != 'duplicate'); } diff --git a/module/bug/ui/batchedit.html.php b/module/bug/ui/batchedit.html.php index 61e812e080..550c0529a2 100644 --- a/module/bug/ui/batchedit.html.php +++ b/module/bug/ui/batchedit.html.php @@ -14,7 +14,7 @@ jsVar('tab', $app->tab); jsVar('modules', $modules); jsVar('products', $products); jsVar('branchTagOption', $branchTagOption); -jsVar('productBugList', $productBugList); +jsVar('productBugOptions', $productBugOptions); jsVar('executionMembers', isset($executionMembers) ? $executionMembers : array()); jsVar('projectMembers', isset($projectMembers) ? $projectMembers : array()); jsVar('productMembers', isset($productMembers) ? $productMembers : array()); @@ -194,8 +194,8 @@ formBatchPanel formBatchItem ( set::label($lang->bug->resolution), - set::width('200px'), - set::name(''), + set::width('220px'), + set::name('resolutionBox'), set::control('inputGroup'), inputGroup ( @@ -207,7 +207,7 @@ formBatchPanel ), picker ( - setClass('hidden'), + setClass('duplicate-select hidden'), set::name('duplicate'), set::items(array()), set::placeholder($lang->bug->placeholder->duplicate), diff --git a/module/bug/zen.php b/module/bug/zen.php index b78ff09b87..10ccfb0b35 100644 --- a/module/bug/zen.php +++ b/module/bug/zen.php @@ -1662,12 +1662,26 @@ class bugZen extends bug } } - $this->view->bugs = $bugs; - $this->view->branchProduct = $branchProduct; - $this->view->modules = $bugModules; - $this->view->productBugList = $productBugList; - $this->view->branchTagOption = $branchOptions; - $this->view->products = $products; + $productBugOptions = array(); + foreach($productBugList as $productID => $productBugs) + { + $productBugOptions[$productID] = array(); + foreach($productBugs as $branchID => $branchBugs) + { + $productBugOptions[$productID][$branchID] = array(); + foreach($branchBugs as $bugID => $bugTitle) + { + $productBugOptions[$productID][$branchID][] = array('text' => $bugTitle, 'value' => $bugID); + } + } + } + + $this->view->bugs = $bugs; + $this->view->branchProduct = $branchProduct; + $this->view->modules = $bugModules; + $this->view->productBugOptions = $productBugOptions; + $this->view->branchTagOption = $branchOptions; + $this->view->products = $products; return $branchTagOption; }