diff --git a/app/Controller/BoardPopover.php b/app/Controller/BoardPopover.php index 105841374..b1a017f4c 100644 --- a/app/Controller/BoardPopover.php +++ b/app/Controller/BoardPopover.php @@ -10,94 +10,6 @@ namespace Kanboard\Controller; */ class BoardPopover extends Base { - /** - * Change a task assignee directly from the board - * - * @access public - */ - public function changeAssignee() - { - $task = $this->getTask(); - $project = $this->project->getById($task['project_id']); - - $this->response->html($this->template->render('board/popover_assignee', array( - 'values' => $task, - 'users_list' => $this->projectUserRole->getAssignableUsersList($project['id']), - 'project' => $project, - ))); - } - - /** - * Validate an assignee modification - * - * @access public - */ - public function updateAssignee() - { - $values = $this->request->getValues(); - - list($valid, ) = $this->taskValidator->validateAssigneeModification($values); - - if ($valid && $this->taskModification->update($values)) { - $this->flash->success(t('Task updated successfully.')); - } else { - $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); - } - - /** - * Change a task category directly from the board - * - * @access public - */ - public function changeCategory() - { - $task = $this->getTask(); - $project = $this->project->getById($task['project_id']); - - $this->response->html($this->template->render('board/popover_category', array( - 'values' => $task, - 'categories_list' => $this->category->getList($project['id']), - 'project' => $project, - ))); - } - - /** - * Validate a category modification - * - * @access public - */ - public function updateCategory() - { - $values = $this->request->getValues(); - - list($valid, ) = $this->taskValidator->validateCategoryModification($values); - - if ($valid && $this->taskModification->update($values)) { - $this->flash->success(t('Task updated successfully.')); - } else { - $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); - } - - /** - * Screenshot popover - * - * @access public - */ - public function screenshot() - { - $task = $this->getTask(); - - $this->response->html($this->template->render('task_file/screenshot', array( - 'task' => $task, - ))); - } - /** * Confirmation before to close all column tasks * @@ -109,7 +21,7 @@ class BoardPopover extends Base $column_id = $this->request->getIntegerParam('column_id'); $swimlane_id = $this->request->getIntegerParam('swimlane_id'); - $this->response->html($this->template->render('board/popover_close_all_tasks_column', array( + $this->response->html($this->template->render('board_popover/close_all_tasks_column', array( 'project' => $project, 'nb_tasks' => $this->taskFinder->countByColumnAndSwimlaneId($project['id'], $column_id, $swimlane_id), 'column' => $this->column->getColumnTitleById($column_id), diff --git a/app/Controller/TaskPopover.php b/app/Controller/TaskPopover.php new file mode 100644 index 000000000..422a99c7a --- /dev/null +++ b/app/Controller/TaskPopover.php @@ -0,0 +1,100 @@ +getTask(); + $project = $this->project->getById($task['project_id']); + + $this->response->html($this->template->render('task_popover/change_assignee', array( + 'values' => $task, + 'users_list' => $this->projectUserRole->getAssignableUsersList($project['id']), + 'project' => $project, + ))); + } + + /** + * Validate an assignee modification + * + * @access public + */ + public function updateAssignee() + { + $values = $this->request->getValues(); + + list($valid,) = $this->taskValidator->validateAssigneeModification($values); + + if ($valid && $this->taskModification->update($values)) { + $this->flash->success(t('Task updated successfully.')); + } else { + $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); + } + + /** + * Change a task category directly from the board + * + * @access public + */ + public function changeCategory() + { + $task = $this->getTask(); + $project = $this->project->getById($task['project_id']); + + $this->response->html($this->template->render('task_popover/change_category', array( + 'values' => $task, + 'categories_list' => $this->category->getList($project['id']), + 'project' => $project, + ))); + } + + /** + * Validate a category modification + * + * @access public + */ + public function updateCategory() + { + $values = $this->request->getValues(); + + list($valid,) = $this->taskValidator->validateCategoryModification($values); + + if ($valid && $this->taskModification->update($values)) { + $this->flash->success(t('Task updated successfully.')); + } else { + $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); + } + + /** + * Screenshot popover + * + * @access public + */ + public function screenshot() + { + $task = $this->getTask(); + + $this->response->html($this->template->render('task_file/screenshot', array( + 'task' => $task, + ))); + } +} diff --git a/app/ServiceProvider/AuthenticationProvider.php b/app/ServiceProvider/AuthenticationProvider.php index 776e65d51..f9abaf595 100644 --- a/app/ServiceProvider/AuthenticationProvider.php +++ b/app/ServiceProvider/AuthenticationProvider.php @@ -72,6 +72,7 @@ class AuthenticationProvider implements ServiceProviderInterface $acl->add('Analytic', '*', Role::PROJECT_MANAGER); $acl->add('Board', 'save', Role::PROJECT_MEMBER); $acl->add('BoardPopover', '*', Role::PROJECT_MEMBER); + $acl->add('TaskPopover', '*', Role::PROJECT_MEMBER); $acl->add('Calendar', 'save', Role::PROJECT_MEMBER); $acl->add('Category', '*', Role::PROJECT_MANAGER); $acl->add('Column', '*', Role::PROJECT_MANAGER); diff --git a/app/Template/board/task_avatar.php b/app/Template/board/task_avatar.php index 39f6b54d9..53739b197 100644 --- a/app/Template/board/task_avatar.php +++ b/app/Template/board/task_avatar.php @@ -3,7 +3,7 @@ user->hasProjectAccess('taskmodification', 'edit', $task['project_id'])): ?> class="task-board-assignee task-board-change-assignee" - data-url="url->href('BoardPopover', 'changeAssignee', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"> + data-url="url->href('TaskPopover', 'changeAssignee', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"> class="task-board-assignee"> diff --git a/app/Template/board/popover_close_all_tasks_column.php b/app/Template/board_popover/close_all_tasks_column.php similarity index 100% rename from app/Template/board/popover_close_all_tasks_column.php rename to app/Template/board_popover/close_all_tasks_column.php diff --git a/app/Template/task/dropdown.php b/app/Template/task/dropdown.php index 567249df5..9771b241d 100644 --- a/app/Template/task/dropdown.php +++ b/app/Template/task/dropdown.php @@ -9,11 +9,11 @@
  • - url->link(t('Change assignee'), 'BoardPopover', 'changeAssignee', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + url->link(t('Change assignee'), 'TaskPopover', 'changeAssignee', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
  • - url->link(t('Change category'), 'BoardPopover', 'changeCategory', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + url->link(t('Change category'), 'TaskPopover', 'changeCategory', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
  • @@ -41,7 +41,7 @@
  • - url->link(t('Add a screenshot'), 'BoardPopover', 'screenshot', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + url->link(t('Add a screenshot'), 'TaskPopover', 'screenshot', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
  • diff --git a/app/Template/board/popover_assignee.php b/app/Template/task_popover/change_assignee.php similarity index 85% rename from app/Template/board/popover_assignee.php rename to app/Template/task_popover/change_assignee.php index 87e16816b..bf68c34d9 100644 --- a/app/Template/board/popover_assignee.php +++ b/app/Template/task_popover/change_assignee.php @@ -2,7 +2,7 @@ -
    + form->csrf() ?> @@ -17,4 +17,4 @@ url->link(t('cancel'), 'board', 'show', array('project_id' => $project['id']), false, 'close-popover') ?>
    - \ No newline at end of file + diff --git a/app/Template/board/popover_category.php b/app/Template/task_popover/change_category.php similarity index 85% rename from app/Template/board/popover_category.php rename to app/Template/task_popover/change_category.php index e37947609..0364e660b 100644 --- a/app/Template/board/popover_category.php +++ b/app/Template/task_popover/change_category.php @@ -2,7 +2,7 @@ -
    + form->csrf() ?> @@ -17,4 +17,4 @@ url->link(t('cancel'), 'board', 'show', array('project_id' => $project['id']), false, 'close-popover') ?>
    - \ No newline at end of file +