summaryrefslogtreecommitdiff
path: root/app/Controller/Tasklink.php
diff options
context:
space:
mode:
authorOlivier Maridat <olivier.maridat@trialog.com>2015-03-10 14:32:23 +0100
committerOlivier Maridat <olivier.maridat@trialog.com>2015-03-10 14:32:23 +0100
commitef1fea4509a8bd475c9d77ab63764378f1b5067b (patch)
treedeb2702ba728b03bbf8e1ad6021d4f4097c6f977 /app/Controller/Tasklink.php
parent900e3fa1fd0a41e1617cd42a83b34d4c39d1730f (diff)
Add an item "Add a link" in the dropdown menu of a task in the board view
Diffstat (limited to 'app/Controller/Tasklink.php')
-rw-r--r--app/Controller/Tasklink.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/Controller/Tasklink.php b/app/Controller/Tasklink.php
index 61b7fab8..59ce0433 100644
--- a/app/Controller/Tasklink.php
+++ b/app/Controller/Tasklink.php
@@ -36,6 +36,7 @@ class Tasklink extends Base
public function create(array $values = array(), array $errors = array())
{
$task = $this->getTask();
+ $ajax = $this->request->isAjax() || $this->request->getIntegerParam('ajax');
if (empty($values)) {
$values = array(
@@ -43,6 +44,17 @@ class Tasklink extends Base
);
}
+ if ($ajax) {
+ $this->response->html($this->template->render('tasklink/create', array(
+ 'values' => $values,
+ 'errors' => $errors,
+ 'task' => $task,
+ 'labels' => $this->link->getList(0, false),
+ 'title' => t('Add a new link'),
+ 'ajax' => $ajax,
+ )));
+ }
+
$this->response->html($this->taskLayout('tasklink/create', array(
'values' => $values,
'errors' => $errors,
@@ -61,6 +73,7 @@ class Tasklink extends Base
{
$task = $this->getTask();
$values = $this->request->getValues();
+ $ajax = $this->request->isAjax() || $this->request->getIntegerParam('ajax');
list($valid, $errors) = $this->taskLink->validateCreation($values);
@@ -68,6 +81,9 @@ class Tasklink extends Base
if ($this->taskLink->create($values['task_id'], $values['opposite_task_id'], $values['link_id'])) {
$this->session->flash(t('Link added successfully.'));
+ if ($ajax) {
+ $this->response->redirect($this->helper->url('board', 'show', array('project_id' => $task['project_id'])));
+ }
$this->response->redirect($this->helper->url('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])).'#links');
}
else {