Show "Open this task" in dropdown menu for closed tasks
This commit is contained in:
@@ -18,6 +18,7 @@ Core functionalities moved to plugins:
|
|||||||
|
|
||||||
Improvements:
|
Improvements:
|
||||||
|
|
||||||
|
* Show "Open this task" in dropdown menu for closed tasks
|
||||||
* Show assignee on card only when someone is assigned (hide nobody text)
|
* Show assignee on card only when someone is assigned (hide nobody text)
|
||||||
* Highlight selected item in dropdown menus
|
* Highlight selected item in dropdown menus
|
||||||
* Gantt chart: change bar color according to task progress
|
* Gantt chart: change bar color according to task progress
|
||||||
|
|||||||
@@ -18,36 +18,8 @@ class Taskstatus extends Base
|
|||||||
public function close()
|
public function close()
|
||||||
{
|
{
|
||||||
$task = $this->getTask();
|
$task = $this->getTask();
|
||||||
$redirect = $this->request->getStringParam('redirect');
|
$this->changeStatus($task, 'close', t('Task closed successfully.'), t('Unable to close this task.'));
|
||||||
|
$this->renderTemplate($task, 'task_status/close');
|
||||||
if ($this->request->getStringParam('confirmation') === 'yes') {
|
|
||||||
|
|
||||||
$this->checkCSRFParam();
|
|
||||||
|
|
||||||
if ($this->taskStatus->close($task['id'])) {
|
|
||||||
$this->session->flash(t('Task closed successfully.'));
|
|
||||||
} else {
|
|
||||||
$this->session->flashError(t('Unable to close this task.'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($redirect === 'board') {
|
|
||||||
$this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $task['project_id'])));
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->request->isAjax()) {
|
|
||||||
$this->response->html($this->template->render('task_status/close', array(
|
|
||||||
'task' => $task,
|
|
||||||
'redirect' => $redirect,
|
|
||||||
)));
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->response->html($this->taskLayout('task_status/close', array(
|
|
||||||
'task' => $task,
|
|
||||||
'redirect' => $redirect,
|
|
||||||
)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -58,22 +30,46 @@ class Taskstatus extends Base
|
|||||||
public function open()
|
public function open()
|
||||||
{
|
{
|
||||||
$task = $this->getTask();
|
$task = $this->getTask();
|
||||||
|
$redirect = $this->request->getStringParam('redirect');
|
||||||
|
|
||||||
|
$this->changeStatus($task, 'open', t('Task opened successfully.'), t('Unable to open this task.'));
|
||||||
|
$this->renderTemplate($task, 'task_status/open');
|
||||||
|
}
|
||||||
|
|
||||||
|
private function changeStatus(array $task, $method, $success_message, $failure_message)
|
||||||
|
{
|
||||||
if ($this->request->getStringParam('confirmation') === 'yes') {
|
if ($this->request->getStringParam('confirmation') === 'yes') {
|
||||||
|
|
||||||
$this->checkCSRFParam();
|
$this->checkCSRFParam();
|
||||||
|
|
||||||
if ($this->taskStatus->open($task['id'])) {
|
if ($this->taskStatus->$method($task['id'])) {
|
||||||
$this->session->flash(t('Task opened successfully.'));
|
$this->session->flash($success_message);
|
||||||
} else {
|
} else {
|
||||||
$this->session->flashError(t('Unable to open this task.'));
|
$this->session->flashError($failure_message);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])));
|
if ($this->request->getStringParam('redirect') === 'board') {
|
||||||
|
$this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $task['project_id'])));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function renderTemplate(array $task, $template)
|
||||||
|
{
|
||||||
|
$redirect = $this->request->getStringParam('redirect');
|
||||||
|
|
||||||
|
if ($this->request->isAjax()) {
|
||||||
|
$this->response->html($this->template->render($template, array(
|
||||||
|
'task' => $task,
|
||||||
|
'redirect' => $redirect,
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->response->html($this->taskLayout('task_status/open', array(
|
$this->response->html($this->taskLayout($template, array(
|
||||||
'task' => $task,
|
'task' => $task,
|
||||||
|
'redirect' => $redirect,
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,10 @@
|
|||||||
<li><i class="fa fa-comment-o fa-fw"></i> <?= $this->url->link(t('Add a comment'), 'comment', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li>
|
<li><i class="fa fa-comment-o fa-fw"></i> <?= $this->url->link(t('Add a comment'), 'comment', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li>
|
||||||
<li><i class="fa fa-code-fork fa-fw"></i> <?= $this->url->link(t('Add a link'), 'tasklink', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li>
|
<li><i class="fa fa-code-fork fa-fw"></i> <?= $this->url->link(t('Add a link'), 'tasklink', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li>
|
||||||
<li><i class="fa fa-camera fa-fw"></i> <?= $this->url->link(t('Add a screenshot'), 'board', 'screenshot', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li>
|
<li><i class="fa fa-camera fa-fw"></i> <?= $this->url->link(t('Add a screenshot'), 'board', 'screenshot', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li>
|
||||||
<li><i class="fa fa-close fa-fw"></i> <?= $this->url->link(t('Close this task'), 'taskstatus', 'close', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'redirect' => 'board'), false, 'popover') ?></li>
|
<?php if ($task['is_active'] == 1): ?>
|
||||||
|
<li><i class="fa fa-close fa-fw"></i> <?= $this->url->link(t('Close this task'), 'taskstatus', 'close', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'redirect' => 'board'), false, 'popover') ?></li>
|
||||||
|
<?php else: ?>
|
||||||
|
<li><i class="fa fa-check-square-o fa-fw"></i> <?= $this->url->link(t('Open this task'), 'taskstatus', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'redirect' => 'board'), false, 'popover') ?></li>
|
||||||
|
<?php endif ?>
|
||||||
</ul>
|
</ul>
|
||||||
</span>
|
</span>
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<div class="confirm">
|
<div class="confirm">
|
||||||
<p class="alert alert-info">
|
<p class="alert alert-info">
|
||||||
<?= t('Do you really want to close the task "%s" as well as all subtasks?', $this->e($task['title'])) ?>
|
<?= t('Do you really want to close the task "%s" as well as all subtasks?', $task['title']) ?>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
|
|||||||
@@ -4,12 +4,12 @@
|
|||||||
|
|
||||||
<div class="confirm">
|
<div class="confirm">
|
||||||
<p class="alert alert-info">
|
<p class="alert alert-info">
|
||||||
<?= t('Do you really want to open this task: "%s"?', $this->e($task['title'])) ?>
|
<?= t('Do you really want to open this task: "%s"?', $task['title']) ?>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<?= $this->url->link(t('Yes'), 'taskstatus', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'confirmation' => 'yes'), true, 'btn btn-red') ?>
|
<?= $this->url->link(t('Yes'), 'taskstatus', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'confirmation' => 'yes', 'redirect' => $redirect), true, 'btn btn-red') ?>
|
||||||
<?= t('or') ?>
|
<?= t('or') ?>
|
||||||
<?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
|
<?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
Reference in New Issue
Block a user