Added the possibility to convert a subtask to a task
This commit is contained in:
39
app/Controller/SubtaskConverterController.php
Normal file
39
app/Controller/SubtaskConverterController.php
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user