From 7a7ad37f3cbf871d0c9ffa43e04ea530a7d0f7a5 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Mon, 24 Jan 2022 18:16:28 +0800 Subject: [PATCH] * Finish task #47990. --- module/kanban/config.php | 2 +- module/kanban/css/view.css | 22 +++++----- module/kanban/js/view.js | 71 +++++++++++++++++++++++++++++++- module/kanban/view/view.html.php | 2 + 4 files changed, 84 insertions(+), 13 deletions(-) diff --git a/module/kanban/config.php b/module/kanban/config.php index 3ccfd55b79..c612fdf70e 100644 --- a/module/kanban/config.php +++ b/module/kanban/config.php @@ -47,7 +47,7 @@ $config->kanban->editor->viewcard = array('id' => 'comment', 'tools' => 'simp $config->kanban->fromType = array('execution', 'productplan', 'release', 'build'); $config->kanban->executionField = array('name', 'status', 'end', 'PM', 'type', 'deleted'); $config->kanban->productplanField = array(); -$config->kanban->releaseField = array('name', 'status', 'date'); +$config->kanban->releaseField = array('name', 'status', 'date', 'deleted'); $config->kanban->buildField = array(); $config->kanban->default = new stdclass(); diff --git a/module/kanban/css/view.css b/module/kanban/css/view.css index a5db20fa63..731bde545c 100644 --- a/module/kanban/css/view.css +++ b/module/kanban/css/view.css @@ -102,15 +102,17 @@ .gray .actions {display:none;} .kanban-card .header .executionName {display: flex; width: 100%; float: left; white-space: nowrap; overflow: hidden;} -.kanban-card .header .executionName .title {padding-right: 0px; margin-right: 5px; white-space: nowrap; overflow: hidden;} -.kanban-card .header .executionName .title .icon {padding-right: 5px;} +.kanban-card .header .executionName .title, .releaseTitle {padding-right: 0px; margin-right: 5px; white-space: nowrap; overflow: hidden;} .kanban-card .header .executionName > span {flex: none;} -.execInfo {margin-top: 23px;} +.execInfo, .releaseInfo {margin-top: 23px;} .execInfo .execStatus{margin-right: 20px;} -.execInfo .label-wait {background: #EFEFEF !important; color: #838A9D;} -.execInfo .label-doing {background: #f8d2d2 !important; color: #e64b4c;} -.execInfo .label-suspended {background: #fff3d9 !important; color: #ff9800;} -.execInfo .label-closed {background: #e5e5e5 !important; color: #b8b8b8;} -.execInfo .label-deleted {background: #ff5d5d !important; color: #fff;} -.region .kanban-item > .kanban-card > .execInfo > .user {position: absolute; right: 10px; bottom: -2px} -.region .kanban-item > .kanban-card > .execInfo > .user > .avatar {display: inline-block; width: 24px; height: 24px; line-height: 24px; margin-right: 0px; margin-left: 2px} +.label-wait {background: #EFEFEF !important; color: #838A9D;} +.label-doing {background: #f8d2d2 !important; color: #e64b4c;} +.label-suspended {background: #fff3d9 !important; color: #ff9800;} +.label-closed, .label-terminate {background: #e5e5e5 !important; color: #b8b8b8;} +.label-deleted {background: #ff5d5d !important; color: #fff;} +.label-normal {background: #e1e8d9 !important; color: #9abe76;} +.region .kanban-item > .kanban-card > .execInfo > .user, .region .kanban-item > .kanban-card > .releaseInfo > .user {position: absolute; right: 10px; bottom: -2px} +.region .kanban-item > .kanban-card > .execInfo > .user > .avatar, .region .kanban-item > .kanban-card > .releaseInfo > .user > .avatar {display: inline-block; width: 24px; height: 24px; line-height: 24px; margin-right: 0px; margin-left: 2px} +.kanban-card .releaseTitle .icon, .kanban-card .title .icon {padding-right: 5px;} +.kanban-card .releaseTitle {width: 100%; float: left;} diff --git a/module/kanban/js/view.js b/module/kanban/js/view.js index 8136b47aa2..86ce2ccf53 100644 --- a/module/kanban/js/view.js +++ b/module/kanban/js/view.js @@ -280,6 +280,10 @@ function renderKanbanItem(item, $item) { renderExecutionItem(item, $item); } + else if(item.fromType == 'release') + { + renderReleaseItem(item, $item); + } else { var $title = $item.children('.title'); @@ -457,9 +461,72 @@ function renderExecutionItem(item, $item) /* Display avatars of PM. */ var $user = $info.children('.user'); var user = [item.PM]; - if(!$user.length) $user = $('
').appendTo($info); + if(users[item.PM]) + { + if(!$user.length) $user = $('
').appendTo($info); + $user.html(renderUsersAvatar(user, item.id)).attr('title', users[item.PM]); + } +} - $user.html(renderUsersAvatar(user, item.id)).attr('title', item.PM); +/** + * Render plan item. + * + * @param object item + * @param object $item + * @access public + * @return void + */ +function renderReleaseItem(item, $item) +{ + var privs = item.actions; + + /* Print name. */ + var $title = $item.children('.releaseTitle'); + if(!$title.length) + { + if(privs.includes('viewRelease') && item.deleted == '0') $title = $('' + item.name + '').appendTo($item).attr('href', createLink('release', 'view', 'releaseID=' + item.fromID)); + if(!privs.includes('viewRelease') || item.deleted == '1') $title = $('' + item.name + '').appendTo($item); + } + $title.attr('title', item.name); + + var $info = $item.children('.releaseInfo'); + if(!$info.length) $info = $( + [ + '
', + '
' + ].join('')).appendTo($item); + + var $statusBox = $info.children('.releaseStatus'); + if(!$statusBox.length) + { + if(item.deleted == '0') + { + $statusBox = $('' + releaseLang.statusList[item.status] + '').appendTo($info); + } + else + { + $statusBox = $('' + releaseLang.deleted + '').appendTo($info); + } + } + + /* Display release date. */ + var $date = $info.children('.date'); + var releaseDate = $.zui.createDate(item.date); + var today = new Date(); + var labelType = releaseDate.toLocaleDateString() == today.toLocaleDateString() ? 'light' : 'wait'; + if(!$date.length) $date = $('').appendTo($info); + + $date.text($.zui.formatDate(releaseDate, 'yyyy-MM-dd')).attr('title', $.zui.formatDate(releaseDate, 'yyyy-MM-dd')).show(); + if(labelType == 'light') $date.css('background-color', 'rgba(210, 50, 61, 0.3)'); + + /* Display avatars of creator. */ + var $user = $info.children('.user'); + var user = [item.createdBy]; + if(users[item.createdBy]) + { + if(!$user.length) $user = $('
').appendTo($info); + $user.html(renderUsersAvatar(user, item.id)).attr('title', users[item.createdBy]); + } } /** diff --git a/module/kanban/view/view.html.php b/module/kanban/view/view.html.php index a63744238e..12e47ee495 100644 --- a/module/kanban/view/view.html.php +++ b/module/kanban/view/view.html.php @@ -15,6 +15,7 @@ loadLang('execution'); +$app->loadLang('release'); $laneCount = 0; foreach($regions as $region) $laneCount += $region->laneCount; @@ -25,6 +26,7 @@ js::set('kanbanlaneLang', $lang->kanbanlane); js::set('kanbancolumnLang', $lang->kanbancolumn); js::set('kanbancardLang', $lang->kanbancard); js::set('executionLang', $lang->execution); +js::set('releaseLang', $lang->release); js::set('kanbanID', $kanban->id); js::set('laneCount', $laneCount); js::set('userList', $userList);