From 8d12e2fe736a72d6ad69807ac853a7e325c8cbf3 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 28 May 2016 14:05:57 -0400 Subject: Split board controller into multiple classes --- app/Api/BaseApi.php | 2 +- app/Controller/Board.php | 192 --------------------- app/Controller/BoardAjaxController.php | 140 +++++++++++++++ app/Controller/BoardPopoverController.php | 2 +- app/Controller/BoardViewController.php | 65 +++++++ app/Controller/TaskBulkController.php | 2 +- app/Controller/TaskCreationController.php | 2 +- app/Controller/TaskPopoverController.php | 4 +- app/Controller/TaskViewController.php | 2 +- app/Formatter/ProjectGanttFormatter.php | 2 +- app/ServiceProvider/AuthenticationProvider.php | 4 +- app/ServiceProvider/RouteProvider.php | 6 +- app/Template/board/table_container.php | 6 +- app/Template/board/task_private.php | 2 +- app/Template/board/view_private.php | 2 +- .../board_popover/close_all_tasks_column.php | 2 +- app/Template/dashboard/projects.php | 2 +- app/Template/dashboard/subtasks.php | 2 +- app/Template/dashboard/tasks.php | 2 +- app/Template/gantt/task_creation.php | 2 +- app/Template/header.php | 2 +- app/Template/notification/footer.php | 2 +- app/Template/project/dropdown.php | 2 +- app/Template/project_header/dropdown.php | 6 +- app/Template/project_header/views.php | 4 +- app/Template/project_list/show.php | 2 +- app/Template/project_overview/information.php | 2 +- app/Template/project_user_overview/roles.php | 2 +- app/Template/project_user_overview/tasks.php | 2 +- app/Template/project_view/share.php | 2 +- app/Template/project_view/show.php | 4 +- app/Template/search/results.php | 2 +- app/Template/task/details.php | 2 +- app/Template/task_bulk/show.php | 2 +- app/Template/task_creation/show.php | 2 +- app/Template/task_popover/change_assignee.php | 2 +- app/Template/task_popover/change_category.php | 2 +- tests/units/Helper/UserHelperTest.php | 22 +-- 38 files changed, 260 insertions(+), 247 deletions(-) delete mode 100644 app/Controller/Board.php create mode 100644 app/Controller/BoardAjaxController.php create mode 100644 app/Controller/BoardViewController.php diff --git a/app/Api/BaseApi.php b/app/Api/BaseApi.php index 5de7f527..b70356cf 100644 --- a/app/Api/BaseApi.php +++ b/app/Api/BaseApi.php @@ -97,7 +97,7 @@ abstract class BaseApi extends Base { if (! empty($project)) { $project['url'] = array( - 'board' => $this->helper->url->to('board', 'show', array('project_id' => $project['id']), '', true), + 'board' => $this->helper->url->to('BoardViewController', 'show', array('project_id' => $project['id']), '', true), 'calendar' => $this->helper->url->to('CalendarController', 'show', array('project_id' => $project['id']), '', true), 'list' => $this->helper->url->to('TaskListController', 'show', array('project_id' => $project['id']), '', true), ); diff --git a/app/Controller/Board.php b/app/Controller/Board.php deleted file mode 100644 index 0f6b3b14..00000000 --- a/app/Controller/Board.php +++ /dev/null @@ -1,192 +0,0 @@ -request->getStringParam('token'); - $project = $this->project->getByToken($token); - - // Token verification - if (empty($project)) { - throw AccessForbiddenException::getInstance()->withoutLayout(); - } - - // Display the board with a specific layout - $this->response->html($this->helper->layout->app('board/view_public', array( - 'project' => $project, - 'swimlanes' => $this->board->getBoard($project['id']), - 'title' => $project['name'], - 'description' => $project['description'], - 'no_layout' => true, - 'not_editable' => true, - 'board_public_refresh_interval' => $this->config->get('board_public_refresh_interval'), - 'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'), - 'board_highlight_period' => $this->config->get('board_highlight_period'), - ))); - } - - /** - * Show a board for a given project - * - * @access public - */ - public function show() - { - $project = $this->getProject(); - $search = $this->helper->projectHeader->getSearchQuery($project); - - $this->response->html($this->helper->layout->app('board/view_private', array( - 'project' => $project, - 'title' => $project['name'], - 'description' => $this->helper->projectHeader->getDescription($project), - 'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'), - 'board_highlight_period' => $this->config->get('board_highlight_period'), - 'swimlanes' => $this->taskLexer - ->build($search) - ->format(BoardFormatter::getInstance($this->container)->setProjectId($project['id'])) - ))); - } - - /** - * Save the board (Ajax request made by the drag and drop) - * - * @access public - */ - public function save() - { - $project_id = $this->request->getIntegerParam('project_id'); - - if (! $project_id || ! $this->request->isAjax()) { - throw new AccessForbiddenException(); - } - - $values = $this->request->getJson(); - - $result =$this->taskPosition->movePosition( - $project_id, - $values['task_id'], - $values['column_id'], - $values['position'], - $values['swimlane_id'] - ); - - if (! $result) { - $this->response->status(400); - } else { - $this->response->html($this->renderBoard($project_id), 201); - } - } - - /** - * Check if the board have been changed - * - * @access public - */ - public function check() - { - $project_id = $this->request->getIntegerParam('project_id'); - $timestamp = $this->request->getIntegerParam('timestamp'); - - if (! $project_id || ! $this->request->isAjax()) { - $this->response->status(403); - } elseif (! $this->project->isModifiedSince($project_id, $timestamp)) { - $this->response->status(304); - } else { - $this->response->html($this->renderBoard($project_id)); - } - } - - /** - * Reload the board with new filters - * - * @access public - */ - public function reload() - { - $project_id = $this->request->getIntegerParam('project_id'); - - if (! $project_id || ! $this->request->isAjax()) { - throw new AccessForbiddenException(); - } - - $values = $this->request->getJson(); - $this->userSession->setFilters($project_id, empty($values['search']) ? '' : $values['search']); - - $this->response->html($this->renderBoard($project_id)); - } - - /** - * Enable collapsed mode - * - * @access public - */ - public function collapse() - { - $this->changeDisplayMode(true); - } - - /** - * Enable expanded mode - * - * @access public - */ - public function expand() - { - $this->changeDisplayMode(false); - } - - /** - * Change display mode - * - * @access private - * @param boolean $mode - */ - private function changeDisplayMode($mode) - { - $project_id = $this->request->getIntegerParam('project_id'); - $this->userSession->setBoardDisplayMode($project_id, $mode); - - if ($this->request->isAjax()) { - $this->response->html($this->renderBoard($project_id)); - } else { - $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $project_id))); - } - } - - /** - * Render board - * - * @access private - * @param integer $project_id - * @return string - */ - private function renderBoard($project_id) - { - return $this->template->render('board/table_container', array( - 'project' => $this->project->getById($project_id), - 'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'), - 'board_highlight_period' => $this->config->get('board_highlight_period'), - 'swimlanes' => $this->taskLexer - ->build($this->userSession->getFilters($project_id)) - ->format(BoardFormatter::getInstance($this->container)->setProjectId($project_id)) - )); - } -} diff --git a/app/Controller/BoardAjaxController.php b/app/Controller/BoardAjaxController.php new file mode 100644 index 00000000..d4714699 --- /dev/null +++ b/app/Controller/BoardAjaxController.php @@ -0,0 +1,140 @@ +request->getIntegerParam('project_id'); + + if (! $project_id || ! $this->request->isAjax()) { + throw new AccessForbiddenException(); + } + + $values = $this->request->getJson(); + + $result =$this->taskPosition->movePosition( + $project_id, + $values['task_id'], + $values['column_id'], + $values['position'], + $values['swimlane_id'] + ); + + if (! $result) { + $this->response->status(400); + } else { + $this->response->html($this->renderBoard($project_id), 201); + } + } + + /** + * Check if the board have been changed + * + * @access public + */ + public function check() + { + $project_id = $this->request->getIntegerParam('project_id'); + $timestamp = $this->request->getIntegerParam('timestamp'); + + if (! $project_id || ! $this->request->isAjax()) { + throw new AccessForbiddenException(); + } elseif (! $this->project->isModifiedSince($project_id, $timestamp)) { + $this->response->status(304); + } else { + $this->response->html($this->renderBoard($project_id)); + } + } + + /** + * Reload the board with new filters + * + * @access public + */ + public function reload() + { + $project_id = $this->request->getIntegerParam('project_id'); + + if (! $project_id || ! $this->request->isAjax()) { + throw new AccessForbiddenException(); + } + + $values = $this->request->getJson(); + $this->userSession->setFilters($project_id, empty($values['search']) ? '' : $values['search']); + + $this->response->html($this->renderBoard($project_id)); + } + + /** + * Enable collapsed mode + * + * @access public + */ + public function collapse() + { + $this->changeDisplayMode(true); + } + + /** + * Enable expanded mode + * + * @access public + */ + public function expand() + { + $this->changeDisplayMode(false); + } + + /** + * Change display mode + * + * @access private + * @param boolean $mode + */ + private function changeDisplayMode($mode) + { + $project_id = $this->request->getIntegerParam('project_id'); + $this->userSession->setBoardDisplayMode($project_id, $mode); + + if ($this->request->isAjax()) { + $this->response->html($this->renderBoard($project_id)); + } else { + $this->response->redirect($this->helper->url->to('BoardViewController', 'show', array('project_id' => $project_id))); + } + } + + /** + * Render board + * + * @access protected + * @param integer $project_id + * @return string + */ + protected function renderBoard($project_id) + { + return $this->template->render('board/table_container', array( + 'project' => $this->project->getById($project_id), + 'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'), + 'board_highlight_period' => $this->config->get('board_highlight_period'), + 'swimlanes' => $this->taskLexer + ->build($this->userSession->getFilters($project_id)) + ->format(BoardFormatter::getInstance($this->container)->setProjectId($project_id)) + )); + } +} diff --git a/app/Controller/BoardPopoverController.php b/app/Controller/BoardPopoverController.php index b204af39..2c2e5dc6 100644 --- a/app/Controller/BoardPopoverController.php +++ b/app/Controller/BoardPopoverController.php @@ -42,6 +42,6 @@ class BoardPopoverController extends BaseController $this->taskStatus->closeTasksBySwimlaneAndColumn($values['swimlane_id'], $values['column_id']); $this->flash->success(t('All tasks of the column "%s" and the swimlane "%s" have been closed successfully.', $this->column->getColumnTitleById($values['column_id']), $this->swimlane->getNameById($values['swimlane_id']) ?: t($project['default_swimlane']))); - $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $project['id']))); + $this->response->redirect($this->helper->url->to('BoardViewController', 'show', array('project_id' => $project['id']))); } } diff --git a/app/Controller/BoardViewController.php b/app/Controller/BoardViewController.php new file mode 100644 index 00000000..3c96af73 --- /dev/null +++ b/app/Controller/BoardViewController.php @@ -0,0 +1,65 @@ +request->getStringParam('token'); + $project = $this->project->getByToken($token); + + if (empty($project)) { + throw AccessForbiddenException::getInstance()->withoutLayout(); + } + + $this->response->html($this->helper->layout->app('board/view_public', array( + 'project' => $project, + 'swimlanes' => $this->board->getBoard($project['id']), + 'title' => $project['name'], + 'description' => $project['description'], + 'no_layout' => true, + 'not_editable' => true, + 'board_public_refresh_interval' => $this->config->get('board_public_refresh_interval'), + 'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'), + 'board_highlight_period' => $this->config->get('board_highlight_period'), + ))); + } + + /** + * Show a board for a given project + * + * @access public + */ + public function show() + { + $project = $this->getProject(); + $search = $this->helper->projectHeader->getSearchQuery($project); + + $this->response->html($this->helper->layout->app('board/view_private', array( + 'project' => $project, + 'title' => $project['name'], + 'description' => $this->helper->projectHeader->getDescription($project), + 'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'), + 'board_highlight_period' => $this->config->get('board_highlight_period'), + 'swimlanes' => $this->taskLexer + ->build($search) + ->format(BoardFormatter::getInstance($this->container)->setProjectId($project['id'])) + ))); + } +} diff --git a/app/Controller/TaskBulkController.php b/app/Controller/TaskBulkController.php index c0214ea7..528ae7a3 100644 --- a/app/Controller/TaskBulkController.php +++ b/app/Controller/TaskBulkController.php @@ -50,7 +50,7 @@ class TaskBulkController extends BaseController if ($valid) { $this->createTasks($project, $values); $this->response->redirect($this->helper->url->to( - 'Board', + 'BoardViewController', 'show', array('project_id' => $project['id']), 'swimlane-'. $values['swimlane_id'] diff --git a/app/Controller/TaskCreationController.php b/app/Controller/TaskCreationController.php index 2a63ddcc..b7af6d87 100644 --- a/app/Controller/TaskCreationController.php +++ b/app/Controller/TaskCreationController.php @@ -82,6 +82,6 @@ class TaskCreationController extends BaseController )); } - return $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $project['id'])), true); + return $this->response->redirect($this->helper->url->to('BoardViewController', 'show', array('project_id' => $project['id'])), true); } } diff --git a/app/Controller/TaskPopoverController.php b/app/Controller/TaskPopoverController.php index 9bac2206..9916a5d1 100644 --- a/app/Controller/TaskPopoverController.php +++ b/app/Controller/TaskPopoverController.php @@ -44,7 +44,7 @@ class TaskPopoverController extends BaseController $this->flash->failure(t('Unable to update your task.')); } - $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $values['project_id'])), true); + $this->response->redirect($this->helper->url->to('BoardViewController', 'show', array('project_id' => $values['project_id'])), true); } /** @@ -81,7 +81,7 @@ class TaskPopoverController extends BaseController $this->flash->failure(t('Unable to update your task.')); } - $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $values['project_id'])), true); + $this->response->redirect($this->helper->url->to('BoardViewController', 'show', array('project_id' => $values['project_id'])), true); } /** diff --git a/app/Controller/TaskViewController.php b/app/Controller/TaskViewController.php index 833d42a4..6d3cc5c5 100644 --- a/app/Controller/TaskViewController.php +++ b/app/Controller/TaskViewController.php @@ -166,7 +166,7 @@ class TaskViewController extends BaseController $this->flash->failure(t('Unable to remove this task.')); } - return $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $task['project_id'])), true); + return $this->response->redirect($this->helper->url->to('BoardViewController', 'show', array('project_id' => $task['project_id'])), true); } return $this->response->html($this->template->render('task/remove', array( diff --git a/app/Formatter/ProjectGanttFormatter.php b/app/Formatter/ProjectGanttFormatter.php index 532e6822..6c533b8c 100644 --- a/app/Formatter/ProjectGanttFormatter.php +++ b/app/Formatter/ProjectGanttFormatter.php @@ -44,7 +44,7 @@ class ProjectGanttFormatter extends BaseFormatter implements FormatterInterface (int) date('j', $end), ), 'link' => $this->helper->url->href('ProjectViewController', 'show', array('project_id' => $project['id'])), - 'board_link' => $this->helper->url->href('board', 'show', array('project_id' => $project['id'])), + 'board_link' => $this->helper->url->href('BoardViewController', 'show', array('project_id' => $project['id'])), 'gantt_link' => $this->helper->url->href('gantt', 'project', array('project_id' => $project['id'])), 'color' => $color, 'not_defined' => empty($project['start_date']) || empty($project['end_date']), diff --git a/app/ServiceProvider/AuthenticationProvider.php b/app/ServiceProvider/AuthenticationProvider.php index 406cf1c2..609b0c9f 100644 --- a/app/ServiceProvider/AuthenticationProvider.php +++ b/app/ServiceProvider/AuthenticationProvider.php @@ -70,7 +70,7 @@ class AuthenticationProvider implements ServiceProviderInterface $acl->add('ProjectActionDuplicationController', '*', Role::PROJECT_MANAGER); $acl->add('ActionCreationController', '*', Role::PROJECT_MANAGER); $acl->add('AnalyticController', '*', Role::PROJECT_MANAGER); - $acl->add('Board', 'save', Role::PROJECT_MEMBER); + $acl->add('BoardAjaxController', 'save', Role::PROJECT_MEMBER); $acl->add('BoardPopoverController', '*', Role::PROJECT_MEMBER); $acl->add('TaskPopoverController', '*', Role::PROJECT_MEMBER); $acl->add('CalendarController', 'save', Role::PROJECT_MEMBER); @@ -124,7 +124,7 @@ class AuthenticationProvider implements ServiceProviderInterface $acl->add('CaptchaController', '*', Role::APP_PUBLIC); $acl->add('PasswordResetController', '*', Role::APP_PUBLIC); $acl->add('TaskViewController', 'readonly', Role::APP_PUBLIC); - $acl->add('Board', 'readonly', Role::APP_PUBLIC); + $acl->add('BoardViewController', 'readonly', Role::APP_PUBLIC); $acl->add('ICalendarController', '*', Role::APP_PUBLIC); $acl->add('FeedController', '*', Role::APP_PUBLIC); $acl->add('AvatarFileController', 'show', Role::APP_PUBLIC); diff --git a/app/ServiceProvider/RouteProvider.php b/app/ServiceProvider/RouteProvider.php index 0182fb39..f176e4c0 100644 --- a/app/ServiceProvider/RouteProvider.php +++ b/app/ServiceProvider/RouteProvider.php @@ -115,9 +115,9 @@ class RouteProvider implements ServiceProviderInterface $container['route']->addRoute('analytics/estimated-spent-time/:project_id', 'AnalyticController', 'compareHours'); // Board routes - $container['route']->addRoute('board/:project_id', 'board', 'show'); - $container['route']->addRoute('b/:project_id', 'board', 'show'); - $container['route']->addRoute('public/board/:token', 'board', 'readonly'); + $container['route']->addRoute('board/:project_id', 'BoardViewController', 'show'); + $container['route']->addRoute('b/:project_id', 'BoardViewController', 'show'); + $container['route']->addRoute('public/board/:token', 'BoardViewController', 'readonly'); // Calendar routes $container['route']->addRoute('calendar/:project_id', 'CalendarController', 'show'); diff --git a/app/Template/board/table_container.php b/app/Template/board/table_container.php index 82bbec93..a93e7001 100644 --- a/app/Template/board/table_container.php +++ b/app/Template/board/table_container.php @@ -10,9 +10,9 @@ class="board-project-" data-project-id="" data-check-interval="" - data-save-url="url->href('board', 'save', array('project_id' => $project['id'])) ?>" - data-reload-url="url->href('board', 'reload', array('project_id' => $project['id'])) ?>" - data-check-url="url->href('board', 'check', array('project_id' => $project['id'], 'timestamp' => time())) ?>" + data-save-url="url->href('BoardAjaxController', 'save', array('project_id' => $project['id'])) ?>" + data-reload-url="url->href('BoardAjaxController', 'reload', array('project_id' => $project['id'])) ?>" + data-check-url="url->href('BoardAjaxController', 'check', array('project_id' => $project['id'], 'timestamp' => time())) ?>" data-task-creation-url="url->href('TaskCreationController', 'show', array('project_id' => $project['id'])) ?>" > diff --git a/app/Template/board/task_private.php b/app/Template/board/task_private.php index e852c33c..94b396a6 100644 --- a/app/Template/board/task_private.php +++ b/app/Template/board/task_private.php @@ -1,6 +1,6 @@
- projectHeader->render($project, 'Board', 'show', true) ?> + projectHeader->render($project, 'BoardViewController', 'show', true) ?> render('board/table_container', array( 'project' => $project, diff --git a/app/Template/board_popover/close_all_tasks_column.php b/app/Template/board_popover/close_all_tasks_column.php index bd167786..57f703e3 100644 --- a/app/Template/board_popover/close_all_tasks_column.php +++ b/app/Template/board_popover/close_all_tasks_column.php @@ -12,7 +12,7 @@
- url->link(t('cancel'), 'board', 'show', array('project_id' => $project['id']), false, 'close-popover') ?> + url->link(t('cancel'), 'BoardViewController', 'show', array('project_id' => $project['id']), false, 'close-popover') ?>
diff --git a/app/Template/dashboard/projects.php b/app/Template/dashboard/projects.php index c5615230..4d33519a 100644 --- a/app/Template/dashboard/projects.php +++ b/app/Template/dashboard/projects.php @@ -29,7 +29,7 @@ url->link('', 'TaskListController', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('List')) ?>  url->link('', 'CalendarController', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Calendar')) ?>  - url->link($this->text->e($project['name']), 'board', 'show', array('project_id' => $project['id'])) ?> + url->link($this->text->e($project['name']), 'BoardViewController', 'show', array('project_id' => $project['id'])) ?> diff --git a/app/Template/dashboard/subtasks.php b/app/Template/dashboard/subtasks.php index 40e567b1..8e0aa3ce 100644 --- a/app/Template/dashboard/subtasks.php +++ b/app/Template/dashboard/subtasks.php @@ -18,7 +18,7 @@ render('task/dropdown', array('task' => array('id' => $subtask['task_id'], 'project_id' => $subtask['project_id']))) ?> - url->link($this->text->e($subtask['project_name']), 'board', 'show', array('project_id' => $subtask['project_id'])) ?> + url->link($this->text->e($subtask['project_name']), 'BoardViewController', 'show', array('project_id' => $subtask['project_id'])) ?> url->link($this->text->e($subtask['task_name']), 'TaskViewController', 'show', array('task_id' => $subtask['task_id'], 'project_id' => $subtask['project_id'])) ?> diff --git a/app/Template/dashboard/tasks.php b/app/Template/dashboard/tasks.php index cd245aa1..4b83a96a 100644 --- a/app/Template/dashboard/tasks.php +++ b/app/Template/dashboard/tasks.php @@ -20,7 +20,7 @@ render('task/dropdown', array('task' => $task)) ?> - url->link($this->text->e($task['project_name']), 'board', 'show', array('project_id' => $task['project_id'])) ?> + url->link($this->text->e($task['project_name']), 'BoardViewController', 'show', array('project_id' => $task['project_id'])) ?> url->link($this->text->e($task['title']), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> diff --git a/app/Template/gantt/task_creation.php b/app/Template/gantt/task_creation.php index 448a808d..673bd019 100644 --- a/app/Template/gantt/task_creation.php +++ b/app/Template/gantt/task_creation.php @@ -30,6 +30,6 @@
- url->link(t('cancel'), 'board', 'show', array('project_id' => $values['project_id']), false, 'close-popover') ?> + url->link(t('cancel'), 'BoardViewController', 'show', array('project_id' => $values['project_id']), false, 'close-popover') ?>
diff --git a/app/Template/header.php b/app/Template/header.php index 266b0724..15b70ead 100644 --- a/app/Template/header.php +++ b/app/Template/header.php @@ -23,7 +23,7 @@ data-notfound="" data-placeholder="" data-redirect-regex="PROJECT_ID" - data-redirect-url="url->href('board', 'show', array('project_id' => 'PROJECT_ID')) ?>"> + data-redirect-url="url->href('BoardViewController', 'show', array('project_id' => 'PROJECT_ID')) ?>"> $board_name): ?> diff --git a/app/Template/notification/footer.php b/app/Template/notification/footer.php index a56901ab..6ac260cb 100644 --- a/app/Template/notification/footer.php +++ b/app/Template/notification/footer.php @@ -3,5 +3,5 @@ Kanboard - - - + - diff --git a/app/Template/project/dropdown.php b/app/Template/project/dropdown.php index 10288b81..c803384a 100644 --- a/app/Template/project/dropdown.php +++ b/app/Template/project/dropdown.php @@ -3,7 +3,7 @@
  • - url->link(t('Board'), 'board', 'show', array('project_id' => $project['id'])) ?> + url->link(t('Board'), 'BoardViewController', 'show', array('project_id' => $project['id'])) ?>
  • diff --git a/app/Template/project_header/dropdown.php b/app/Template/project_header/dropdown.php index d98552e6..6b5c51a6 100644 --- a/app/Template/project_header/dropdown.php +++ b/app/Template/project_header/dropdown.php @@ -5,11 +5,11 @@
  • board->isCollapsed($project['id']) ? '' : 'style="display: none;"' ?>> - url->link(t('Expand tasks'), 'board', 'expand', array('project_id' => $project['id']), false, 'board-display-mode', t('Keyboard shortcut: "%s"', 's')) ?> + url->link(t('Expand tasks'), 'BoardAjaxController', 'expand', array('project_id' => $project['id']), false, 'board-display-mode', t('Keyboard shortcut: "%s"', 's')) ?> board->isCollapsed($project['id']) ? 'style="display: none;"' : '' ?>> - url->link(t('Collapse tasks'), 'board', 'collapse', array('project_id' => $project['id']), false, 'board-display-mode', t('Keyboard shortcut: "%s"', 's')) ?> + url->link(t('Collapse tasks'), 'BoardAjaxController', 'collapse', array('project_id' => $project['id']), false, 'board-display-mode', t('Keyboard shortcut: "%s"', 's')) ?>
  • @@ -52,7 +52,7 @@
  • - url->link(t('Public link'), 'board', 'readonly', array('token' => $project['token']), false, '', '', true) ?> + url->link(t('Public link'), 'BoardViewController', 'readonly', array('token' => $project['token']), false, '', '', true) ?>
  • diff --git a/app/Template/project_header/views.php b/app/Template/project_header/views.php index e444235a..53ca6fd8 100644 --- a/app/Template/project_header/views.php +++ b/app/Template/project_header/views.php @@ -3,9 +3,9 @@ url->link(t('Overview'), 'ProjectOverviewController', 'show', array('project_id' => $project['id'], 'search' => $filters['search']), false, 'view-overview', t('Keyboard shortcut: "%s"', 'v o')) ?> -
  • app->checkMenuSelection('Board') ?>> +
  • app->checkMenuSelection('BoardViewController') ?>> - url->link(t('Board'), 'board', 'show', array('project_id' => $project['id'], 'search' => $filters['search']), false, 'view-board', t('Keyboard shortcut: "%s"', 'v b')) ?> + url->link(t('Board'), 'BoardViewController', 'show', array('project_id' => $project['id'], 'search' => $filters['search']), false, 'view-board', t('Keyboard shortcut: "%s"', 'v b')) ?>
  • app->checkMenuSelection('Calendar') ?>> diff --git a/app/Template/project_list/show.php b/app/Template/project_list/show.php index 3fd69f41..75b5495f 100644 --- a/app/Template/project_list/show.php +++ b/app/Template/project_list/show.php @@ -38,7 +38,7 @@ - url->link($this->text->e($project['name']), 'board', 'show', array('project_id' => $project['id'])) ?> + url->link($this->text->e($project['name']), 'BoardViewController', 'show', array('project_id' => $project['id'])) ?> diff --git a/app/Template/project_overview/information.php b/app/Template/project_overview/information.php index f49133bd..fdf0f753 100644 --- a/app/Template/project_overview/information.php +++ b/app/Template/project_overview/information.php @@ -29,7 +29,7 @@ -
  • url->link(t('Public link'), 'board', 'readonly', array('token' => $project['token']), false, '', '', true) ?>
  • +
  • url->link(t('Public link'), 'BoardViewController', 'readonly', array('token' => $project['token']), false, '', '', true) ?>
  • url->link(t('RSS feed'), 'FeedController', 'project', array('token' => $project['token']), false, '', '', true) ?>
  • url->link(t('iCal feed'), 'ICalendarController', 'project', array('token' => $project['token'])) ?>
  • diff --git a/app/Template/project_user_overview/roles.php b/app/Template/project_user_overview/roles.php index 6be929d8..39412aab 100644 --- a/app/Template/project_user_overview/roles.php +++ b/app/Template/project_user_overview/roles.php @@ -13,7 +13,7 @@ text->e($this->user->getFullname($project)) ?> - url->link('', 'board', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Board')) ?> + url->link('', 'BoardViewController', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Board')) ?> url->link('', 'gantt', 'project', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Gantt chart')) ?> url->link('', 'ProjectViewController', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Project settings')) ?> diff --git a/app/Template/project_user_overview/tasks.php b/app/Template/project_user_overview/tasks.php index d459c133..af0a3d97 100644 --- a/app/Template/project_user_overview/tasks.php +++ b/app/Template/project_user_overview/tasks.php @@ -17,7 +17,7 @@ url->link('#'.$this->text->e($task['id']), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', t('View this task')) ?> - url->link($this->text->e($task['project_name']), 'board', 'show', array('project_id' => $task['project_id'])) ?> + url->link($this->text->e($task['project_name']), 'BoardViewController', 'show', array('project_id' => $task['project_id'])) ?> text->e($task['column_name']) ?> diff --git a/app/Template/project_view/share.php b/app/Template/project_view/share.php index f8cfc0eb..409f37e6 100644 --- a/app/Template/project_view/share.php +++ b/app/Template/project_view/share.php @@ -6,7 +6,7 @@
      -
    • url->link(t('Public link'), 'board', 'readonly', array('token' => $project['token']), false, '', '', true) ?>
    • +
    • url->link(t('Public link'), 'BoardViewController', 'readonly', array('token' => $project['token']), false, '', '', true) ?>
    • url->link(t('RSS feed'), 'FeedController', 'project', array('token' => $project['token']), false, '', '', true) ?>
    • url->link(t('iCal feed'), 'ICalendarController', 'project', array('token' => $project['token']), false, '', '', true) ?>
    diff --git a/app/Template/project_view/show.php b/app/Template/project_view/show.php index b03e0dd8..5efe8ce6 100644 --- a/app/Template/project_view/show.php +++ b/app/Template/project_view/show.php @@ -13,7 +13,7 @@ -
  • url->link(t('Public link'), 'board', 'readonly', array('token' => $project['token']), false, '', '', true) ?>
  • +
  • url->link(t('Public link'), 'BoardViewController', 'readonly', array('token' => $project['token']), false, '', '', true) ?>
  • url->link(t('RSS feed'), 'FeedController', 'project', array('token' => $project['token']), false, '', '', true) ?>
  • url->link(t('iCal feed'), 'ICalendarController', 'project', array('token' => $project['token'])) ?>
  • @@ -35,7 +35,7 @@ 0): ?> 0): ?> -
  • url->link(t('%d tasks on the board', $stats['nb_active_tasks']), 'board', 'show', array('project_id' => $project['id'], 'search' => 'status:open')) ?>
  • +
  • url->link(t('%d tasks on the board', $stats['nb_active_tasks']), 'BoardViewController', 'show', array('project_id' => $project['id'], 'search' => 'status:open')) ?>
  • 0): ?> diff --git a/app/Template/search/results.php b/app/Template/search/results.php index 58858867..97667c75 100644 --- a/app/Template/search/results.php +++ b/app/Template/search/results.php @@ -13,7 +13,7 @@ getCollection() as $task): ?> - url->link($this->text->e($task['project_name']), 'board', 'show', array('project_id' => $task['project_id'])) ?> + url->link($this->text->e($task['project_name']), 'BoardViewController', 'show', array('project_id' => $task['project_id'])) ?> url->link('#'.$this->text->e($task['id']), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', t('View this task')) ?> diff --git a/app/Template/task/details.php b/app/Template/task/details.php index bbbbfd8b..fe2bba67 100644 --- a/app/Template/task/details.php +++ b/app/Template/task/details.php @@ -38,7 +38,7 @@
  • - url->link(t('Back to the board'), 'board', 'readonly', array('token' => $project['token'])) ?> + url->link(t('Back to the board'), 'BoardViewController', 'readonly', array('token' => $project['token'])) ?>
  • diff --git a/app/Template/task_bulk/show.php b/app/Template/task_bulk/show.php index 5f76f808..1391c2c1 100644 --- a/app/Template/task_bulk/show.php +++ b/app/Template/task_bulk/show.php @@ -19,7 +19,7 @@
    - url->link(t('cancel'), 'board', 'show', array('project_id' => $project['id']), false, 'close-popover') ?> + url->link(t('cancel'), 'BoardViewController', 'show', array('project_id' => $project['id']), false, 'close-popover') ?>
    diff --git a/app/Template/task_creation/show.php b/app/Template/task_creation/show.php index cecf459d..7bebbfe9 100644 --- a/app/Template/task_creation/show.php +++ b/app/Template/task_creation/show.php @@ -48,6 +48,6 @@
    - url->link(t('cancel'), 'board', 'show', array('project_id' => $values['project_id']), false, 'close-popover') ?> + url->link(t('cancel'), 'BoardViewController', 'show', array('project_id' => $values['project_id']), false, 'close-popover') ?>
    diff --git a/app/Template/task_popover/change_assignee.php b/app/Template/task_popover/change_assignee.php index 1a424e1f..02f3e198 100644 --- a/app/Template/task_popover/change_assignee.php +++ b/app/Template/task_popover/change_assignee.php @@ -14,7 +14,7 @@
    - url->link(t('cancel'), 'board', 'show', array('project_id' => $project['id']), false, 'close-popover') ?> + url->link(t('cancel'), 'BoardViewController', 'show', array('project_id' => $project['id']), false, 'close-popover') ?>
    diff --git a/app/Template/task_popover/change_category.php b/app/Template/task_popover/change_category.php index 1755ac9b..eb6a373d 100644 --- a/app/Template/task_popover/change_category.php +++ b/app/Template/task_popover/change_category.php @@ -14,7 +14,7 @@
    - url->link(t('cancel'), 'board', 'show', array('project_id' => $project['id']), false, 'close-popover') ?> + url->link(t('cancel'), 'BoardViewController', 'show', array('project_id' => $project['id']), false, 'close-popover') ?>
    diff --git a/tests/units/Helper/UserHelperTest.php b/tests/units/Helper/UserHelperTest.php index 3c21f7f1..be563b47 100644 --- a/tests/units/Helper/UserHelperTest.php +++ b/tests/units/Helper/UserHelperTest.php @@ -86,7 +86,7 @@ class UserHelperTest extends Base $this->assertEquals(1, $project->create(array('name' => 'My project'))); $this->assertTrue($helper->hasProjectAccess('ProjectEditController', 'edit', 1)); - $this->assertTrue($helper->hasProjectAccess('board', 'show', 1)); + $this->assertTrue($helper->hasProjectAccess('BoardViewController', 'show', 1)); } public function testHasProjectAccessForManagers() @@ -102,7 +102,7 @@ class UserHelperTest extends Base $this->assertEquals(1, $project->create(array('name' => 'My project'))); $this->assertFalse($helper->hasProjectAccess('ProjectEditController', 'edit', 1)); - $this->assertFalse($helper->hasProjectAccess('board', 'show', 1)); + $this->assertFalse($helper->hasProjectAccess('BoardViewController', 'show', 1)); } public function testHasProjectAccessForUsers() @@ -118,7 +118,7 @@ class UserHelperTest extends Base $this->assertEquals(1, $project->create(array('name' => 'My project'))); $this->assertFalse($helper->hasProjectAccess('ProjectEditController', 'edit', 1)); - $this->assertFalse($helper->hasProjectAccess('board', 'show', 1)); + $this->assertFalse($helper->hasProjectAccess('BoardViewController', 'show', 1)); } public function testHasProjectAccessForAppManagerAndProjectManagers() @@ -139,12 +139,12 @@ class UserHelperTest extends Base $this->assertTrue($projectUserRole->addUser(1, 2, Role::PROJECT_MANAGER)); $this->assertTrue($helper->hasProjectAccess('ProjectEditController', 'edit', 1)); - $this->assertTrue($helper->hasProjectAccess('board', 'show', 1)); + $this->assertTrue($helper->hasProjectAccess('BoardViewController', 'show', 1)); $this->assertTrue($helper->hasProjectAccess('TaskViewController', 'show', 1)); $this->assertTrue($helper->hasProjectAccess('taskcreationcontroller', 'save', 1)); $this->assertFalse($helper->hasProjectAccess('ProjectEditController', 'edit', 2)); - $this->assertFalse($helper->hasProjectAccess('board', 'show', 2)); + $this->assertFalse($helper->hasProjectAccess('BoardViewController', 'show', 2)); $this->assertFalse($helper->hasProjectAccess('TaskViewController', 'show', 2)); $this->assertFalse($helper->hasProjectAccess('TaskCreationController', 'save', 2)); } @@ -167,12 +167,12 @@ class UserHelperTest extends Base $this->assertTrue($projectUserRole->addUser(1, 2, Role::PROJECT_MANAGER)); $this->assertTrue($helper->hasProjectAccess('ProjectEditController', 'edit', 1)); - $this->assertTrue($helper->hasProjectAccess('board', 'show', 1)); + $this->assertTrue($helper->hasProjectAccess('BoardViewController', 'show', 1)); $this->assertTrue($helper->hasProjectAccess('TaskViewController', 'show', 1)); $this->assertTrue($helper->hasProjectAccess('TaskCreationController', 'save', 1)); $this->assertFalse($helper->hasProjectAccess('ProjectEditController', 'edit', 2)); - $this->assertFalse($helper->hasProjectAccess('board', 'show', 2)); + $this->assertFalse($helper->hasProjectAccess('BoardViewController', 'show', 2)); $this->assertFalse($helper->hasProjectAccess('TaskViewController', 'show', 2)); $this->assertFalse($helper->hasProjectAccess('TaskCreationController', 'save', 2)); } @@ -195,12 +195,12 @@ class UserHelperTest extends Base $this->assertTrue($projectUserRole->addUser(1, 2, Role::PROJECT_MEMBER)); $this->assertFalse($helper->hasProjectAccess('ProjectEditController', 'edit', 1)); - $this->assertTrue($helper->hasProjectAccess('board', 'show', 1)); + $this->assertTrue($helper->hasProjectAccess('BoardViewController', 'show', 1)); $this->assertTrue($helper->hasProjectAccess('TaskViewController', 'show', 1)); $this->assertTrue($helper->hasProjectAccess('TaskCreationController', 'save', 1)); $this->assertFalse($helper->hasProjectAccess('ProjectEditController', 'edit', 2)); - $this->assertFalse($helper->hasProjectAccess('board', 'show', 2)); + $this->assertFalse($helper->hasProjectAccess('BoardViewController', 'show', 2)); $this->assertFalse($helper->hasProjectAccess('TaskViewController', 'show', 2)); $this->assertFalse($helper->hasProjectAccess('TaskCreationController', 'save', 2)); } @@ -223,12 +223,12 @@ class UserHelperTest extends Base $this->assertTrue($projectUserRole->addUser(1, 2, Role::PROJECT_VIEWER)); $this->assertFalse($helper->hasProjectAccess('ProjectEditController', 'edit', 1)); - $this->assertTrue($helper->hasProjectAccess('board', 'show', 1)); + $this->assertTrue($helper->hasProjectAccess('BoardViewController', 'show', 1)); $this->assertTrue($helper->hasProjectAccess('TaskViewController', 'show', 1)); $this->assertFalse($helper->hasProjectAccess('TaskCreationController', 'save', 1)); $this->assertFalse($helper->hasProjectAccess('ProjectEditController', 'edit', 2)); - $this->assertFalse($helper->hasProjectAccess('board', 'show', 2)); + $this->assertFalse($helper->hasProjectAccess('BoardViewController', 'show', 2)); $this->assertFalse($helper->hasProjectAccess('TaskViewController', 'show', 2)); $this->assertFalse($helper->hasProjectAccess('TaskCreationController', 'save', 2)); } -- cgit v1.2.3