summaryrefslogtreecommitdiff
path: root/app/Controller
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-03-11 19:01:40 -0500
committerFrederic Guillot <fred@kanboard.net>2017-03-11 19:01:40 -0500
commitcfd3000d833d3a99df0b4248e3b6160e9be4f22a (patch)
tree2a4ccff357a394670a49fd4447f3ebaee637b667 /app/Controller
parentbb9e7916574bd7e21550bf7505757fccae6cbdd0 (diff)
Move notifications outside of dashboard
Diffstat (limited to 'app/Controller')
-rw-r--r--app/Controller/DashboardController.php16
-rw-r--r--app/Controller/WebNotificationController.php29
2 files changed, 22 insertions, 23 deletions
diff --git a/app/Controller/DashboardController.php b/app/Controller/DashboardController.php
index f32f8552..cdd256d8 100644
--- a/app/Controller/DashboardController.php
+++ b/app/Controller/DashboardController.php
@@ -106,20 +106,4 @@ class DashboardController extends BaseController
'user' => $user,
)));
}
-
- /**
- * My notifications
- *
- * @access public
- */
- public function notifications()
- {
- $user = $this->getUser();
-
- $this->response->html($this->helper->layout->dashboard('dashboard/notifications', array(
- 'title' => t('Notifications for %s', $this->helper->user->getFullname($user)),
- 'notifications' => $this->userUnreadNotificationModel->getAll($user['id']),
- 'user' => $user,
- )));
- }
}
diff --git a/app/Controller/WebNotificationController.php b/app/Controller/WebNotificationController.php
index 30e317f8..02827ab5 100644
--- a/app/Controller/WebNotificationController.php
+++ b/app/Controller/WebNotificationController.php
@@ -11,16 +11,32 @@ namespace Kanboard\Controller;
class WebNotificationController extends BaseController
{
/**
+ * My notifications
+ *
+ * @access public
+ */
+ public function show()
+ {
+ $user = $this->getUser();
+ $notifications = $this->userUnreadNotificationModel->getAll($user['id']);
+
+ $this->response->html($this->template->render('web_notification/show', array(
+ 'notifications' => $notifications,
+ 'nb_notifications' => count($notifications),
+ 'user' => $user,
+ )));
+ }
+
+ /**
* Mark all notifications as read
*
* @access public
*/
public function flush()
{
- $user_id = $this->getUserId();
-
- $this->userUnreadNotificationModel->markAllAsRead($user_id);
- $this->response->redirect($this->helper->url->to('DashboardController', 'notifications', array('user_id' => $user_id)));
+ $userId = $this->getUserId();
+ $this->userUnreadNotificationModel->markAllAsRead($userId);
+ $this->show();
}
/**
@@ -32,9 +48,8 @@ class WebNotificationController extends BaseController
{
$user_id = $this->getUserId();
$notification_id = $this->request->getIntegerParam('notification_id');
-
$this->userUnreadNotificationModel->markAsRead($user_id, $notification_id);
- $this->response->redirect($this->helper->url->to('DashboardController', 'notifications', array('user_id' => $user_id)));
+ $this->show();
}
/**
@@ -49,7 +64,7 @@ class WebNotificationController extends BaseController
$this->userUnreadNotificationModel->markAsRead($user_id, $notification_id);
if (empty($notification)) {
- $this->response->redirect($this->helper->url->to('DashboardController', 'notifications', array('user_id' => $user_id)));
+ $this->show();
} elseif ($this->helper->text->contains($notification['event_name'], 'comment')) {
$this->response->redirect($this->helper->url->to(
'TaskViewController',