Store board collapsed mode user preference in the database

This commit is contained in:
Frederic Guillot
2016-08-22 21:20:48 -04:00
parent 1d16a53c48
commit 51fef80f7d
6 changed files with 9 additions and 41 deletions

View File

@@ -4,6 +4,7 @@ namespace Kanboard\Controller;
use Kanboard\Core\Controller\AccessForbiddenException;
use Kanboard\Formatter\BoardFormatter;
use Kanboard\Model\UserMetadataModel;
/**
* Class BoardAjaxController
@@ -88,7 +89,7 @@ class BoardAjaxController extends BaseController
*/
public function collapse()
{
$this->changeDisplayMode(true);
$this->changeDisplayMode(1);
}
/**
@@ -98,19 +99,19 @@ class BoardAjaxController extends BaseController
*/
public function expand()
{
$this->changeDisplayMode(false);
$this->changeDisplayMode(0);
}
/**
* Change display mode
*
* @access private
* @param boolean $mode
* @param int $mode
*/
private function changeDisplayMode($mode)
{
$project_id = $this->request->getIntegerParam('project_id');
$this->userSession->setBoardDisplayMode($project_id, $mode);
$this->userMetadataCacheDecorator->set(UserMetadataModel::KEY_BOARD_COLLAPSED.$project_id, $mode);
if ($this->request->isAjax()) {
$this->response->html($this->renderBoard($project_id));