From 70d3340cd0c9d7a009c186b14ca436e9c4e61aa5 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 5 Sep 2015 17:06:01 -0400 Subject: Creating another task stay in the popover --- app/Controller/Taskmodification.php | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'app/Controller/Taskmodification.php') diff --git a/app/Controller/Taskmodification.php b/app/Controller/Taskmodification.php index 56d2b9f9..638af594 100644 --- a/app/Controller/Taskmodification.php +++ b/app/Controller/Taskmodification.php @@ -126,11 +126,13 @@ class Taskmodification extends Base ); if ($ajax) { - $this->response->html($this->template->render('task_modification/edit_task', $params)); + $html = $this->template->render('task_modification/edit_task', $params); } else { - $this->response->html($this->taskLayout('task_modification/edit_task', $params)); + $html = $this->taskLayout('task_modification/edit_task', $params); } + + $this->response->html($html); } /** @@ -145,24 +147,20 @@ class Taskmodification extends Base list($valid, $errors) = $this->taskValidator->validateModification($values); - if ($valid) { - - if ($this->taskModification->update($values)) { - $this->session->flash(t('Task updated successfully.')); + if ($valid && $this->taskModification->update($values)) { + $this->session->flash(t('Task updated successfully.')); - if ($this->request->getIntegerParam('ajax')) { - $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $task['project_id']))); - } - else { - $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id']))); - } + if ($this->request->isAjax()) { + $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $task['project_id']))); } else { - $this->session->flashError(t('Unable to update your task.')); + $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id']))); } } - - $this->edit($values, $errors); + else { + $this->session->flashError(t('Unable to update your task.')); + $this->edit($values, $errors); + } } /** -- cgit v1.2.3