From 996997a12d1b435956a96640eb6cf39045f6ef46 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Tue, 17 May 2016 22:08:57 -0400 Subject: Added the possibility to convert a subtask to a task --- app/Controller/SubtaskConverterController.php | 39 +++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 app/Controller/SubtaskConverterController.php (limited to 'app/Controller') diff --git a/app/Controller/SubtaskConverterController.php b/app/Controller/SubtaskConverterController.php new file mode 100644 index 00000000..829b937a --- /dev/null +++ b/app/Controller/SubtaskConverterController.php @@ -0,0 +1,39 @@ +getTask(); + $subtask = $this->getSubtask(); + + $this->response->html($this->template->render('subtask_converter/show', array( + 'subtask' => $subtask, + 'task' => $task, + ))); + } + + public function save() + { + $project = $this->getProject(); + $subtask = $this->getSubtask(); + + $task_id = $this->subtask->convertToTask($project['id'], $subtask['id']); + + if ($task_id !== false) { + $this->flash->success(t('Subtask converted to task successfully.')); + } else { + $this->flash->failure(t('Unable to convert the subtask.')); + } + + $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $project['id'], 'task_id' => $task_id)), true); + } +} -- cgit v1.2.3