* Refactort the recent project block.

This commit is contained in:
daitingting
2023-07-05 03:10:07 +00:00
parent a94385bd26
commit 27e6a17196
7 changed files with 127 additions and 38 deletions
@@ -0,0 +1,9 @@
.cards .project-stages-container {margin: 0 0 -16px 0; padding: 0 4px; height: 40px; overflow-x: auto; position: relative;}
.cards .project-stages:after {content: ' '; width: 30px; display: block; right: -5px; top: 16px; bottom: -5px; z-index: 1; background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%); position: absolute;}
.cards .project-stages-row {position: relative; height: 30px; z-index: 0;}
.cards .project-stage-item {white-space: nowrap; position: absolute; top: 0; min-width: 48px; padding-top: 13px; color: #838A9D;}
.cards .project-stage-item > div {max-width: 70px; white-space: nowrap; overflow: hidden; text-align: center; text-overflow: ellipsis;}
.cards .project-stage-item:before {content: ' '; display: block; width: 8px; height: 8px; border-radius: 50%; background: #D1D1D1; position: absolute; left: 50%; margin-left: -4px; top: 0; z-index: 1;}
.cards .project-stage-item + .project-stage-item:after {content: ' '; display: block; left: -50%; right: 50%; height: 2px; background-color: #D1D1D1; top: 3px; position: absolute; z-index: 0;}
.cards .project-stage-item.is-going {color: #333;}
.cards .project-stage-item.is-going::before {background-color: #0C64EB;}
+16
View File
@@ -0,0 +1,16 @@
$(function()
{
$('.recentproject-block .cards .project-stages-container').each(function()
{
var $container = $(this);
var $row = $container.children();
var totalWidth = 0;
$row.children().each(function()
{
var $item = $(this);
$item.css('left', totalWidth);
totalWidth += $item.width();
});
$row.css('minWidth', totalWidth);
});
})
+7 -5
View File
@@ -101,11 +101,13 @@ $lang->block->cannotPlaceInLeft = 'Kann den Block nicht auf der linken Seite pl
$lang->block->cannotPlaceInRight = 'Kann den Block nicht auf der rechten Seite platzieren.';
$lang->block->tutorial = 'Enter the tutorial';
$lang->block->productName = $lang->productCommon . ' Name';
$lang->block->totalStory = 'Total Story';
$lang->block->totalBug = 'Total Bug';
$lang->block->totalRelease = 'Release The Number';
$lang->block->totalTask = 'The Total ' . $lang->task->common;
$lang->block->productName = $lang->productCommon . ' Name';
$lang->block->totalStory = 'Total Story';
$lang->block->totalBug = 'Total Bug';
$lang->block->totalRelease = 'Release The Number';
$lang->block->totalTask = 'The Total ' . $lang->task->common;
$lang->block->projectMember = 'Team Member';
$lang->block->totalMember = '%s members in total';
$lang->block->totalInvestment = 'Have Invested';
$lang->block->totalPeople = 'Total';
+7 -5
View File
@@ -101,11 +101,13 @@ $lang->block->cannotPlaceInLeft = 'Cannot place the block at left side.';
$lang->block->cannotPlaceInRight = 'Cannot place the block at right side.';
$lang->block->tutorial = 'Enter the tutorial';
$lang->block->productName = $lang->productCommon . ' Name';
$lang->block->totalStory = 'Total Story';
$lang->block->totalBug = 'Total Bug';
$lang->block->totalRelease = 'Release The Number';
$lang->block->totalTask = 'The Total ' . $lang->task->common;
$lang->block->productName = $lang->productCommon . ' Name';
$lang->block->totalStory = 'Total Story';
$lang->block->totalBug = 'Total Bug';
$lang->block->totalRelease = 'Release The Number';
$lang->block->totalTask = 'The Total ' . $lang->task->common;
$lang->block->projectMember = 'Team Member';
$lang->block->totalMember = '%s members in total';
$lang->block->totalInvestment = 'Have Invested';
$lang->block->totalPeople = 'Total';
+7 -5
View File
@@ -101,11 +101,13 @@ $lang->block->cannotPlaceInLeft = 'Impossible de placer le bloc à gauche.';
$lang->block->cannotPlaceInRight = 'Impossible de placer le bloc à droite.';
$lang->block->tutorial = 'Enter the tutorial';
$lang->block->productName = $lang->productCommon . ' Name';
$lang->block->totalStory = 'Total Story';
$lang->block->totalBug = 'Total Bug';
$lang->block->totalRelease = 'Release The Number';
$lang->block->totalTask = 'The Total ' . $lang->task->common;
$lang->block->productName = $lang->productCommon . ' Name';
$lang->block->totalStory = 'Total Story';
$lang->block->totalBug = 'Total Bug';
$lang->block->totalRelease = 'Release The Number';
$lang->block->totalTask = 'The Total ' . $lang->task->common;
$lang->block->projectMember = 'Team Member';
$lang->block->totalMember = '%s members in total';
$lang->block->totalInvestment = 'Have Invested';
$lang->block->totalPeople = 'Total';
+7 -5
View File
@@ -101,11 +101,13 @@ $lang->block->cannotPlaceInLeft = '此区块无法放置在左侧。';
$lang->block->cannotPlaceInRight = '此区块无法放置在右侧。';
$lang->block->tutorial = '进入新手教程';
$lang->block->productName = $lang->productCommon . '名称';
$lang->block->totalStory = '总' . $lang->SRCommon;
$lang->block->totalBug = '总Bug';
$lang->block->totalRelease = '发布次数';
$lang->block->totalTask = '总' . $lang->task->common;
$lang->block->productName = $lang->productCommon . '名称';
$lang->block->totalStory = '总' . $lang->SRCommon;
$lang->block->totalBug = '总Bug';
$lang->block->totalRelease = '发布次数';
$lang->block->totalTask = '总' . $lang->task->common;
$lang->block->projectMember = '团队成员';
$lang->block->totalMember = '共 %s 人';
$lang->block->totalInvestment = '已投入';
$lang->block->totalPeople = '总人数';
+74 -18
View File
@@ -15,10 +15,34 @@ $cards = array();
foreach($projects as $projectID => $project)
{
$viewLink = $this->createLink('project', 'index', "projectID=$project->id");
if($project->model == 'waterfall')
{
$stages = array();
foreach($project->executions as $stage)
{
if($stage->grade == 1) $stages[] = $stage;
}
$stageItems = array();
foreach($stages as $stage)
{
$stageItems[] = div
(
set::class("project-stage-item is-{$stage->status}" . ($stage->status != 'wait' ? ' is-going' : '')),
div($stage->name)
);
}
}
else
{
$execution = empty($project->executions) ? '' : end($project->executions);
}
$cards[] = cell
(
set('width', '32%'),
set('class', 'border p-4'),
set('width', $longBlock ? '32%' : '100%'),
set('class', 'border p-4' . ($longBlock ? '' : ' mb-2')),
div
(
set('class', 'pb-2'),
@@ -29,30 +53,69 @@ foreach($projects as $projectID => $project)
$project->name
)
),
div
$project->model == 'waterfall' && empty($stages) ? label
(
set('class', 'card-body'),
zget($lang->project->statusList, $project->status),
setClass('label-outline')
) : null,
$project->model == 'waterfall' && !empty($stages) ? p
(
set::class('text-gray'),
$lang->project->ongoingStage
) : null,
$project->model == 'waterfall' && !empty($stages) ? div
(
set::class('project-stages-container'),
div
(
set::class('project-stages-row'),
$stageItems,
)
) : null,
($project->model != 'waterfall' && $project->multiple && $execution) ? div
(
set('class', 'card-body py-1.5'),
div
(
set('class', 'py-1.5'),
span('近期执行 : '),
a(set('href', ''), '执行名称'),
span
(
set('class', 'text-gray'),
$execution->type == 'kanban' ? $lang->project->lastKanban : $lang->project->lastIteration . ' : '
),
a(
set('href', createLink('execution', 'task', "executionID={$execution->id}")),
$execution->name
),
label
(
set('class', 'warning-pale circle ml-2'),
'进行中'
$lang->execution->statusList[$execution->status]
)
),
div
(
set('class', 'py-1.5'),
span('项目成员 : 共 5 人')
span
(
set('class', 'text-gray'),
$lang->block->projectMember . ' : ',
),
sprintf($lang->block->totalMember, $project->teamCount)
),
div
(
set('class', 'py-1.5'),
span('计划完成 : 2022-09-30')
span
(
set('class', 'text-gray'),
$lang->project->end . ' : '
),
$project->end
)
) : div
(
set::class('card-body'),
)
);
}
@@ -61,17 +124,10 @@ panel
(
set('class', 'recentproject-block'),
set('headingClass', 'border-b'),
to::heading
(
div
(
set('class', 'panel-title'),
$lang->block->titleList['recentproject']
)
),
set::title($lang->block->titleList['recentproject']),
div
(
set('class', 'flex cards justify-between'),
set('class', 'flex flex-wrap cards justify-between'),
$cards
)
);