From b9e6fb1ee9c6d4b96f1e663d96fe8f1fe9bbff8e Mon Sep 17 00:00:00 2001 From: daitingting Date: Mon, 12 Jun 2023 11:49:38 +0000 Subject: [PATCH] * Optimize codes. --- module/bug/ui/browse.html.php | 8 ++++---- module/my/ui/bug.html.php | 8 ++++---- module/project/ui/bug.html.php | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/module/bug/ui/browse.html.php b/module/bug/ui/browse.html.php index c3862e2e5f..0d6c1156d2 100644 --- a/module/bug/ui/browse.html.php +++ b/module/bug/ui/browse.html.php @@ -113,7 +113,7 @@ if(!$canBatchAction) $config->bug->dtable->fieldList['id']['type'] = 'id'; $bugs = initTableData($bugs, $config->bug->dtable->fieldList, $this->bug); $data = array_values($bugs); -$footToolbar = array('items' => array +$footToolbar = $canBatchAction ? array('items' => array ( array('type' => 'btn-group', 'items' => array ( @@ -123,7 +123,7 @@ $footToolbar = array('items' => array array('caret' => 'up', 'text' => $lang->product->branchName[$this->session->currentProductType], 'className' => ($this->session->currentProductType == 'normal' || !$canBatchChangeBranch ? 'hidden' : '') , 'url' => '#navBranch', 'data-toggle' => 'dropdown', 'data-placement' => 'top-start'), array('caret' => 'up', 'text' => $lang->bug->abbr->module, 'className' => $canBatchChangeModule ? '' : 'hidden', 'url' => '#navModule', 'data-toggle' => 'dropdown', 'data-placement' => 'top-start'), array('caret' => 'up', 'text' => $lang->bug->assignedTo, 'className' => ($canBatchAssignTo ? '' : 'hidden'), 'url' => '#navAssignedTo','data-toggle' => 'dropdown', 'data-placement' => 'top-start'), -), 'btnProps' => array('size' => 'sm', 'btnType' => 'secondary')); +), 'btnProps' => array('size' => 'sm', 'btnType' => 'secondary')) : null; $resolveItems = array(); foreach($lang->bug->resolutionList as $key => $resolution) @@ -215,8 +215,8 @@ else set::data($data), set::userMap($users), set::customCols(true), - set::checkable($canBatchAction ? true : false), - $canBatchAction ? set::footToolbar($footToolbar) : null, + set::checkable($canBatchAction), + set::footToolbar($footToolbar), set::footPager ( usePager(), diff --git a/module/my/ui/bug.html.php b/module/my/ui/bug.html.php index 986bdd5424..633b210bf9 100644 --- a/module/my/ui/bug.html.php +++ b/module/my/ui/bug.html.php @@ -48,13 +48,13 @@ foreach($bugs as $bug) $bug->canBeChanged = common::canBeChanged('bug', $bug); $bugs = initTableData($bugs, $config->my->bug->dtable->fieldList, $this->bug); $bugs = array_values($bugs); -$footToolbar = array('items' => array +$footToolbar = $canBatchAction ? array('items' => array ( array('text' => $lang->edit, 'className' => 'batch-btn ' . ($canBatchEdit ? '' : 'hidden'), 'data-url' => createLink('bug', 'batchEdit')), array('text' => $lang->confirm, 'className' => 'batch-btn ajax-btn ' . ($canBatchConfirm ? '' : 'hidden'), 'data-url' => createLink('bug', 'batchConfirm')), array('text' => $lang->close, 'className' => 'batch-btn ajax-btn ' . ($canBatchClose ? '' : 'hidden'), 'data-url' => createLink('bug', 'batchClose')), array('text' => $lang->bug->assignedTo, 'className' => ($canBatchAssignTo ? '' : 'hidden'), 'caret' => 'up', 'url' => '#navAssignedTo','data-toggle' => 'dropdown', 'data-placement' => 'top-start'), -), 'btnProps' => array('size' => 'sm', 'btnType' => 'secondary')); +), 'btnProps' => array('size' => 'sm', 'btnType' => 'secondary')) : null; $assignedToItems = array(); foreach ($memberPairs as $key => $value) @@ -75,9 +75,9 @@ dtable set::data($bugs), set::userMap($users), set::onRenderCell(jsRaw('window.onRenderBugNameCell')), - set::checkable($canBatchAction ? true : false), + set::checkable($canBatchAction), set::canRowCheckable(jsRaw('function(rowID){return this.getRowInfo(rowID).data.canBeChanged;}')), - $canBatchAction ? set::footToolbar($footToolbar) : null, + set::footToolbar($footToolbar), set::footPager(usePager()), ); diff --git a/module/project/ui/bug.html.php b/module/project/ui/bug.html.php index 9a39df3e2b..e181a26775 100644 --- a/module/project/ui/bug.html.php +++ b/module/project/ui/bug.html.php @@ -81,10 +81,10 @@ menu set::items($assignedToItems) ); -$footToolbar = array('items' => array +$footToolbar = $canBatchAssignedTo ? array('items' => array ( array('caret' => 'up', 'text' => $lang->bug->assignedTo, 'btnType' => 'secondary', 'url' => '#navAssignedTo','data-toggle' => 'dropdown', 'data-placement' => 'top'), -)); +)) : null; dtable ( @@ -93,9 +93,9 @@ dtable set::userMap($users), set::customCols(true), set::footToolbar($footToolbar), - set::checkable($canBatchAssignTo ? true : false), + set::checkable($canBatchAssignTo), set::canRowCheckable(jsRaw('function(rowID){return this.getRowInfo(rowID).data.canBeChanged;}')), - $canBatchAssignedTo ? set::footToolbar($footToolbar) : null, + set::footToolbar($footToolbar), set::footPager(usePager()), );