Creating another task stay in the popover
This commit is contained in:
@@ -59,25 +59,29 @@ class Taskcreation extends Base
|
||||
|
||||
list($valid, $errors) = $this->taskValidator->validateCreation($values);
|
||||
|
||||
if ($valid) {
|
||||
|
||||
if ($this->taskCreation->create($values)) {
|
||||
$this->session->flash(t('Task created successfully.'));
|
||||
|
||||
if (isset($values['another_task']) && $values['another_task'] == 1) {
|
||||
unset($values['title']);
|
||||
unset($values['description']);
|
||||
$this->response->redirect($this->helper->url->to('taskcreation', 'create', $values));
|
||||
}
|
||||
else {
|
||||
$this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $project['id'])));
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->session->flashError(t('Unable to create your task.'));
|
||||
}
|
||||
if ($valid && $this->taskCreation->create($values)) {
|
||||
$this->session->flash(t('Task created successfully.'));
|
||||
$this->afterSave($project, $values);
|
||||
}
|
||||
else {
|
||||
$this->session->flashError(t('Unable to create your task.'));
|
||||
}
|
||||
|
||||
$this->create($values, $errors);
|
||||
}
|
||||
|
||||
private function afterSave(array $project, array &$values)
|
||||
{
|
||||
if (isset($values['another_task']) && $values['another_task'] == 1) {
|
||||
unset($values['title']);
|
||||
unset($values['description']);
|
||||
|
||||
if (! $this->request->isAjax()) {
|
||||
$this->response->redirect($this->helper->url->to('taskcreation', 'create', $values));
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $project['id'])));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 ($valid && $this->taskModification->update($values)) {
|
||||
$this->session->flash(t('Task updated successfully.'));
|
||||
|
||||
if ($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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user