From 8f6b3295e89af4c877f5522b9941fafd51b795c7 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 11 Mar 2017 19:36:48 -0500 Subject: Move dashboard menu for calendar and activity stream --- app/Controller/ActivityController.php | 28 ++++++++++++++++++++++------ app/Controller/CalendarController.php | 28 +++++++++++++++++++++------- app/Controller/DashboardController.php | 31 ------------------------------- app/Template/activity/user.php | 4 ++++ app/Template/calendar/project.php | 6 ++++++ app/Template/calendar/show.php | 9 --------- app/Template/calendar/user.php | 4 ++++ app/Template/dashboard/activity.php | 4 ---- app/Template/dashboard/calendar.php | 4 ---- app/Template/dashboard/layout.php | 7 +++++-- app/Template/dashboard/sidebar.php | 6 ------ app/Template/project_header/views.php | 2 +- 12 files changed, 63 insertions(+), 70 deletions(-) create mode 100644 app/Template/activity/user.php create mode 100644 app/Template/calendar/project.php delete mode 100644 app/Template/calendar/show.php create mode 100644 app/Template/calendar/user.php delete mode 100644 app/Template/dashboard/activity.php delete mode 100644 app/Template/dashboard/calendar.php diff --git a/app/Controller/ActivityController.php b/app/Controller/ActivityController.php index 476e4aac..a1734af1 100644 --- a/app/Controller/ActivityController.php +++ b/app/Controller/ActivityController.php @@ -10,6 +10,22 @@ namespace Kanboard\Controller; */ class ActivityController extends BaseController { + /** + * Activity page for a user + * + * @access public + */ + public function user() + { + $user = $this->getUser(); + + $this->response->html($this->helper->layout->dashboard('activity/user', array( + 'title' => t('Activity stream for %s', $this->helper->user->getFullname($user)), + 'events' => $this->helper->projectActivity->getProjectsEvents($this->projectPermissionModel->getActiveProjectIds($user['id']), 100), + 'user' => $user, + ))); + } + /** * Activity page for a project * @@ -20,9 +36,9 @@ class ActivityController extends BaseController $project = $this->getProject(); $this->response->html($this->helper->layout->app('activity/project', array( - 'events' => $this->helper->projectActivity->getProjectEvents($project['id']), + 'title' => t('%s\'s activity', $project['name']), + 'events' => $this->helper->projectActivity->getProjectEvents($project['id']), 'project' => $project, - 'title' => t('%s\'s activity', $project['name']) ))); } @@ -36,11 +52,11 @@ class ActivityController extends BaseController $task = $this->getTask(); $this->response->html($this->helper->layout->task('activity/task', array( - 'title' => $task['title'], - 'task' => $task, + 'title' => $task['title'], + 'task' => $task, 'project' => $this->projectModel->getById($task['project_id']), - 'events' => $this->helper->projectActivity->getTaskEvents($task['id']), - 'tags' => $this->taskTagModel->getList($task['id']), + 'events' => $this->helper->projectActivity->getTaskEvents($task['id']), + 'tags' => $this->taskTagModel->getList($task['id']), ))); } } diff --git a/app/Controller/CalendarController.php b/app/Controller/CalendarController.php index 5ad253e1..e764549d 100644 --- a/app/Controller/CalendarController.php +++ b/app/Controller/CalendarController.php @@ -17,17 +17,31 @@ use Kanboard\Model\TaskModel; class CalendarController extends BaseController { /** - * Show calendar view for projects + * Show calendar view for a user * * @access public */ - public function show() + public function user() + { + $user = $this->getUser(); + + $this->response->html($this->helper->layout->app('calendar/user', array( + 'user' => $user, + ))); + } + + /** + * Show calendar view for a project + * + * @access public + */ + public function project() { $project = $this->getProject(); - $this->response->html($this->helper->layout->app('calendar/show', array( - 'project' => $project, - 'title' => $project['name'], + $this->response->html($this->helper->layout->app('calendar/project', array( + 'project' => $project, + 'title' => $project['name'], 'description' => $this->helper->projectHeader->getDescription($project), ))); } @@ -37,7 +51,7 @@ class CalendarController extends BaseController * * @access public */ - public function project() + public function projectEvents() { $project_id = $this->request->getIntegerParam('project_id'); $start = $this->request->getStringParam('start'); @@ -62,7 +76,7 @@ class CalendarController extends BaseController * * @access public */ - public function user() + public function userEvents() { $user_id = $this->request->getIntegerParam('user_id'); $start = $this->request->getStringParam('start'); diff --git a/app/Controller/DashboardController.php b/app/Controller/DashboardController.php index cdd256d8..7fdc53ff 100644 --- a/app/Controller/DashboardController.php +++ b/app/Controller/DashboardController.php @@ -75,35 +75,4 @@ class DashboardController extends BaseController 'user' => $user, ))); } - - /** - * My activity stream - * - * @access public - */ - public function activity() - { - $user = $this->getUser(); - - $this->response->html($this->helper->layout->dashboard('dashboard/activity', array( - 'title' => t('Activity stream for %s', $this->helper->user->getFullname($user)), - 'events' => $this->helper->projectActivity->getProjectsEvents($this->projectPermissionModel->getActiveProjectIds($user['id']), 100), - 'user' => $user, - ))); - } - - /** - * My calendar - * - * @access public - */ - public function calendar() - { - $user = $this->getUser(); - - $this->response->html($this->helper->layout->dashboard('dashboard/calendar', array( - 'title' => t('Calendar for %s', $this->helper->user->getFullname($user)), - 'user' => $user, - ))); - } } diff --git a/app/Template/activity/user.php b/app/Template/activity/user.php new file mode 100644 index 00000000..71a67fb2 --- /dev/null +++ b/app/Template/activity/user.php @@ -0,0 +1,4 @@ + +render('event/events', array('events' => $events)) ?> \ No newline at end of file diff --git a/app/Template/calendar/project.php b/app/Template/calendar/project.php new file mode 100644 index 00000000..769e019b --- /dev/null +++ b/app/Template/calendar/project.php @@ -0,0 +1,6 @@ +projectHeader->render($project, 'CalendarController', 'show') ?> + +calendar->render( + $this->url->href('CalendarController', 'projectEvents', array('project_id' => $project['id'])), + $this->url->href('CalendarController', 'save', array('project_id' => $project['id'])) +) ?> diff --git a/app/Template/calendar/show.php b/app/Template/calendar/show.php deleted file mode 100644 index 009fc07e..00000000 --- a/app/Template/calendar/show.php +++ /dev/null @@ -1,9 +0,0 @@ -
- projectHeader->render($project, 'CalendarController', 'show') ?> - - calendar->render( - $this->url->href('CalendarController', 'project', array('project_id' => $project['id'])), - $this->url->href('CalendarController', 'save', array('project_id' => $project['id'])) - ) ?> - -
diff --git a/app/Template/calendar/user.php b/app/Template/calendar/user.php new file mode 100644 index 00000000..c68bd32d --- /dev/null +++ b/app/Template/calendar/user.php @@ -0,0 +1,4 @@ +calendar->render( + $this->url->href('CalendarController', 'userEvents', array('user_id' => $user['id'])), + $this->url->href('CalendarController', 'save') +) ?> diff --git a/app/Template/dashboard/activity.php b/app/Template/dashboard/activity.php deleted file mode 100644 index 71a67fb2..00000000 --- a/app/Template/dashboard/activity.php +++ /dev/null @@ -1,4 +0,0 @@ - -render('event/events', array('events' => $events)) ?> \ No newline at end of file diff --git a/app/Template/dashboard/calendar.php b/app/Template/dashboard/calendar.php deleted file mode 100644 index 0b768b31..00000000 --- a/app/Template/dashboard/calendar.php +++ /dev/null @@ -1,4 +0,0 @@ -calendar->render( - $this->url->href('CalendarController', 'user', array('user_id' => $user['id'])), - $this->url->href('CalendarController', 'save') -) ?> diff --git a/app/Template/dashboard/layout.php b/app/Template/dashboard/layout.php index 15ab8a1a..dbd16886 100644 --- a/app/Template/dashboard/layout.php +++ b/app/Template/dashboard/layout.php @@ -12,10 +12,13 @@
  • - url->icon('search', t('Search'), 'SearchController', 'index') ?> + url->icon('folder', t('Project management'), 'ProjectListController', 'show') ?>
  • - url->icon('folder', t('Project management'), 'ProjectListController', 'show') ?> + modal->medium('dashboard', t('My activity stream'), 'ActivityController', 'user') ?> +
  • +
  • + modal->medium('calendar', t('My calendar'), 'CalendarController', 'user') ?>
  • diff --git a/app/Template/dashboard/sidebar.php b/app/Template/dashboard/sidebar.php index e4c1038a..7507b00d 100644 --- a/app/Template/dashboard/sidebar.php +++ b/app/Template/dashboard/sidebar.php @@ -12,12 +12,6 @@
  • app->checkMenuSelection('DashboardController', 'subtasks') ?>> url->link(t('My subtasks'), 'DashboardController', 'subtasks', array('user_id' => $user['id'])) ?>
  • -
  • app->checkMenuSelection('DashboardController', 'calendar') ?>> - url->link(t('My calendar'), 'DashboardController', 'calendar', array('user_id' => $user['id'])) ?> -
  • -
  • app->checkMenuSelection('DashboardController', 'activity') ?>> - url->link(t('My activity stream'), 'DashboardController', 'activity', array('user_id' => $user['id'])) ?> -
  • hook->render('template:dashboard:sidebar', array('user' => $user)) ?> diff --git a/app/Template/project_header/views.php b/app/Template/project_header/views.php index 0328a051..2684c744 100644 --- a/app/Template/project_header/views.php +++ b/app/Template/project_header/views.php @@ -6,7 +6,7 @@ url->icon('th', t('Board'), 'BoardViewController', 'show', array('project_id' => $project['id'], 'search' => $filters['search']), false, 'view-board', t('Keyboard shortcut: "%s"', 'v b')) ?>
  • app->checkMenuSelection('CalendarController') ?>> - url->icon('calendar', t('Calendar'), 'CalendarController', 'show', array('project_id' => $project['id'], 'search' => $filters['search']), false, 'view-calendar', t('Keyboard shortcut: "%s"', 'v c')) ?> + url->icon('calendar', t('Calendar'), 'CalendarController', 'project', array('project_id' => $project['id'], 'search' => $filters['search']), false, 'view-calendar', t('Keyboard shortcut: "%s"', 'v c')) ?>
  • app->checkMenuSelection('TaskListController') ?>> url->icon('list', t('List'), 'TaskListController', 'show', array('project_id' => $project['id'], 'search' => $filters['search']), false, 'view-listing', t('Keyboard shortcut: "%s"', 'v l')) ?> -- cgit v1.2.3