Fix regression: stay on the same page when a task is closed

This commit is contained in:
Frederic Guillot
2017-01-23 21:05:59 -05:00
parent 10d96bfd66
commit 5315e4961e
5 changed files with 13 additions and 9 deletions

View File

@@ -7,8 +7,9 @@ New features:
Improvements: Improvements:
Bug fixes: Regressions:
* Stay on the same page when a task is closed
Version 1.0.37 (Jan 14, 2017) Version 1.0.37 (Jan 14, 2017)
----------------------------- -----------------------------

View File

@@ -52,11 +52,11 @@ class TaskStatusController extends BaseController
$this->flash->failure($failure_message); $this->flash->failure($failure_message);
} }
return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true); $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true);
} else {
$this->response->html($this->template->render($template, array(
'task' => $task,
)));
} }
return $this->response->html($this->template->render($template, array(
'task' => $task,
)));
} }
} }

File diff suppressed because one or more lines are too long

View File

@@ -4,7 +4,7 @@ KB.component('confirm-buttons', function (containerElement, options) {
function onSubmit() { function onSubmit() {
isLoading = true; isLoading = true;
KB.find('#modal-confirm-button').replace(buildButton()); KB.find('#modal-confirm-button').replace(buildButton());
window.location.href = options.url; KB.http.get(options.url);
} }
function onCancel() { function onCancel() {

View File

@@ -4,6 +4,7 @@ KB.http.request = function (method, url, headers, body) {
function parseResponse(request) { function parseResponse(request) {
var redirect = request.getResponseHeader('X-Ajax-Redirect'); var redirect = request.getResponseHeader('X-Ajax-Redirect');
var location = request.getResponseHeader('Location');
if (redirect === 'self') { if (redirect === 'self') {
window.location.reload(); window.location.reload();
@@ -11,6 +12,8 @@ KB.http.request = function (method, url, headers, body) {
window.location = redirect.split('#')[0]; window.location = redirect.split('#')[0];
} else if (redirect) { } else if (redirect) {
window.location = redirect; window.location = redirect;
} else if (location) {
window.location = location;
} else if (request.getResponseHeader('Content-Type') === 'application/json') { } else if (request.getResponseHeader('Content-Type') === 'application/json') {
try { try {
return JSON.parse(request.responseText); return JSON.parse(request.responseText);