From a894af9528d6122d656d6392f6314e4bdad6d64d Mon Sep 17 00:00:00 2001 From: tianshujie Date: Tue, 24 Oct 2023 09:22:11 +0800 Subject: [PATCH] * Refactor actions of the execution list. --- module/execution/config.php | 1 + module/project/js/execution.ui.js | 9 ++++----- module/project/ui/execution.html.php | 17 ++++------------- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/module/execution/config.php b/module/execution/config.php index 553b0ab8b2..0ee86a1001 100644 --- a/module/execution/config.php +++ b/module/execution/config.php @@ -197,6 +197,7 @@ $config->execution->actionList['edit']['icon'] = 'edit'; $config->execution->actionList['edit']['text'] = $lang->execution->edit; $config->execution->actionList['edit']['hint'] = $lang->execution->edit; $config->execution->actionList['edit']['url'] = helper::createLink('execution', 'edit', "executionID={rawID}"); +$config->execution->actionList['edit']['data-size'] = 'lg'; $config->execution->actionList['edit']['data-toggle'] = 'modal'; $config->execution->actionList['close']['icon'] = 'off'; diff --git a/module/project/js/execution.ui.js b/module/project/js/execution.ui.js index 291a164d6e..5f3d0142d1 100644 --- a/module/project/js/execution.ui.js +++ b/module/project/js/execution.ui.js @@ -1,11 +1,10 @@ -function showTask() +$(document).off('click', '#showTask').on('click', '#showTask', function() { - var show = $('#showTask').is(':checked') ? 1 : 0; + const show = $(this).is(':checked') ? 1 : 0; $.cookie.set('showTask', show, {expires:config.cookieLife, path:config.webRoot}); - const link = $.createLink('project', 'execution', 'status=' + status + '&projectID=' + projectID + '&orderBy=' + orderBy + '&productID=' + productID); - loadPage(link); -} + loadCurrentPage(); +}); $(document).off('click','.batch-btn').on('click', '.batch-btn', function() { diff --git a/module/project/ui/execution.html.php b/module/project/ui/execution.html.php index a2815523fb..8b92a0062a 100644 --- a/module/project/ui/execution.html.php +++ b/module/project/ui/execution.html.php @@ -35,20 +35,13 @@ if($canBatchAction) if($canBatchChangeStatus) { - $statusList = array(); + $statusItems = array(); foreach($lang->execution->statusList as $key => $value) { - $statusList[] = array('text' => $value, 'class' => 'batch-btn ajax-btn', 'data-url' => createLink('execution', 'batchChangeStatus', "status=$key")); + $statusItems[] = array('text' => $value, 'innerClass' => 'batch-btn ajax-btn', 'data-url' => createLink('execution', 'batchChangeStatus', "status=$key")); } - menu - ( - set::id('navStatus'), - set::className('dropdown-menu'), - set::items($statusList) - ); - - $footToolbar['items'][] = array('caret' => 'up', 'text' => $lang->statusAB, 'className' => 'btn btn-caret size-sm secondary', 'url' => '#navStatus', 'data-toggle' => 'dropdown', 'data-placement' => 'top-start'); + $footToolbar['items'][] = array('caret' => 'up', 'text' => $lang->statusAB, 'className' => 'btn btn-caret size-sm secondary', 'items' => $statusItems, 'type' => 'dropdown', 'data-placement' => 'top-start'); } } @@ -73,7 +66,6 @@ $fnGenerateCols = function() use ($config, $project) }; /* zin: Define the feature bar on main menu. */ -$checked = $this->cookie->showTask ? 'checked' : ''; $productMenuLink = createLink( $this->app->rawModule, $this->app->rawMethod, @@ -108,10 +100,9 @@ featureBar ( set::id('showTask'), set::name('showTask'), - set::checked($checked), + set::checked($this->cookie->showTask ? 'checked' : ''), set::text($lang->programplan->stageCustom->task), set::rootClass('ml-4'), - on::change('showTask') ) ) );