Redesign task list view

This commit is contained in:
Frederic Guillot 2017-02-19 17:08:00 -05:00
parent dc7c7667ec
commit 3b3e803369
22 changed files with 379 additions and 130 deletions

View File

@ -10,6 +10,7 @@ New features:
Improvements:
* Redesign task list view
* Allow people to remove missing automatic actions (installed from a removed plugins)
* Improve task view tables
* Simplify automatic actions table

View File

@ -35,7 +35,7 @@ class TaskListController extends BaseController
)
->calculate();
$this->response->html($this->helper->layout->app('task_list/show', array(
$this->response->html($this->helper->layout->app('task_list/listing', array(
'project' => $project,
'title' => $project['name'],
'description' => $this->helper->projectHeader->getDescription($project),

View File

@ -218,11 +218,12 @@ class ColorModel extends Base
$buffer = '';
foreach ($this->default_colors as $color => $values) {
$buffer .= 'div.color-'.$color.' {';
$buffer .= '.task-board.color-'.$color.', .task-summary-container.color-'.$color.', .color-picker-square.color-'.$color.' {';
$buffer .= 'background-color: '.$values['background'].';';
$buffer .= 'border-color: '.$values['border'];
$buffer .= '}';
$buffer .= 'td.color-'.$color.' { background-color: '.$values['background'].'}';
$buffer .= '.task-list-row.color-'.$color.' {border-left: 5px solid '.$values['border'].'}';
}
return $buffer;

View File

@ -57,11 +57,11 @@
<?php endif ?>
<?php if (! empty($task['date_due'])): ?>
<span class="task-board-date
<span class="task-date
<?php if (date('Y-m-d') == date('Y-m-d', $task['date_due'])): ?>
task-board-date-today
task-date-today
<?php elseif (time() > $task['date_due']): ?>
task-board-date-overdue
task-date-overdue
<?php endif ?>
">
<i class="fa fa-calendar"></i>
@ -117,9 +117,9 @@
<?php endif ?>
<?php if ($task['is_active'] == 1): ?>
<div class="task-board-age">
<span title="<?= t('Task age in days')?>" class="task-board-age-total"><?= $this->dt->age($task['date_creation']) ?></span>
<span title="<?= t('Days in this column')?>" class="task-board-age-column"><?= $this->dt->age($task['date_moved']) ?></span>
<div class="task-icon-age">
<span title="<?= t('Task age in days')?>" class="task-icon-age-total"><?= $this->dt->age($task['date_creation']) ?></span>
<span title="<?= t('Days in this column')?>" class="task-icon-age-column"><?= $this->dt->age($task['date_moved']) ?></span>
</div>
<?php else: ?>
<span class="task-board-closed"><i class="fa fa-ban fa-fw"></i><?= t('Closed') ?></span>

View File

@ -32,6 +32,7 @@
</div>
<?php else: ?>
<div class="task-board-expanded">
<div class="task-board-saving-icon" style="display: none;"><i class="fa fa-spinner fa-pulse fa-2x"></i></div>
<div class="task-board-header">
<?php if ($this->user->hasProjectAccess('TaskModificationController', 'edit', $task['project_id'])): ?>
<?= $this->render('task/dropdown', array('task' => $task)) ?>
@ -54,8 +55,6 @@
</div>
<?= $this->hook->render('template:board:private:task:after-title', array('task' => $task)) ?>
<div class="task-board-saving-icon" style="display: none;"><i class="fa fa-spinner fa-pulse fa-2x"></i></div>
<?= $this->render('board/task_footer', array(
'task' => $task,
'not_editable' => $not_editable,

View File

@ -0,0 +1,35 @@
<section id="main">
<?= $this->projectHeader->render($project, 'TaskListController', 'show') ?>
<?php if ($paginator->isEmpty()): ?>
<p class="alert"><?= t('No tasks found.') ?></p>
<?php elseif (! $paginator->isEmpty()): ?>
<div class="task-list">
<div class="task-list-header">
<?= $this->render('task_list/sort_menu', array('paginator' => $paginator)) ?>
</div>
<?php foreach ($paginator->getCollection() as $task): ?>
<div class="task-list-row color-<?= $task['color_id'] ?>">
<?= $this->render('task_list/task_title', array(
'task' => $task,
)) ?>
<?= $this->render('task_list/task_details', array(
'task' => $task,
)) ?>
<?= $this->render('task_list/task_avatars', array(
'task' => $task,
)) ?>
<?= $this->render('task_list/task_icons', array(
'project' => $project,
'task' => $task,
)) ?>
</div>
<?php endforeach ?>
</div>
<?= $paginator ?>
<?php endif ?>
</section>

View File

@ -1,66 +0,0 @@
<section id="main">
<?= $this->projectHeader->render($project, 'TaskListController', 'show') ?>
<?php if ($paginator->isEmpty()): ?>
<p class="alert"><?= t('No tasks found.') ?></p>
<?php elseif (! $paginator->isEmpty()): ?>
<table class="table-striped table-scrolling table-small">
<tr>
<th class="column-5"><?= $paginator->order(t('Id'), 'tasks.id') ?></th>
<th class="column-10"><?= $paginator->order(t('Swimlane'), 'tasks.swimlane_id') ?></th>
<th class="column-10"><?= $paginator->order(t('Column'), 'tasks.column_id') ?></th>
<th class="column-10"><?= $paginator->order(t('Category'), 'tasks.category_id') ?></th>
<th class="column-6"><?= $paginator->order(t('Priority'), \Kanboard\Model\TaskModel::TABLE.'.priority') ?></th>
<th><?= $paginator->order(t('Title'), 'tasks.title') ?></th>
<th class="column-10"><?= $paginator->order(t('Assignee'), 'users.username') ?></th>
<th class="column-10"><?= $paginator->order(t('Due date'), 'tasks.date_due') ?></th>
<th class="column-5"><?= $paginator->order(t('Status'), 'tasks.is_active') ?></th>
</tr>
<?php foreach ($paginator->getCollection() as $task): ?>
<tr>
<td class="color-<?= $task['color_id'] ?>">
<?php if ($this->user->hasProjectAccess('TaskModificationController', 'edit', $task['project_id'])): ?>
<?= $this->render('task/dropdown', array('task' => $task)) ?>
<?php else: ?>
#<?= $task['id'] ?>
<?php endif ?>
</td>
<td>
<?= $this->text->e($task['swimlane_name']) ?>
</td>
<td>
<?= $this->text->e($task['column_name']) ?>
</td>
<td>
<?= $this->text->e($task['category_name']) ?>
</td>
<td>
P<?= $this->text->e($task['priority'])?>
</td>
<td>
<?= $this->url->link($this->text->e($task['title']), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', t('View this task')) ?>
</td>
<td>
<?php if ($task['assignee_username']): ?>
<?= $this->text->e($task['assignee_name'] ?: $task['assignee_username']) ?>
<?php else: ?>
<?= t('Unassigned') ?>
<?php endif ?>
</td>
<td>
<?= $this->dt->date($task['date_due']) ?>
</td>
<td>
<?php if ($task['is_active'] == \Kanboard\Model\TaskModel::STATUS_OPEN): ?>
<?= t('Open') ?>
<?php else: ?>
<?= t('Closed') ?>
<?php endif ?>
</td>
</tr>
<?php endforeach ?>
</table>
<?= $paginator ?>
<?php endif ?>
</section>

View File

@ -0,0 +1,32 @@
<div class="dropdown">
<a href="#" class="dropdown-menu dropdown-menu-link-icon"><strong><?= t('Sort') ?> <i class="fa fa-caret-down"></i></strong></a>
<ul>
<li>
<?= $paginator->order(t('Task ID'), \Kanboard\Model\TaskModel::TABLE.'.id') ?>
</li>
<li>
<?= $paginator->order(t('Swimlane'), 'swimlane_name') ?>
</li>
<li>
<?= $paginator->order(t('Column'), 'column_name') ?>
</li>
<li>
<?= $paginator->order(t('Category'), 'category_name') ?>
</li>
<li>
<?= $paginator->order(t('Priority'), \Kanboard\Model\TaskModel::TABLE.'.priority') ?>
</li>
<li>
<?= $paginator->order(t('Title'), \Kanboard\Model\TaskModel::TABLE.'.title') ?>
</li>
<li>
<?= $paginator->order(t('Assignee'), 'assignee_name') ?>
</li>
<li>
<?= $paginator->order(t('Due date'), \Kanboard\Model\TaskModel::TABLE.'.date_due') ?>
</li>
<li>
<?= $paginator->order(t('Status'), \Kanboard\Model\TaskModel::TABLE.'.is_active') ?>
</li>
</ul>
</div>

View File

@ -0,0 +1,20 @@
<?php if (! empty($task['owner_id'])): ?>
<div class="task-list-avatars">
<span
<?php if ($this->user->hasProjectAccess('TaskModificationController', 'edit', $task['project_id'])): ?>
class="task-board-change-assignee"
data-url="<?= $this->url->href('TaskModificationController', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>">
<?php else: ?>
class="task-board-assignee">
<?php endif ?>
<?= $this->avatar->small(
$task['owner_id'],
$task['assignee_username'],
$task['assignee_name'],
$task['assignee_email'],
$task['assignee_avatar_path'],
'avatar-inline'
) ?><span class="task-avatar-assignee"><?= $this->text->e($task['assignee_name'] ?: $task['assignee_username']) ?></span>
</span>
</div>
<?php endif ?>

View File

@ -0,0 +1,23 @@
<div class="task-list-details">
<?= $this->text->e($task['project_name']) ?> &gt;
<?= $this->text->e($task['swimlane_name']) ?> &gt;
<?= $this->text->e($task['column_name']) ?>
<?php if (! empty($task['category_id'])): ?>
<span class="task-list-category">
<?php if ($this->user->hasProjectAccess('TaskModificationController', 'edit', $task['project_id'])): ?>
<?= $this->url->link(
$this->text->e($task['category_name']),
'TaskModificationController',
'edit',
array('task_id' => $task['id'], 'project_id' => $task['project_id']),
false,
'js-modal-medium' . (! empty($task['category_description']) ? ' tooltip' : ''),
! empty($task['category_description']) ? $this->text->markdownAttribute($task['category_description']) : t('Change category')
) ?>
<?php else: ?>
<?= $this->text->e($task['category_name']) ?>
<?php endif ?>
</span>
<?php endif ?>
</div>

View File

@ -0,0 +1,94 @@
<div class="task-list-icons">
<?php if ($task['reference']): ?>
<span class="task-board-reference" title="<?= t('Reference') ?>">
<?= $this->text->e($task['reference']) ?>
</span>
<?php endif ?>
<?php if ($task['is_milestone'] == 1): ?>
<span title="<?= t('Milestone') ?>">
<i class="fa fa-flag flag-milestone"></i>
</span>
<?php endif ?>
<?php if ($task['score']): ?>
<span class="task-score" title="<?= t('Complexity') ?>">
<i class="fa fa-trophy"></i>
<?= $this->text->e($task['score']) ?>
</span>
<?php endif ?>
<?php if (! empty($task['time_estimated']) || ! empty($task['time_spent'])): ?>
<span class="task-time-estimated" title="<?= t('Time spent and estimated') ?>">
<?= $this->text->e($task['time_spent']) ?>/<?= $this->text->e($task['time_estimated']) ?>h
</span>
<?php endif ?>
<?php if (! empty($task['date_due'])): ?>
<span class="task-date
<?php if (date('Y-m-d') == date('Y-m-d', $task['date_due'])): ?>
task-date-today
<?php elseif (time() > $task['date_due']): ?>
task-date-overdue
<?php endif ?>
">
<i class="fa fa-calendar"></i>
<?= $this->dt->date($task['date_due']) ?>
</span>
<?php endif ?>
<?php if ($task['recurrence_status'] == \Kanboard\Model\TaskModel::RECURRING_STATUS_PENDING): ?>
<span title="<?= t('Recurrence') ?>" class="tooltip" data-href="<?= $this->url->href('BoardTooltipController', 'recurrence', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-refresh fa-rotate-90"></i></span>
<?php endif ?>
<?php if ($task['recurrence_status'] == \Kanboard\Model\TaskModel::RECURRING_STATUS_PROCESSED): ?>
<span title="<?= t('Recurrence') ?>" class="tooltip" data-href="<?= $this->url->href('BoardTooltipController', 'recurrence', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-refresh fa-rotate-90 fa-inverse"></i></span>
<?php endif ?>
<?php if (! empty($task['nb_links'])): ?>
<span title="<?= t('Links') ?>" class="tooltip" data-href="<?= $this->url->href('BoardTooltipController', 'tasklinks', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-code-fork fa-fw"></i><?= $task['nb_links'] ?></span>
<?php endif ?>
<?php if (! empty($task['nb_external_links'])): ?>
<span title="<?= t('External links') ?>" class="tooltip" data-href="<?= $this->url->href('BoardTooltipController', 'externallinks', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-external-link fa-fw"></i><?= $task['nb_external_links'] ?></span>
<?php endif ?>
<?php if (! empty($task['nb_subtasks'])): ?>
<span title="<?= t('Sub-Tasks') ?>" class="tooltip" data-href="<?= $this->url->href('BoardTooltipController', 'subtasks', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-bars"></i>&nbsp;<?= round($task['nb_completed_subtasks']/$task['nb_subtasks']*100, 0).'%' ?></span>
<?php endif ?>
<?php if (! empty($task['nb_files'])): ?>
<span title="<?= t('Attachments') ?>" class="tooltip" data-href="<?= $this->url->href('BoardTooltipController', 'attachments', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-paperclip"></i>&nbsp;<?= $task['nb_files'] ?></span>
<?php endif ?>
<?php if ($task['nb_comments'] > 0): ?>
<?php if ($this->user->hasProjectAccess('TaskModificationController', 'edit', $task['project_id'])): ?>
<?= $this->modal->medium(
'comments-o',
$task['nb_comments'],
'CommentListController',
'show',
array('task_id' => $task['id'], 'project_id' => $task['project_id']),
$task['nb_comments'] == 1 ? t('%d comment', $task['nb_comments']) : t('%d comments', $task['nb_comments'])
) ?>
<?php else: ?>
<span title="<?= $task['nb_comments'] == 1 ? t('%d comment', $task['nb_comments']) : t('%d comments', $task['nb_comments']) ?>"><i class="fa fa-comments-o"></i>&nbsp;<?= $task['nb_comments'] ?></span>
<?php endif ?>
<?php endif ?>
<?php if (! empty($task['description'])): ?>
<span title="<?= t('Description') ?>" class="tooltip" data-href="<?= $this->url->href('BoardTooltipController', 'description', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>">
<i class="fa fa-file-text-o"></i>
</span>
<?php endif ?>
<?php if ($task['is_active'] == 1): ?>
<div class="task-icon-age">
<span title="<?= t('Task age in days')?>" class="task-icon-age-total"><?= $this->dt->age($task['date_creation']) ?></span>
<span title="<?= t('Days in this column')?>" class="task-icon-age-column"><?= $this->dt->age($task['date_moved']) ?></span>
</div>
<?php else: ?>
<span class="task-board-closed"><i class="fa fa-ban fa-fw"></i><?= t('Closed') ?></span>
<?php endif ?>
<?= $this->task->formatPriority($project, $task) ?>
</div>

View File

@ -0,0 +1,11 @@
<div>
<?php if ($this->user->hasProjectAccess('TaskModificationController', 'edit', $task['project_id'])): ?>
<?= $this->render('task/dropdown', array('task' => $task)) ?>
<?php else: ?>
<strong><?= '#'.$task['id'] ?></strong>
<?php endif ?>
<span class="task-list-title <?= $task['is_active'] == 0 ? 'task-closed' : '' ?>">
<?= $this->url->link($this->text->e($task['title']), 'TaskViewController', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])) ?>
</span>
</div>

File diff suppressed because one or more lines are too long

View File

@ -1,15 +0,0 @@
@import variables
.task-board-category-container
text-align: right
margin-top: 8px
margin-bottom: 8px
.task-board-category
font-weight: 500
color: color('dark')
border: 1px solid #555
padding: 1px 2px 1px 2px
border-radius: 4px
&:hover
opacity: 0.6

View File

@ -1,22 +0,0 @@
@import variables
.task-board-icons
font-size: size('small')
margin-top: 7px
text-align: right
a
opacity: 0.5
span
opacity: 0.5
margin-left: 4px
a
&:hover
opacity: 1.0
font-weight: bold
.task-board-icons-row
line-height: 22px
.task-score
font-weight: bold
.flag-milestone
color: green

View File

@ -0,0 +1,28 @@
@import variables
.task-board-category-container
text-align: right
margin-top: 8px
margin-bottom: 8px
.task-board-category
border: 1px solid #555
a
&:hover
text-decoration: underline
.task-list-category
background: bg-color('light')
border: 1px solid #ccc
a
text-decoration: none
color: color('dark')
&:hover
color: link-color('primary')
.task-board-category, .task-list-category
font-size: size('compact')
font-weight: 500
color: color('dark')
padding: 1px 3px 1px 2px
border-radius: 3px

View File

@ -1,13 +1,13 @@
@import variables
.task-board-date
font-weight: bold
.task-date
font-weight: 500
color: color('dark')
span
&.task-board-date-today
&.task-date-today
opacity: 1.0
color: link-color('primary')
&.task-board-date-overdue
&.task-date-overdue
opacity: 1.0
color: color('error')

View File

@ -1,18 +1,22 @@
@import variables
.task-board-age
.task-icon-age
display: inline-block
span
&.task-board-age-total
border: #666 1px solid
&.task-icon-age-total
border: 1px solid #e5e5e5
padding: 1px 3px 1px 3px
border-top-left-radius: 3px
border-bottom-left-radius: 3px
&.task-board-age-column
border: #666 1px solid
&.task-icon-age-column
border: 1px solid #e5e5e5
border-left: none
margin-left: -5px
padding: 1px 3px 1px 3px
border-top-right-radius: 3px
border-bottom-right-radius: 3px
.task-board
span.task-icon-age-total, span.task-icon-age-column
border-color: #666

View File

@ -0,0 +1,43 @@
@import variables
.task-board-icons, .task-list-icons
font-size: size('small')
text-align: right
a
text-decoration: none
&:hover
color: link-color('hover')
i
color: link-color('hover')
.task-score
font-weight: bold
.flag-milestone
color: green
.task-board-icons
margin-top: 7px
a
opacity: 0.5
span
opacity: 0.5
margin-left: 4px
a
&:hover
opacity: 1.0
font-weight: bold
.task-board-icons-row
line-height: 22px
.task-list-icons
line-height: 22px
a, span, i
color: color('light')
opacity: 1.0
span
margin-left: 5px
@include sm-device
text-align: left

View File

@ -0,0 +1,61 @@
@import variables
.task-list
font-size: size('compact')
.task-list-header
background: bg-color('primary')
border: 1px solid #e5e5e5
border-radius: 5px 5px 0 0
line-height: 35px
padding-left: 3px
padding-right: 3px
text-align: right
.task-list-row
padding-left: 3px
padding-right: 3px
border-bottom: 1px solid #e5e5e5
border-right: 1px solid #e5e5e5
&:nth-child(odd)
background: bg-color('lighter')
&:last-child
border-radius: 0 0 5px 5px
&:hover
background: map-get($highlight-colors, 'background')
border-bottom: 1px solid map-get($highlight-colors, 'border')
border-right: 1px solid map-get($highlight-colors, 'border')
.task-list-title
font-weight: 500
&.task-closed
text-decoration: line-through
a
font-style: italic
a
color: color('primary')
text-decoration: none
&:hover, &:focus
text-decoration: underline
.task-list-details
color: color('light')
font-weight: 300
line-height: 30px
.task-list-avatars
display: inline-block
float: left
@include sm-device
float: none
display: block
.task-avatar-assignee
font-weight: 300
color: color('light')
&:hover
.task-avatar-assignee
font-weight: 400
color: color('dark')

View File

@ -33,11 +33,12 @@
@import board
@import task_board
@import task_board_saving_state
@import task_board_category
@import task_board_avatar
@import task_board_icons
@import task_board_age
@import task_board_date
@import task_icons
@import task_icon_age
@import task_category
@import task_date
@import task_list
@import task_tags
@import task_summary
@import task_form

View File

@ -5,7 +5,7 @@ require_once __DIR__.'/../Base.php';
use Kanboard\Model\ColorModel;
use Kanboard\Model\ConfigModel;
class ColorTest extends Base
class ColorModelTest extends Base
{
public function testFind()
{
@ -87,7 +87,6 @@ class ColorTest extends Base
$colorModel = new ColorModel($this->container);
$css = $colorModel->getCss();
$this->assertStringStartsWith('div.color-yellow {', $css);
$this->assertStringEndsWith('td.color-amber { background-color: #ffe082}', $css);
$this->assertStringStartsWith('.task-board.color-yellow', $css);
}
}