diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-03-12 21:21:24 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-03-12 21:21:24 -0400 |
commit | 925ede9b48bef67739d26f0d0a394342f2d8edf0 (patch) | |
tree | d2ce47cb3793f8e64831ff7e04b3cddb35dcc498 /app/Controller/Tasklink.php | |
parent | ac19e36b55b566f61d750e801134396fd4d3fada (diff) | |
parent | b747b9750b697b863fcadbbbeb0ed94220e57961 (diff) |
Merge and improve pull-request #704
Diffstat (limited to 'app/Controller/Tasklink.php')
-rw-r--r-- | app/Controller/Tasklink.php | 16 |
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 { |