forked from kanboard/kanboard
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the possibility to convert a subtask to a task
- Loading branch information
Showing
7 changed files
with
126 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<div class="page-header"> | ||
<h2><?= t('Convert sub-task to task') ?></h2> | ||
</div> | ||
|
||
<div class="confirm"> | ||
<div class="alert alert-info"> | ||
<?= t('Do you really want to convert this sub-task to a task?') ?> | ||
<ul> | ||
<li> | ||
<strong><?= $this->text->e($subtask['title']) ?></strong> | ||
</li> | ||
</ul> | ||
</div> | ||
|
||
<div class="form-actions"> | ||
<?= $this->url->link(t('Yes'), 'SubtaskConverterController', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id']), true, 'btn btn-red') ?> | ||
<?= t('or') ?> | ||
<?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters