summaryrefslogtreecommitdiff
path: root/app/Controller/AvatarFileController.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-03-11 15:24:34 -0500
committerFrederic Guillot <fred@kanboard.net>2017-03-11 15:24:34 -0500
commita22b8f3dc73555800caf55768f04a7a2ce4af7f2 (patch)
tree60257cb9b508da83be5a9477c434fb53cc3c6f6d /app/Controller/AvatarFileController.php
parent469112918d0cfa6a43a7fdb829cd19bdf85cfcbe (diff)
Make user actions available from contextual menu
Diffstat (limited to 'app/Controller/AvatarFileController.php')
-rw-r--r--app/Controller/AvatarFileController.php13
1 files changed, 11 insertions, 2 deletions
diff --git a/app/Controller/AvatarFileController.php b/app/Controller/AvatarFileController.php
index 2a63c5ae..327080d2 100644
--- a/app/Controller/AvatarFileController.php
+++ b/app/Controller/AvatarFileController.php
@@ -36,7 +36,7 @@ class AvatarFileController extends BaseController
$this->flash->failure(t('Unable to upload files, check the permissions of your data folder.'));
}
- $this->response->redirect($this->helper->url->to('AvatarFileController', 'show', array('user_id' => $user['id'])));
+ $this->renderResponse($user['id']);
}
/**
@@ -48,7 +48,7 @@ class AvatarFileController extends BaseController
$user = $this->getUser();
$this->avatarFileModel->remove($user['id']);
$this->userSession->refresh($user['id']);
- $this->response->redirect($this->helper->url->to('AvatarFileController', 'show', array('user_id' => $user['id'])));
+ $this->renderResponse($user['id']);
}
/**
@@ -91,4 +91,13 @@ class AvatarFileController extends BaseController
$this->logger->error($e->getMessage());
}
}
+
+ protected function renderResponse($userId)
+ {
+ if ($this->request->isAjax()) {
+ $this->show();
+ } else {
+ $this->response->redirect($this->helper->url->to('AvatarFileController', 'show', array('user_id' => $userId)));
+ }
+ }
}