summaryrefslogtreecommitdiff
path: root/app/Controller/SubtaskConverterController.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-05-17 22:08:57 -0400
committerFrederic Guillot <fred@kanboard.net>2016-05-17 22:08:57 -0400
commit996997a12d1b435956a96640eb6cf39045f6ef46 (patch)
tree1512126636270a97b22a7ace83657289fc55a4c4 /app/Controller/SubtaskConverterController.php
parentd8472d17bd1cd0aa996b6f19288e5e799a78ad65 (diff)
Added the possibility to convert a subtask to a task
Diffstat (limited to 'app/Controller/SubtaskConverterController.php')
-rw-r--r--app/Controller/SubtaskConverterController.php39
1 files changed, 39 insertions, 0 deletions
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 @@
+<?php
+
+namespace Kanboard\Controller;
+
+/**
+ * Class SubtaskConverterController
+ *
+ * @package Kanboard\Controller
+ * @author Frederic Guillot
+ */
+class SubtaskConverterController extends BaseController
+{
+ public function show()
+ {
+ $task = $this->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);
+ }
+}