Move board collapse/expand mode to server side to avoid board flickering
This commit is contained in:
@@ -310,4 +310,28 @@ class Board extends Base
|
||||
'recurrence_basedate_list' => $this->task->getRecurrenceBasedateList(),
|
||||
)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable collapsed mode
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function collapse()
|
||||
{
|
||||
$project_id = $this->request->getIntegerParam('project_id');
|
||||
$this->userSession->setBoardDisplayMode($project_id, true);
|
||||
$this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $project_id)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable expanded mode
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function expand()
|
||||
{
|
||||
$project_id = $this->request->getIntegerParam('project_id');
|
||||
$this->userSession->setBoardDisplayMode($project_id, false);
|
||||
$this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $project_id)));
|
||||
}
|
||||
}
|
||||
|
||||
24
app/Helper/Board.php
Normal file
24
app/Helper/Board.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Helper;
|
||||
|
||||
/**
|
||||
* Board Helper
|
||||
*
|
||||
* @package helper
|
||||
* @author Frederic Guillot
|
||||
*/
|
||||
class Board extends \Core\Base
|
||||
{
|
||||
/**
|
||||
* Return true if tasks are collapsed
|
||||
*
|
||||
* @access public
|
||||
* @param integer $project_id
|
||||
* @return boolean
|
||||
*/
|
||||
public function isCollapsed($project_id)
|
||||
{
|
||||
return $this->userSession->isBoardCollapsed($project_id);
|
||||
}
|
||||
}
|
||||
@@ -118,4 +118,28 @@ class UserSession extends Base
|
||||
{
|
||||
$_SESSION['filters'][$project_id] = $filters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is board collapsed or expanded
|
||||
*
|
||||
* @access public
|
||||
* @param integer $project_id
|
||||
* @return boolean
|
||||
*/
|
||||
public function isBoardCollapsed($project_id)
|
||||
{
|
||||
return ! empty($_SESSION['board_collapsed'][$project_id]) ? $_SESSION['board_collapsed'][$project_id] : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set board display mode
|
||||
*
|
||||
* @access public
|
||||
* @param integer $project_id
|
||||
* @param boolean $collapsed
|
||||
*/
|
||||
public function setBoardDisplayMode($project_id, $collapsed)
|
||||
{
|
||||
$_SESSION['board_collapsed'][$project_id] = $collapsed;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,53 +10,55 @@
|
||||
|
||||
<?= $this->render('board/task_menu', array('task' => $task)) ?>
|
||||
|
||||
<div class="task-board-collapsed" style="display: none">
|
||||
<?php if (! empty($task['assignee_username'])): ?>
|
||||
<span title="<?= $this->e($task['assignee_name'] ?: $task['assignee_username']) ?>">
|
||||
<?= $this->e($this->user->getInitials($task['assignee_name'] ?: $task['assignee_username'])) ?>
|
||||
</span> -
|
||||
<?php endif ?>
|
||||
<span class="tooltip" title="<?= $this->e($task['title']) ?>"
|
||||
<?= $this->url->link($this->e($task['title']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-board-collapsed-title') ?>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="task-board-expanded">
|
||||
|
||||
<?php if ($task['reference']): ?>
|
||||
<span class="task-board-reference" title="<?= t('Reference') ?>">
|
||||
(<?= $task['reference'] ?>)
|
||||
</span>
|
||||
<?php endif ?>
|
||||
|
||||
<span class="task-board-user <?= $this->user->isCurrentUser($task['owner_id']) ? 'task-board-current-user' : '' ?>">
|
||||
<?= $this->url->link(
|
||||
(! empty($task['owner_id']) ? ($task['assignee_name'] ?: $task['assignee_username']) : t('Nobody assigned')),
|
||||
'board',
|
||||
'changeAssignee',
|
||||
array('task_id' => $task['id'], 'project_id' => $task['project_id']),
|
||||
false,
|
||||
'task-board-popover',
|
||||
t('Change assignee')
|
||||
) ?>
|
||||
</span>
|
||||
|
||||
<?php if ($task['is_active'] == 1): ?>
|
||||
<div class="task-board-days">
|
||||
<span title="<?= t('Task age in days')?>" class="task-days-age"><?= $this->dt->age($task['date_creation']) ?></span>
|
||||
<span title="<?= t('Days in this column')?>" class="task-days-incolumn"><?= $this->dt->age($task['date_moved']) ?></span>
|
||||
<?php if ($this->board->isCollapsed($project['id'])): ?>
|
||||
<div class="task-board-collapsed">
|
||||
<?php if (! empty($task['assignee_username'])): ?>
|
||||
<span title="<?= $this->e($task['assignee_name'] ?: $task['assignee_username']) ?>">
|
||||
<?= $this->e($this->user->getInitials($task['assignee_name'] ?: $task['assignee_username'])) ?>
|
||||
</span> -
|
||||
<?php endif ?>
|
||||
<span class="tooltip" title="<?= $this->e($task['title']) ?>"
|
||||
<?= $this->url->link($this->e($task['title']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-board-collapsed-title') ?>
|
||||
</span>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="task-board-closed"><i class="fa fa-ban fa-fw"></i><?= t('Closed') ?></div>
|
||||
<?php endif ?>
|
||||
<?php else: ?>
|
||||
<div class="task-board-expanded">
|
||||
|
||||
<div class="task-board-title">
|
||||
<?= $this->url->link($this->e($task['title']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', t('View this task')) ?>
|
||||
<?php if ($task['reference']): ?>
|
||||
<span class="task-board-reference" title="<?= t('Reference') ?>">
|
||||
(<?= $task['reference'] ?>)
|
||||
</span>
|
||||
<?php endif ?>
|
||||
|
||||
<span class="task-board-user <?= $this->user->isCurrentUser($task['owner_id']) ? 'task-board-current-user' : '' ?>">
|
||||
<?= $this->url->link(
|
||||
(! empty($task['owner_id']) ? ($task['assignee_name'] ?: $task['assignee_username']) : t('Nobody assigned')),
|
||||
'board',
|
||||
'changeAssignee',
|
||||
array('task_id' => $task['id'], 'project_id' => $task['project_id']),
|
||||
false,
|
||||
'task-board-popover',
|
||||
t('Change assignee')
|
||||
) ?>
|
||||
</span>
|
||||
|
||||
<?php if ($task['is_active'] == 1): ?>
|
||||
<div class="task-board-days">
|
||||
<span title="<?= t('Task age in days')?>" class="task-days-age"><?= $this->dt->age($task['date_creation']) ?></span>
|
||||
<span title="<?= t('Days in this column')?>" class="task-days-incolumn"><?= $this->dt->age($task['date_moved']) ?></span>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="task-board-closed"><i class="fa fa-ban fa-fw"></i><?= t('Closed') ?></div>
|
||||
<?php endif ?>
|
||||
|
||||
<div class="task-board-title">
|
||||
<?= $this->url->link($this->e($task['title']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', t('View this task')) ?>
|
||||
</div>
|
||||
|
||||
<?= $this->render('board/task_footer', array(
|
||||
'task' => $task,
|
||||
'not_editable' => $not_editable,
|
||||
)) ?>
|
||||
</div>
|
||||
|
||||
<?= $this->render('board/task_footer', array(
|
||||
'task' => $task,
|
||||
'not_editable' => $not_editable,
|
||||
)) ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
<ul>
|
||||
<?php if (isset($board_selector) && ! empty($board_selector)): ?>
|
||||
<li>
|
||||
<select id="board-selector" tabindex=="-1" data-notfound="<?= t('No results match:') ?>" data-placeholder="<?= t('Display another project') ?>" data-board-url="<?= $this->url->href('board', 'show', array('project_id' => 'PROJECT_ID')) ?>">
|
||||
<select id="board-selector" tabindex="-1" data-notfound="<?= t('No results match:') ?>" data-placeholder="<?= t('Display another project') ?>" data-board-url="<?= $this->url->href('board', 'show', array('project_id' => 'PROJECT_ID')) ?>">
|
||||
<option value=""></option>
|
||||
<?php foreach($board_selector as $board_id => $board_name): ?>
|
||||
<option value="<?= $board_id ?>"><?= $this->e($board_name) ?></option>
|
||||
|
||||
@@ -5,12 +5,13 @@
|
||||
<ul>
|
||||
<?php if (isset($is_board)): ?>
|
||||
<li>
|
||||
<span class="filter-collapse">
|
||||
<i class="fa fa-compress fa-fw"></i> <a href="#" class="filter-collapse-link" title="<?= t('Keyboard shortcut: "%s"', 's') ?>"><?= t('Collapse tasks') ?></a>
|
||||
</span>
|
||||
<span class="filter-expand" style="display: none">
|
||||
<i class="fa fa-expand fa-fw"></i> <a href="#" class="filter-expand-link" title="<?= t('Keyboard shortcut: "%s"', 's') ?>"><?= t('Expand tasks') ?></a>
|
||||
</span>
|
||||
<?php if ($this->board->isCollapsed($project['id'])): ?>
|
||||
<i class="fa fa-expand fa-fw"></i>
|
||||
<?= $this->url->link(t('Expand tasks'), 'board', 'expand', array('project_id' => $project['id']), false, 'board-display-mode', t('Keyboard shortcut: "%s"', 's')) ?>
|
||||
<?php else: ?>
|
||||
<i class="fa fa-compress fa-fw"></i>
|
||||
<?= $this->url->link(t('Collapse tasks'), 'board', 'collapse', array('project_id' => $project['id']), false, 'board-display-mode', t('Keyboard shortcut: "%s"', 's')) ?>
|
||||
<?php endif ?>
|
||||
</li>
|
||||
<li>
|
||||
<span class="filter-compact">
|
||||
|
||||
Reference in New Issue
Block a user