From 9a52fee2dcfa23940bb9ebe0a8fa6626dcb9a45d Mon Sep 17 00:00:00 2001 From: sunguangming Date: Mon, 6 Nov 2023 11:01:16 +0800 Subject: [PATCH] * Add column actions to kanban. --- module/kanban/js/view.ui.js | 33 +++++++++++++++++++++++++++++---- module/kanban/ui/view.html.php | 6 +++++- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/module/kanban/js/view.ui.js b/module/kanban/js/view.ui.js index a159669470..16ada9567a 100644 --- a/module/kanban/js/view.ui.js +++ b/module/kanban/js/view.ui.js @@ -47,8 +47,26 @@ window.buildColCardActions = function(col) { let actions = []; - if(col.actionList.includes('createCard') != -1) actions.push({text: kanbanLang.createCard, url: $.createLink('kanban', 'createCard', `kanbanID=${kanbanID}®inID=${col.region}&groupID=${col.group}&columnID=${col.id}`), 'data-toggle': 'modal'}); - if(col.actionList.includes('batchCreateCard') != -1) actions.push({text: kanbanLang.batchCreateCard, url: $.createLink('kanban', 'batchCreateCard', `kanbanID=${kanbanID}®inID=${col.region}&groupID=${col.group}&columnID=${col.id}`), 'data-toggle': 'modal'}); + if(col.actionList.includes('createCard')) actions.push({text: kanbanLang.createCard, url: $.createLink('kanban', 'createCard', `kanbanID=${kanbanID}®inID=${col.region}&groupID=${col.group}&columnID=${col.id}`), 'data-toggle': 'modal'}); + if(col.actionList.includes('batchCreateCard')) actions.push({text: kanbanLang.batchCreateCard, url: $.createLink('kanban', 'batchCreateCard', `kanbanID=${kanbanID}®inID=${col.region}&groupID=${col.group}&columnID=${col.id}`), 'data-toggle': 'modal'}); + if(kanban.object.indexOf('cards') != -1) actions.push({text: kanbanLang.importCard, url: $.createLink('kanban', 'importCard', `kanbanID=${kanbanID}®ionID=${col.region}&groupID=${col.group}&columnID=${col.id}`), 'data-toggle': 'modal'}); + if(kanban.object && kanban.object != 'cards' && vision != 'lite') + { + actions.push({type: 'divider'}); + actions.push( + { + text: kanbanLang.importAB, + caret: true, + items: [ + {text: kanbanLang.importPlan, url: $.createLink('kanban', 'importPlan', `kanbanID=${kanbanID}®ionID=${col.region}&groupID=${col.group}&columnID=${col.id}`), 'data-toggle': 'modal'}, + {text: kanbanLang.importRelease, url: $.createLink('kanban', 'importRelease', `kanbanID=${kanbanID}®ionID=${col.region}&groupID=${col.group}&columnID=${col.id}`), 'data-toggle': 'modal'}, + {text: kanbanLang.importExecution, url: $.createLink('kanban', 'importExecution', `kanbanID=${kanbanID}®ionID=${col.region}&groupID=${col.group}&columnID=${col.id}`), 'data-toggle': 'modal'}, + {text: kanbanLang.importBuild, url: $.createLink('kanban', 'importBuild', `kanbanID=${kanbanID}®ionID=${col.region}&groupID=${col.group}&columnID=${col.id}`), 'data-toggle': 'modal'}, + {text: kanbanLang.importTicket, url: $.createLink('kanban', 'importTicket', `kanbanID=${kanbanID}®ionID=${col.region}&groupID=${col.group}&columnID=${col.id}`), 'data-toggle': 'modal'}, + ] + } + ); + } return actions; } @@ -61,8 +79,15 @@ window.buildColActions = function(col) { let actions = []; - if(col.actionList.includes('setColumn') != -1) actions.push({text: kanbanLang.setColumn, url: $.createLink('kanban', 'setColumn', `columnID=${col.id}`), 'data-toggle': 'modal', 'icon': 'edit'}); - if(col.actionList.includes('setWIP') != -1) actions.push({text: kanbanLang.setWIP, url: $.createLink('kanban', 'setWIP', `columnID=${col.id}`), 'data-toggle': 'modal', 'icon': 'alert'}); + if(col.actionList.includes('setColumn')) actions.push({text: kanbanLang.setColumn, url: $.createLink('kanban', 'setColumn', `columnID=${col.id}`), 'data-toggle': 'modal', 'icon': 'edit'}); + if(col.actionList.includes('setWIP')) actions.push({text: kanbanLang.setWIP, url: $.createLink('kanban', 'setWIP', `columnID=${col.id}`), 'data-toggle': 'modal', 'icon': 'alert'}); + actions.push({type: 'divider'}); + if(col.actionList.includes('splitColumn')) actions.push({text: kanbanLang.splitColumn, url: $.createLink('kanban', 'splitColumn', `columnID=${col.id}`), 'data-toggle': 'modal', 'icon': 'col-split'}); + if(col.actionList.includes('createColumn')) actions.push({text: kanbanLang.createColumnOnLeft, url: $.createLink('kanban', 'createColumn', `columnID=${col.id}&position=left`), 'data-toggle': 'modal', 'icon': 'col-add-left'}); + if(col.actionList.includes('createColumn')) actions.push({text: kanbanLang.createColumnOnRight, url: $.createLink('kanban', 'createColumn', `columnID=${col.id}&position=right`), 'data-toggle': 'modal', 'icon': 'col-add-right'}); + actions.push({type: 'divider'}); + if(col.actionList.includes('archiveColumn')) actions.push({text: kanbanLang.archiveColumn, url: $.createLink('kanban', 'archiveColumn', `columnID=${col.id}`), 'icon': 'card-archive', 'data-confirm': columnLang.confirmArchive, 'innerClass': 'ajax-submit'}); + if(col.actionList.includes('deleteColumn')) actions.push({text: kanbanLang.deleteColumn, url: $.createLink('kanban', 'deleteColumn', `columnID=${col.id}`), 'icon': 'trash', 'innerClass': 'ajax-submit', 'data-confirm': columnLang.confirmDelete}); return actions; } diff --git a/module/kanban/ui/view.html.php b/module/kanban/ui/view.html.php index 4b04c05d30..19ff361f41 100644 --- a/module/kanban/ui/view.html.php +++ b/module/kanban/ui/view.html.php @@ -15,6 +15,7 @@ foreach($kanbanList as $regionID => $region) $group['laneProps'] = array('actions' => jsRaw('window.getLaneActions')); $group['itemProps'] = array('actions' => jsRaw('window.getItemActions')); + /* 计算各个列上的卡片数量。 */ foreach($group['data']['cols'] as $col) $parentCols[$col['id']] = $col['parent']; foreach($group['data']['items'] as $colGroup) { @@ -39,8 +40,11 @@ foreach($kanbanList as $regionID => $region) jsVar('laneCount', $laneCount); jsVar('kanbanLang', $lang->kanban); -jsVar('kanbanID', $kanbanID); +jsVar('columnLang', $lang->kanbancolumn); +jsVar('kanbanID', $kanban->id); +jsVar('kanban', $kanban); jsVar('columnCount', $columnCount); +jsVar('vision', $config->vision); zui::kanbanList (