summaryrefslogtreecommitdiff
path: root/app/Controller
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-03-12 21:21:24 -0400
committerFrederic Guillot <fred@kanboard.net>2015-03-12 21:21:24 -0400
commit925ede9b48bef67739d26f0d0a394342f2d8edf0 (patch)
treed2ce47cb3793f8e64831ff7e04b3cddb35dcc498 /app/Controller
parentac19e36b55b566f61d750e801134396fd4d3fada (diff)
parentb747b9750b697b863fcadbbbeb0ed94220e57961 (diff)
Merge and improve pull-request #704
Diffstat (limited to 'app/Controller')
-rw-r--r--app/Controller/Task.php1
-rw-r--r--app/Controller/Tasklink.php16
2 files changed, 17 insertions, 0 deletions
diff --git a/app/Controller/Task.php b/app/Controller/Task.php
index d94c5908..1296204a 100644
--- a/app/Controller/Task.php
+++ b/app/Controller/Task.php
@@ -75,6 +75,7 @@ class Task extends Base
'links' => $this->taskLink->getLinks($task['id']),
'task' => $task,
'values' => $values,
+ 'link_label_list' => $this->link->getList(0, false),
'columns_list' => $this->board->getColumnsList($task['project_id']),
'colors_list' => $this->color->getList(),
'date_format' => $this->config->get('application_date_format'),
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 {