diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-07-04 11:14:21 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-07-04 11:14:21 -0400 |
commit | 554500aa493faa66b43b2ddce72338880a874724 (patch) | |
tree | 73066cfbe6af3cabf81b5be1dc5ef81e44792a21 /app | |
parent | a327f790ee036664439bf50e00c95fb8a0e1f97e (diff) |
Refactoring to implement new layout with filters: board/calendar/list views (work in progress)
Diffstat (limited to 'app')
40 files changed, 344 insertions, 455 deletions
diff --git a/app/Controller/Activity.php b/app/Controller/Activity.php new file mode 100644 index 00000000..2276b3b8 --- /dev/null +++ b/app/Controller/Activity.php @@ -0,0 +1,29 @@ +<?php + +namespace Controller; + +/** + * Activity stream + * + * @package controller + * @author Frederic Guillot + */ +class Activity extends Base +{ + /** + * Activity page for a project + * + * @access public + */ + public function project() + { + $project = $this->getProject(); + + $this->response->html($this->template->layout('activity/project', array( + 'board_selector' => $this->projectPermission->getAllowedProjects($this->userSession->getId()), + 'events' => $this->projectActivity->getProject($project['id']), + 'project' => $project, + 'title' => t('%s\'s activity', $project['name']) + ))); + } +} diff --git a/app/Controller/Base.php b/app/Controller/Base.php index b7ee431f..9f5d6dc6 100644 --- a/app/Controller/Base.php +++ b/app/Controller/Base.php @@ -327,4 +327,33 @@ abstract class Base extends \Core\Base return $user; } + + /** + * Common method to get project filters + * + * @access protected + */ + protected function getProjectFilters($controller, $action) + { + $project = $this->getProject(); + $search = $this->request->getStringParam('search', $this->userSession->getFilters($project['id'])); + $board_selector = $this->projectPermission->getAllowedProjects($this->userSession->getId()); + unset($board_selector[$project['id']]); + + $filters = array( + 'controller' => $controller, + 'action' => $action, + 'project_id' => $project['id'], + 'search' => $search, + ); + + $this->userSession->setFilters($project['id'], $search); + + return array( + 'project' => $project, + 'board_selector' => $board_selector, + 'filters' => $filters, + 'title' => $project['name'], + ); + } } diff --git a/app/Controller/Board.php b/app/Controller/Board.php index 0f38f910..caaa38ef 100644 --- a/app/Controller/Board.php +++ b/app/Controller/Board.php @@ -27,7 +27,7 @@ class Board extends Base } // Display the board with a specific layout - $this->response->html($this->template->layout('board/public', array( + $this->response->html($this->template->layout('board/public_view', array( 'project' => $project, 'swimlanes' => $this->board->getBoard($project['id']), 'title' => $project['name'], @@ -44,28 +44,17 @@ class Board extends Base * Show a board for a given project * * @access public - * @param integer $project_id Default project id */ - public function show($project_id = 0) + public function show() { - $project = $this->getProject($project_id); - $projects = $this->projectPermission->getAllowedProjects($this->userSession->getId()); + $params = $this->getProjectFilters('board', 'show'); - $board_selector = $projects; - unset($board_selector[$project['id']]); - - $this->response->html($this->template->layout('board/index', array( - 'users' => $this->projectPermission->getMemberList($project['id'], true, true), - 'projects' => $projects, - 'project' => $project, - 'swimlanes' => $this->board->getBoard($project['id']), - 'categories_listing' => $this->category->getList($project['id'], true, true), - 'title' => $project['name'], - 'description' => $project['description'], - 'board_selector' => $board_selector, + $this->response->html($this->template->layout('board/private_view', array( + 'swimlanes' => $this->taskFilter->search($params['filters']['search'])->getBoard($params['project']['id']), + 'description' => $params['project']['description'], 'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'), 'board_highlight_period' => $this->config->get('board_highlight_period'), - ))); + ) + $params)); } /** @@ -100,9 +89,9 @@ class Board extends Base } $this->response->html( - $this->template->render('board/show', array( + $this->template->render('board/table_container', array( 'project' => $this->project->getById($project_id), - 'swimlanes' => $this->board->getBoard($project_id), + 'swimlanes' => $this->taskFilter->search($this->userSession->getFilters($project_id))->getBoard($project_id), 'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'), 'board_highlight_period' => $this->config->get('board_highlight_period'), )), @@ -133,9 +122,9 @@ class Board extends Base } $this->response->html( - $this->template->render('board/show', array( + $this->template->render('board/table_container', array( 'project' => $this->project->getById($project_id), - 'swimlanes' => $this->board->getBoard($project_id), + 'swimlanes' => $this->taskFilter->search($this->userSession->getFilters($project_id))->getBoard($project_id), 'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'), 'board_highlight_period' => $this->config->get('board_highlight_period'), )) @@ -150,7 +139,7 @@ class Board extends Base public function tasklinks() { $task = $this->getTask(); - $this->response->html($this->template->render('board/tasklinks', array( + $this->response->html($this->template->render('board/tooltip_tasklinks', array( 'links' => $this->taskLink->getAll($task['id']), 'task' => $task, ))); @@ -164,7 +153,7 @@ class Board extends Base public function subtasks() { $task = $this->getTask(); - $this->response->html($this->template->render('board/subtasks', array( + $this->response->html($this->template->render('board/tooltip_subtasks', array( 'subtasks' => $this->subtask->getAll($task['id']), 'task' => $task, ))); @@ -179,7 +168,7 @@ class Board extends Base { $task = $this->getTask(); - $this->response->html($this->template->render('board/files', array( + $this->response->html($this->template->render('board/tooltip_files', array( 'files' => $this->file->getAllDocuments($task['id']), 'images' => $this->file->getAllImages($task['id']), 'task' => $task, @@ -195,7 +184,7 @@ class Board extends Base { $task = $this->getTask(); - $this->response->html($this->template->render('board/comments', array( + $this->response->html($this->template->render('board/tooltip_comments', array( 'comments' => $this->comment->getAll($task['id']) ))); } @@ -209,7 +198,7 @@ class Board extends Base { $task = $this->getTask(); - $this->response->html($this->template->render('board/description', array( + $this->response->html($this->template->render('board/tooltip_description', array( 'task' => $task ))); } @@ -224,7 +213,7 @@ class Board extends Base $task = $this->getTask(); $project = $this->project->getById($task['project_id']); - $this->response->html($this->template->render('board/assignee', array( + $this->response->html($this->template->render('board/popover_assignee', array( 'values' => $task, 'users_list' => $this->projectPermission->getMemberList($project['id']), 'project' => $project, @@ -262,7 +251,7 @@ class Board extends Base $task = $this->getTask(); $project = $this->project->getById($task['project_id']); - $this->response->html($this->template->render('board/category', array( + $this->response->html($this->template->render('board/popover_category', array( 'values' => $task, 'categories_list' => $this->category->getList($project['id']), 'project' => $project, diff --git a/app/Controller/Calendar.php b/app/Controller/Calendar.php index 41642a59..8a24d705 100644 --- a/app/Controller/Calendar.php +++ b/app/Controller/Calendar.php @@ -20,20 +20,9 @@ class Calendar extends Base */ public function show() { - $project = $this->getProject(); - $this->response->html($this->template->layout('calendar/show', array( 'check_interval' => $this->config->get('board_private_refresh_interval'), - 'users_list' => $this->projectPermission->getMemberList($project['id'], true, true), - 'categories_list' => $this->category->getList($project['id'], true, true), - 'columns_list' => $this->board->getColumnsList($project['id'], true), - 'swimlanes_list' => $this->swimlane->getList($project['id'], true), - 'colors_list' => $this->color->getList(true), - 'status_list' => $this->taskStatus->getList(true), - 'project' => $project, - 'title' => t('Calendar for "%s"', $project['name']), - 'board_selector' => $this->projectPermission->getAllowedProjects($this->userSession->getId()), - ))); + ) + $this->getProjectFilters('calendar', 'show'))); } /** @@ -49,14 +38,8 @@ class Calendar extends Base // Common filter $filter = $this->taskFilter - ->create() - ->filterByProject($project_id) - ->filterByCategory($this->request->getIntegerParam('category_id', -1)) - ->filterByOwner($this->request->getIntegerParam('owner_id', -1)) - ->filterByColumn($this->request->getIntegerParam('column_id', -1)) - ->filterBySwimlane($this->request->getIntegerParam('swimlane_id', -1)) - ->filterByColor($this->request->getStringParam('color_id')) - ->filterByStatus($this->request->getIntegerParam('is_active', -1)); + ->search($this->userSession->getFilters($project_id)) + ->filterByProject($project_id); // Tasks if ($this->config->get('calendar_project_tasks', 'date_started') === 'date_creation') { diff --git a/app/Controller/Listing.php b/app/Controller/Listing.php new file mode 100644 index 00000000..2c197e3e --- /dev/null +++ b/app/Controller/Listing.php @@ -0,0 +1,37 @@ +<?php + +namespace Controller; + +use Model\Task as TaskModel; + +/** + * List view controller + * + * @package controller + * @author Frederic Guillot + */ +class Listing extends Base +{ + /** + * Show list view for projects + * + * @access public + */ + public function show() + { + $params = $this->getProjectFilters('listing', 'show'); + $query = $this->taskFilter->search($params['filters']['search'])->filterByProject($params['project']['id'])->getQuery(); + + $paginator = $this->paginator + ->setUrl('listing', 'show', array('project_id' => $params['project']['id'])) + ->setMax(30) + ->setOrder(TaskModel::TABLE.'.id') + ->setDirection('DESC') + ->setQuery($query) + ->calculate(); + + $this->response->html($this->template->layout('listing/show', $params + array( + 'paginator' => $paginator, + ))); + } +} diff --git a/app/Controller/Projectinfo.php b/app/Controller/Projectinfo.php deleted file mode 100644 index 22b9861c..00000000 --- a/app/Controller/Projectinfo.php +++ /dev/null @@ -1,95 +0,0 @@ -<?php - -namespace Controller; - -/** - * Project Info controller (ActivityStream + completed tasks) - * - * @package controller - * @author Frederic Guillot - */ -class Projectinfo extends Base -{ - /** - * Activity page for a project - * - * @access public - */ - public function activity() - { - $project = $this->getProject(); - - $this->response->html($this->template->layout('projectinfo/activity', array( - 'board_selector' => $this->projectPermission->getAllowedProjects($this->userSession->getId()), - 'events' => $this->projectActivity->getProject($project['id']), - 'project' => $project, - 'title' => t('%s\'s activity', $project['name']) - ))); - } - - /** - * Task search for a given project - * - * @access public - */ - public function search() - { - $project = $this->getProject(); - $search = $this->request->getStringParam('search'); - $nb_tasks = 0; - - $paginator = $this->paginator - ->setUrl('projectinfo', 'search', array('search' => $search, 'project_id' => $project['id'])) - ->setMax(30) - ->setOrder('tasks.id') - ->setDirection('DESC'); - - if ($search !== '') { - $paginator->setQuery($this->taskFilter->search($search)->filterByProject($project['id'])->getQuery()) - ->calculate(); - - $nb_tasks = $paginator->getTotal(); - } - - $this->response->html($this->template->layout('projectinfo/search', array( - 'board_selector' => $this->projectPermission->getAllowedProjects($this->userSession->getId()), - 'values' => array( - 'search' => $search, - 'controller' => 'projectinfo', - 'action' => 'search', - 'project_id' => $project['id'], - ), - 'paginator' => $paginator, - 'project' => $project, - 'columns' => $this->board->getColumnsList($project['id']), - 'categories' => $this->category->getList($project['id'], false), - 'title' => t('Search in the project "%s"', $project['name']).($nb_tasks > 0 ? ' ('.$nb_tasks.')' : '') - ))); - } - - /** - * List of completed tasks for a given project - * - * @access public - */ - public function tasks() - { - $project = $this->getProject(); - $paginator = $this->paginator - ->setUrl('projectinfo', 'tasks', array('project_id' => $project['id'])) - ->setMax(30) - ->setOrder('tasks.id') - ->setDirection('DESC') - ->setQuery($this->taskFinder->getClosedTaskQuery($project['id'])) - ->calculate(); - - $this->response->html($this->template->layout('projectinfo/tasks', array( - 'board_selector' => $this->projectPermission->getAllowedProjects($this->userSession->getId()), - 'project' => $project, - 'columns' => $this->board->getColumnsList($project['id']), - 'categories' => $this->category->getList($project['id'], false), - 'paginator' => $paginator, - 'title' => t('Completed tasks for "%s"', $project['name']).' ('.$paginator->getTotal().')' - ))); - } -} diff --git a/app/Model/Acl.php b/app/Model/Acl.php index 91ed035b..09638302 100644 --- a/app/Model/Acl.php +++ b/app/Model/Acl.php @@ -37,7 +37,8 @@ class Acl extends Base 'comment' => '*', 'file' => '*', 'project' => array('show'), - 'projectinfo' => array('tasks', 'search', 'activity'), + 'listing' => '*', + 'activity' => '*', 'subtask' => '*', 'task' => '*', 'tasklink' => '*', diff --git a/app/Model/Board.php b/app/Model/Board.php index f6f968f4..bcf77b3e 100644 --- a/app/Model/Board.php +++ b/app/Model/Board.php @@ -237,10 +237,11 @@ class Board extends Base * Get all tasks sorted by columns and swimlanes * * @access public - * @param integer $project_id Project id + * @param integer $project_id + * @param callable $callback * @return array */ - public function getBoard($project_id) + public function getBoard($project_id, $callback = null) { $swimlanes = $this->swimlane->getSwimlanes($project_id); $columns = $this->getColumns($project_id); @@ -253,7 +254,11 @@ class Board extends Base $swimlanes[$i]['nb_tasks'] = 0; for ($j = 0; $j < $nb_columns; $j++) { - $swimlanes[$i]['columns'][$j]['tasks'] = $this->taskFinder->getTasksByColumnAndSwimlane($project_id, $columns[$j]['id'], $swimlanes[$i]['id']); + + $column_id = $columns[$j]['id']; + $swimlane_id = $swimlanes[$i]['id']; + + $swimlanes[$i]['columns'][$j]['tasks'] = $callback === null ? $this->taskFinder->getTasksByColumnAndSwimlane($project_id, $column_id, $swimlane_id) : $callback($project_id, $column_id, $swimlane_id); $swimlanes[$i]['columns'][$j]['nb_tasks'] = count($swimlanes[$i]['columns'][$j]['tasks']); $swimlanes[$i]['columns'][$j]['score'] = $this->getColumnSum($swimlanes[$i]['columns'][$j]['tasks'], 'score'); $swimlanes[$i]['nb_tasks'] += $swimlanes[$i]['columns'][$j]['nb_tasks']; diff --git a/app/Model/TaskFilter.php b/app/Model/TaskFilter.php index 31080cb5..e9d9ccbd 100644 --- a/app/Model/TaskFilter.php +++ b/app/Model/TaskFilter.php @@ -513,6 +513,23 @@ class TaskFilter extends Base } /** + * Get swimlanes and tasks to display the board + * + * @access public + * @return array + */ + public function getBoard($project_id) + { + $tasks = $this->filterByProject($project_id)->query->asc(Task::TABLE.'.position')->findAll(); + + return $this->board->getBoard($project_id, function ($project_id, $column_id, $swimlane_id) use ($tasks) { + return array_filter($tasks, function(array $task) use ($column_id, $swimlane_id) { + return $task['column_id'] == $column_id && $task['swimlane_id'] == $swimlane_id; + }); + }); + } + + /** * Format the results to the ajax autocompletion * * @access public diff --git a/app/Model/TaskFinder.php b/app/Model/TaskFinder.php index b91f4bad..2b0453a5 100644 --- a/app/Model/TaskFinder.php +++ b/app/Model/TaskFinder.php @@ -13,20 +13,6 @@ use PDO; class TaskFinder extends Base { /** - * Get query for closed tasks - * - * @access public - * @param integer $project_id Project id - * @return \PicoDb\Table - */ - public function getClosedTaskQuery($project_id) - { - return $this->getExtendedQuery() - ->eq(Task::TABLE.'.project_id', $project_id) - ->eq(Task::TABLE.'.is_active', Task::STATUS_CLOSED); - } - - /** * Get query for assigned user tasks * * @access public @@ -142,8 +128,8 @@ class TaskFinder extends Base { return $this->db ->table(Task::TABLE) - ->eq('project_id', $project_id) - ->eq('is_active', $status_id) + ->eq(Task::TABLE.'.project_id', $project_id) + ->eq(Task::TABLE.'.is_active', $status_id) ->findAll(); } diff --git a/app/Model/TaskPosition.php b/app/Model/TaskPosition.php index 0c4beb2d..a33a4029 100644 --- a/app/Model/TaskPosition.php +++ b/app/Model/TaskPosition.php @@ -28,6 +28,11 @@ class TaskPosition extends Base { $original_task = $this->taskFinder->getById($task_id); + // Ignore closed tasks + if ($original_task['is_active'] == Task::STATUS_CLOSED) { + return true; + } + $result = $this->calculateAndSave($project_id, $task_id, $column_id, $position, $swimlane_id); if ($result) { diff --git a/app/Model/UserSession.php b/app/Model/UserSession.php index f1f2ffee..6de4a182 100644 --- a/app/Model/UserSession.php +++ b/app/Model/UserSession.php @@ -94,4 +94,28 @@ class UserSession extends Base { return ! empty($this->session['user']); } + + /** + * Get project filters from the session + * + * @access public + * @param integer $project_id + * @return string + */ + public function getFilters($project_id) + { + return ! empty($_SESSION['filters'][$project_id]) ? $_SESSION['filters'][$project_id] : 'status:open'; + } + + /** + * Save project filters in the session + * + * @access public + * @param integer $project_id + * @param string $filters + */ + public function setFilters($project_id, $filters) + { + $_SESSION['filters'][$project_id] = $filters; + } } diff --git a/app/Template/projectinfo/activity.php b/app/Template/activity/project.php index d458ea3d..480bbadd 100644 --- a/app/Template/projectinfo/activity.php +++ b/app/Template/activity/project.php @@ -12,10 +12,20 @@ </span> </li> <li> - <i class="fa fa-table fa-fw"></i> + <i class="fa fa-th fa-fw"></i> <?= $this->url->link(t('Back to the board'), 'board', 'show', array('project_id' => $project['id'])) ?> </li> <li> + <i class="fa fa-calendar fa-fw"></i> + <?= $this->url->link(t('Back to the calendar'), 'calendar', 'show', array('project_id' => $project['id'])) ?> + </li> + <?php if ($this->user->isManager($project['id'])): ?> + <li> + <i class="fa fa-cog fa-fw"></i> + <?= $this->url->link(t('Project settings'), 'project', 'show', array('project_id' => $project['id'])) ?> + </li> + <?php endif ?> + <li> <i class="fa fa-folder fa-fw"></i> <?= $this->url->link(t('All projects'), 'project', 'index') ?> </li> diff --git a/app/Template/analytic/layout.php b/app/Template/analytic/layout.php index 41c6a2ab..9d6bf77c 100644 --- a/app/Template/analytic/layout.php +++ b/app/Template/analytic/layout.php @@ -12,10 +12,20 @@ </span> </li> <li> - <i class="fa fa-table fa-fw"></i> + <i class="fa fa-th fa-fw"></i> <?= $this->url->link(t('Back to the board'), 'board', 'show', array('project_id' => $project['id'])) ?> </li> <li> + <i class="fa fa-calendar fa-fw"></i> + <?= $this->url->link(t('Back to the calendar'), 'calendar', 'show', array('project_id' => $project['id'])) ?> + </li> + <?php if ($this->user->isManager($project['id'])): ?> + <li> + <i class="fa fa-cog fa-fw"></i> + <?= $this->url->link(t('Project settings'), 'project', 'show', array('project_id' => $project['id'])) ?> + </li> + <?php endif ?> + <li> <i class="fa fa-folder fa-fw"></i> <?= $this->url->link(t('All projects'), 'project', 'index') ?> </li> diff --git a/app/Template/app/calendar.php b/app/Template/app/calendar.php index 6acee6ec..a154203b 100644 --- a/app/Template/app/calendar.php +++ b/app/Template/app/calendar.php @@ -1,6 +1,5 @@ -<div id="user-calendar" - data-check-url="<?= $this->url->href('calendar', 'user') ?>" - data-user-id="<?= $user['id'] ?>" +<div id="calendar" + data-check-url="<?= $this->url->href('calendar', 'user', array('user_id' => $user['id'])) ?>" data-save-url="<?= $this->url->href('calendar', 'save') ?>" > </div> diff --git a/app/Template/app/overview.php b/app/Template/app/overview.php index a2301cd0..66bcaa63 100644 --- a/app/Template/app/overview.php +++ b/app/Template/app/overview.php @@ -1,7 +1,7 @@ <form method="get" action="?" autocomplete="off"> <?= $this->form->hidden('controller', array('controller' => 'search')) ?> <?= $this->form->hidden('action', array('controller' => 'index')) ?> - <?= $this->form->text('search', array(), array(), array('required', 'placeholder="'.t('Search').'"'), 'form-input-large') ?> + <?= $this->form->text('search', array(), array(), array('placeholder="'.t('Search').'"'), 'form-input-large') ?> <input type="submit" value="<?= t('Search') ?>" class="btn btn-blue"/> </form> diff --git a/app/Template/board/filters.php b/app/Template/board/filters.php deleted file mode 100644 index b80234a0..00000000 --- a/app/Template/board/filters.php +++ /dev/null @@ -1,43 +0,0 @@ -<div class="page-header"> - <ul class="board-filters"> - <li> - <span class="dropdown"> - <span> - <i class="fa fa-caret-down"></i> <a href="#" class="dropdown-menu"><?= t('Actions') ?></a> - <ul> - <li> - <span class="filter-collapse"> - <i class="fa fa-compress fa-fw"></i> <a href="#" class="filter-collapse-link"><?= t('Collapse tasks') ?></a> - </span> - <span class="filter-expand" style="display: none"> - <i class="fa fa-expand fa-fw"></i> <a href="#" class="filter-expand-link"><?= t('Expand tasks') ?></a> - </span> - </li> - <li> - <span class="filter-compact"> - <i class="fa fa-th fa-fw"></i> <a href="#" class="filter-toggle-scrolling"><?= t('Compact view') ?></a> - </span> - <span class="filter-wide" style="display: none"> - <i class="fa fa-arrows-h fa-fw"></i> <a href="#" class="filter-toggle-scrolling"><?= t('Horizontal scrolling') ?></a> - </span> - </li> - <?= $this->render('project/dropdown', array('project' => $project)) ?> - </ul> - </span> - </span> - </li> - <li> - <?= $this->form->select('user_id', $users, array(), array(), array('data-placeholder="'.t('Filter by user').'"', 'data-notfound="'.t('No results match:').'"', 'tabindex=="-1"'), 'apply-filters chosen-select') ?> - </li> - <li> - <?= $this->form->select('category_id', $categories, array(), array(), array('data-placeholder="'.t('Filter by category').'"', 'data-notfound="'.t('No results match:').'"', 'tabindex=="-1"'), 'apply-filters chosen-select') ?> - </li> - <li> - <select id="more-filters" multiple data-placeholder="<?= t('More filters') ?>" data-notfound="<?= t('No results match:') ?>" class="apply-filters hide-mobile" tabindex="-1"> - <option value=""></option> - <option value="filter-due-date"><?= t('Filter by due date') ?></option> - <option value="filter-recent"><?= t('Filter recently updated') ?></option> - </select> - </li> - </ul> -</div>
\ No newline at end of file diff --git a/app/Template/board/assignee.php b/app/Template/board/popover_assignee.php index 4af19cf7..4af19cf7 100644 --- a/app/Template/board/assignee.php +++ b/app/Template/board/popover_assignee.php diff --git a/app/Template/board/category.php b/app/Template/board/popover_category.php index b38758d3..b38758d3 100644 --- a/app/Template/board/category.php +++ b/app/Template/board/popover_category.php diff --git a/app/Template/board/index.php b/app/Template/board/private_view.php index 6f6fddbe..5fdaa7fc 100644 --- a/app/Template/board/index.php +++ b/app/Template/board/private_view.php @@ -1,12 +1,12 @@ <section id="main"> - <?= $this->render('board/filters', array( - 'categories' => $categories_listing, - 'users' => $users, + <?= $this->render('project/filters', array( 'project' => $project, + 'filters' => $filters, + 'is_board' => true, )) ?> - <?= $this->render('board/show', array( + <?= $this->render('board/table_container', array( 'project' => $project, 'swimlanes' => $swimlanes, 'board_private_refresh_interval' => $board_private_refresh_interval, diff --git a/app/Template/board/public.php b/app/Template/board/public_view.php index ad7515db..aea72031 100644 --- a/app/Template/board/public.php +++ b/app/Template/board/public_view.php @@ -1,6 +1,6 @@ <section id="main" class="public-board"> - <?= $this->render('board/show', array( + <?= $this->render('board/table_container', array( 'project' => $project, 'swimlanes' => $swimlanes, 'board_private_refresh_interval' => $board_private_refresh_interval, diff --git a/app/Template/board/show.php b/app/Template/board/table_container.php index c0aa5d36..9d3a1134 100644 --- a/app/Template/board/show.php +++ b/app/Template/board/table_container.php @@ -17,7 +17,7 @@ <p class="alert alert-error"><?= t('There is no column in your project!') ?></p> <?php break ?> <?php else: ?> - <?= $this->render('board/swimlane', array( + <?= $this->render('board/table_swimlane', array( 'project' => $project, 'swimlane' => $swimlane, 'board_highlight_period' => $board_highlight_period, diff --git a/app/Template/board/swimlane.php b/app/Template/board/table_swimlane.php index b86fc446..b86fc446 100644 --- a/app/Template/board/swimlane.php +++ b/app/Template/board/table_swimlane.php diff --git a/app/Template/board/comments.php b/app/Template/board/tooltip_comments.php index 2e2c0c1e..2e2c0c1e 100644 --- a/app/Template/board/comments.php +++ b/app/Template/board/tooltip_comments.php diff --git a/app/Template/board/description.php b/app/Template/board/tooltip_description.php index 7e0e3430..7e0e3430 100644 --- a/app/Template/board/description.php +++ b/app/Template/board/tooltip_description.php diff --git a/app/Template/board/files.php b/app/Template/board/tooltip_files.php index 81136659..81136659 100644 --- a/app/Template/board/files.php +++ b/app/Template/board/tooltip_files.php diff --git a/app/Template/board/subtasks.php b/app/Template/board/tooltip_subtasks.php index 950da925..950da925 100644 --- a/app/Template/board/subtasks.php +++ b/app/Template/board/tooltip_subtasks.php diff --git a/app/Template/board/tasklinks.php b/app/Template/board/tooltip_tasklinks.php index 25aa91aa..25aa91aa 100644 --- a/app/Template/board/tasklinks.php +++ b/app/Template/board/tooltip_tasklinks.php diff --git a/app/Template/calendar/show.php b/app/Template/calendar/show.php index cf2a20ec..0406414c 100644 --- a/app/Template/calendar/show.php +++ b/app/Template/calendar/show.php @@ -1,46 +1,13 @@ <section id="main"> - <div class="page-header"> - <ul> - <li> - <span class="dropdown"> - <span> - <i class="fa fa-caret-down"></i> <a href="#" class="dropdown-menu"><?= t('Actions') ?></a> - <ul> - <?= $this->render('project/dropdown', array('project' => $project)) ?> - </ul> - </span> - </span> - </li> - <li> - <i class="fa fa-table fa-fw"></i> - <?= $this->url->link(t('Back to the board'), 'board', 'show', array('project_id' => $project['id'])) ?> - </li> - <li> - <i class="fa fa-folder fa-fw"></i> - <?= $this->url->link(t('All projects'), 'project', 'index') ?> - </li> - </ul> - </div> - <section class="sidebar-container"> - - <?= $this->render('calendar/sidebar', array( - 'project' => $project, - 'users_list' => $users_list, - 'categories_list' => $categories_list, - 'columns_list' => $columns_list, - 'swimlanes_list' => $swimlanes_list, - 'colors_list' => $colors_list, - 'status_list' => $status_list - )) ?> + <?= $this->render('project/filters', array( + 'project' => $project, + 'filters' => $filters, + )) ?> - <div class="sidebar-content"> - <div id="calendar" - data-project-id="<?= $project['id'] ?>" - data-save-url="<?= $this->url->href('calendar', 'save') ?>" - data-check-url="<?= $this->url->href('calendar', 'project', array('project_id' => $project['id'])) ?>" - data-check-interval="<?= $check_interval ?>" - > - </div> - </div> - </section> + <div id="calendar" + data-save-url="<?= $this->url->href('calendar', 'save') ?>" + data-check-url="<?= $this->url->href('calendar', 'project', array('project_id' => $project['id'])) ?>" + data-check-interval="<?= $check_interval ?>" + > + </div> </section>
\ No newline at end of file diff --git a/app/Template/calendar/sidebar.php b/app/Template/calendar/sidebar.php deleted file mode 100644 index 6c4fb5b0..00000000 --- a/app/Template/calendar/sidebar.php +++ /dev/null @@ -1,40 +0,0 @@ -<div class="sidebar"> - <ul class="no-bullet"> - <li> - <?= t('Filter by user') ?> - </li> - <li> - <?= $this->form->select('owner_id', $users_list, array(), array(), array(), 'calendar-filter') ?> - </li> - <li> - <?= t('Filter by category') ?> - </li> - <li> - <?= $this->form->select('category_id', $categories_list, array(), array(), array(), 'calendar-filter') ?> - </li> - <li> - <?= t('Filter by column') ?> - </li> - <li> - <?= $this->form->select('column_id', $columns_list, array(), array(), array(), 'calendar-filter') ?> - </li> - <li> - <?= t('Filter by swimlane') ?> - </li> - <li> - <?= $this->form->select('swimlane_id', $swimlanes_list, array(), array(), array(), 'calendar-filter') ?> - </li> - <li> - <?= t('Filter by color') ?> - </li> - <li> - <?= $this->form->select('color_id', $colors_list, array(), array(), array(), 'calendar-filter') ?> - </li> - <li> - <?= t('Filter by status') ?> - </li> - <li> - <?= $this->form->select('is_active', $status_list, array(), array(), array(), 'calendar-filter') ?> - </li> - </ul> -</div> diff --git a/app/Template/listing/show.php b/app/Template/listing/show.php new file mode 100644 index 00000000..06940678 --- /dev/null +++ b/app/Template/listing/show.php @@ -0,0 +1,67 @@ +<section id="main"> + <?= $this->render('project/filters', array( + 'project' => $project, + 'filters' => $filters, + )) ?> + + <?php if (! empty($values['search']) && $paginator->isEmpty()): ?> + <p class="alert"><?= t('No tasks found.') ?></p> + <?php elseif (! $paginator->isEmpty()): ?> + <table class="table-fixed table-small"> + <tr> + <th class="column-5"><?= $paginator->order(t('Id'), 'tasks.id') ?></th> + <th class="column-8"><?= $paginator->order(t('Column'), 'tasks.column_id') ?></th> + <th class="column-8"><?= $paginator->order(t('Category'), 'tasks.category_id') ?></th> + <th><?= $paginator->order(t('Title'), 'tasks.title') ?></th> + <th class="column-10"><?= $paginator->order(t('Assignee'), 'users.username') ?></th> + <th class="column-10"><?= $paginator->order(t('Due date'), 'tasks.date_due') ?></th> + <th class="column-10"><?= $paginator->order(t('Date created'), 'tasks.date_creation') ?></th> + <th class="column-10"><?= $paginator->order(t('Date completed'), 'tasks.date_completed') ?></th> + <th class="column-5"><?= $paginator->order(t('Status'), 'tasks.is_active') ?></th> + </tr> + <?php foreach ($paginator->getCollection() as $task): ?> + <tr> + <td class="task-table color-<?= $task['color_id'] ?>"> + <?= $this->url->link('#'.$this->e($task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', t('View this task')) ?> + </td> + <td> + <?= $this->e($task['column_name']) ?> + </td> + <td> + <?= $this->e($task['category_name']) ?> + </td> + <td> + <?= $this->url->link($this->e($task['title']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', t('View this task')) ?> + </td> + <td> + <?php if ($task['assignee_username']): ?> + <?= $this->e($task['assignee_name'] ?: $task['assignee_username']) ?> + <?php else: ?> + <?= t('Unassigned') ?> + <?php endif ?> + </td> + <td> + <?= dt('%B %e, %Y', $task['date_due']) ?> + </td> + <td> + <?= dt('%B %e, %Y', $task['date_creation']) ?> + </td> + <td> + <?php if ($task['date_completed']): ?> + <?= dt('%B %e, %Y', $task['date_completed']) ?> + <?php endif ?> + </td> + <td> + <?php if ($task['is_active'] == \Model\Task::STATUS_OPEN): ?> + <?= t('Open') ?> + <?php else: ?> + <?= t('Closed') ?> + <?php endif ?> + </td> + </tr> + <?php endforeach ?> + </table> + + <?= $paginator ?> + <?php endif ?> +</section>
\ No newline at end of file diff --git a/app/Template/project/dropdown.php b/app/Template/project/dropdown.php index 2e2650a7..aa4322e6 100644 --- a/app/Template/project/dropdown.php +++ b/app/Template/project/dropdown.php @@ -1,18 +1,6 @@ <li> - <i class="fa fa-search fa-fw"></i> - <?= $this->url->link(t('Search'), 'projectinfo', 'search', array('project_id' => $project['id'])) ?> -</li> -<li> - <i class="fa fa-check-square-o fa-fw"></i> - <?= $this->url->link(t('Completed tasks'), 'projectinfo', 'tasks', array('project_id' => $project['id'])) ?> -</li> -<li> <i class="fa fa-dashboard fa-fw"></i> - <?= $this->url->link(t('Activity'), 'projectinfo', 'activity', array('project_id' => $project['id'])) ?> -</li> -<li> - <i class="fa fa-calendar fa-fw"></i> - <?= $this->url->link(t('Calendar'), 'calendar', 'show', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('Activity'), 'activity', 'project', array('project_id' => $project['id'])) ?> </li> <?php if ($project['is_public']): ?> diff --git a/app/Template/project/filters.php b/app/Template/project/filters.php new file mode 100644 index 00000000..402807d7 --- /dev/null +++ b/app/Template/project/filters.php @@ -0,0 +1,49 @@ +<div class="page-header"> + <div class="dropdown"> + <span> + <i class="fa fa-caret-down"></i> <a href="#" class="dropdown-menu"><?= t('Actions') ?></a> + <ul> + <?php if (isset($is_board)): ?> + <li> + <span class="filter-collapse"> + <i class="fa fa-compress fa-fw"></i> <a href="#" class="filter-collapse-link"><?= t('Collapse tasks') ?></a> + </span> + <span class="filter-expand" style="display: none"> + <i class="fa fa-expand fa-fw"></i> <a href="#" class="filter-expand-link"><?= t('Expand tasks') ?></a> + </span> + </li> + <li> + <span class="filter-compact"> + <i class="fa fa-th fa-fw"></i> <a href="#" class="filter-toggle-scrolling"><?= t('Compact view') ?></a> + </span> + <span class="filter-wide" style="display: none"> + <i class="fa fa-arrows-h fa-fw"></i> <a href="#" class="filter-toggle-scrolling"><?= t('Horizontal scrolling') ?></a> + </span> + </li> + <?php endif ?> + <?= $this->render('project/dropdown', array('project' => $project)) ?> + </ul> + </span> + </div> + <ul class="views"> + <li <?= $filters['controller'] === 'board' ? 'class="active"' : '' ?>> + <i class="fa fa-th fa-fw"></i> + <?= $this->url->link(t('Board'), 'board', 'show', array('project_id' => $project['id'], 'search' => $filters['search'])) ?> + </li> + <li <?= $filters['controller'] === 'calendar' ? 'class="active"' : '' ?>> + <i class="fa fa-calendar fa-fw"></i> + <?= $this->url->link(t('Calendar'), 'calendar', 'show', array('project_id' => $project['id'], 'search' => $filters['search'])) ?> + </li> + <li <?= $filters['controller'] === 'listing' ? 'class="active"' : '' ?>> + <i class="fa fa-list fa-fw"></i> + <?= $this->url->link(t('List'), 'listing', 'show', array('project_id' => $project['id'], 'search' => $filters['search'])) ?> + </li> + </ul> + <form method="get" action="?" class="search"> + <?= $this->form->hidden('project_id', $filters) ?> + <?= $this->form->hidden('controller', $filters) ?> + <?= $this->form->hidden('action', $filters) ?> + <?= $this->form->text('search', $filters, array(), array('placeholder="'.t('Filter').'"'), 'form-input-large') ?> + </form> + +</div>
\ No newline at end of file diff --git a/app/Template/project/index.php b/app/Template/project/index.php index 1080968e..7a03ec16 100644 --- a/app/Template/project/index.php +++ b/app/Template/project/index.php @@ -35,7 +35,7 @@ <?= $this->e($project['identifier']) ?> </td> <td> - <?= $this->url->link('<i class="fa fa-table"></i>', 'board', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Board')) ?> + <?= $this->url->link('<i class="fa fa-th"></i>', 'board', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Board')) ?> <?php if ($project['is_public']): ?> <i class="fa fa-share-alt fa-fw"></i> diff --git a/app/Template/project/layout.php b/app/Template/project/layout.php index 7bb3d478..8ba92ef9 100644 --- a/app/Template/project/layout.php +++ b/app/Template/project/layout.php @@ -12,10 +12,14 @@ </span> </li> <li> - <i class="fa fa-table fa-fw"></i> + <i class="fa fa-th fa-fw"></i> <?= $this->url->link(t('Back to the board'), 'board', 'show', array('project_id' => $project['id'])) ?> </li> <li> + <i class="fa fa-calendar fa-fw"></i> + <?= $this->url->link(t('Back to the calendar'), 'calendar', 'show', array('project_id' => $project['id'])) ?> + </li> + <li> <i class="fa fa-folder fa-fw"></i> <?= $this->url->link(t('All projects'), 'project', 'index') ?> </li> diff --git a/app/Template/projectinfo/search.php b/app/Template/projectinfo/search.php deleted file mode 100644 index 4b7c8f70..00000000 --- a/app/Template/projectinfo/search.php +++ /dev/null @@ -1,43 +0,0 @@ -<section id="main"> - <div class="page-header"> - <ul> - <li> - <span class="dropdown"> - <span> - <i class="fa fa-caret-down"></i> <a href="#" class="dropdown-menu"><?= t('Actions') ?></a> - <ul> - <?= $this->render('project/dropdown', array('project' => $project)) ?> - </ul> - </span> - </span> - </li> - <li> - <i class="fa fa-table fa-fw"></i> - <?= $this->url->link(t('Back to the board'), 'board', 'show', array('project_id' => $project['id'])) ?> - </li> - <li> - <i class="fa fa-folder fa-fw"></i> - <?= $this->url->link(t('All projects'), 'project', 'index') ?> - </li> - </ul> - </div> - - <form method="get" action="?" autocomplete="off"> - <?= $this->form->hidden('controller', $values) ?> - <?= $this->form->hidden('action', $values) ?> - <?= $this->form->hidden('project_id', $values) ?> - <?= $this->form->text('search', $values, array(), array('autofocus', 'required', 'placeholder="'.t('Search').'"'), 'form-input-large') ?> - <input type="submit" value="<?= t('Search') ?>" class="btn btn-blue"/> - </form> - - <?php if (! empty($values['search']) && $paginator->isEmpty()): ?> - <p class="alert"><?= t('Nothing found.') ?></p> - <?php elseif (! $paginator->isEmpty()): ?> - <?= $this->render('task/table', array( - 'paginator' => $paginator, - 'categories' => $categories, - 'columns' => $columns, - )) ?> - <?php endif ?> - -</section>
\ No newline at end of file diff --git a/app/Template/projectinfo/tasks.php b/app/Template/projectinfo/tasks.php deleted file mode 100644 index 41884783..00000000 --- a/app/Template/projectinfo/tasks.php +++ /dev/null @@ -1,33 +0,0 @@ -<section id="main"> - <div class="page-header"> - <ul> - <li> - <span class="dropdown"> - <span> - <i class="fa fa-caret-down"></i> <a href="#" class="dropdown-menu"><?= t('Actions') ?></a> - <ul> - <?= $this->render('project/dropdown', array('project' => $project)) ?> - </ul> - </span> - </span> - </li> - <li> - <i class="fa fa-table fa-fw"></i> - <?= $this->url->link(t('Back to the board'), 'board', 'show', array('project_id' => $project['id'])) ?> - </li> - <li> - <i class="fa fa-folder fa-fw"></i> - <?= $this->url->link(t('All projects'), 'project', 'index') ?> - </li> - </ul> - </div> - <?php if ($paginator->isEmpty()): ?> - <p class="alert"><?= t('There is no completed tasks at the moment.') ?></p> - <?php else: ?> - <?= $this->render('task/table', array( - 'paginator' => $paginator, - 'categories' => $categories, - 'columns' => $columns, - )) ?> - <?php endif ?> -</section>
\ No newline at end of file diff --git a/app/Template/task/layout.php b/app/Template/task/layout.php index 5a14fb39..ddce4bce 100644 --- a/app/Template/task/layout.php +++ b/app/Template/task/layout.php @@ -2,19 +2,19 @@ <div class="page-header"> <ul> <li> - <i class="fa fa-table fa-fw"></i> + <i class="fa fa-th fa-fw"></i> <?= $this->url->link(t('Back to the board'), 'board', 'show', array('project_id' => $task['project_id']), false, '', '', false, 'swimlane-'.$task['swimlane_id']) ?> </li> + <li> + <i class="fa fa-calendar fa-fw"></i> + <?= $this->url->link(t('Back to the calendar'), 'calendar', 'show', array('project_id' => $task['project_id'])) ?> + </li> <?php if ($this->user->isManager($task['project_id'])): ?> <li> <i class="fa fa-cog fa-fw"></i> <?= $this->url->link(t('Project settings'), 'project', 'show', array('project_id' => $task['project_id'])) ?> </li> <?php endif ?> - <li> - <i class="fa fa-calendar fa-fw"></i> - <?= $this->url->link(t('Project calendar'), 'calendar', 'show', array('project_id' => $task['project_id'])) ?> - </li> </ul> </div> <section class="sidebar-container" id="task-section"> diff --git a/app/Template/task/new.php b/app/Template/task/new.php index 181b82bf..8fcdacdf 100644 --- a/app/Template/task/new.php +++ b/app/Template/task/new.php @@ -1,7 +1,7 @@ <?php if (! $ajax): ?> <div class="page-header"> <ul> - <li><i class="fa fa-table fa-fw"></i><?= $this->url->link(t('Back to the board'), 'board', 'show', array('project_id' => $values['project_id'])) ?></li> + <li><i class="fa fa-th fa-fw"></i><?= $this->url->link(t('Back to the board'), 'board', 'show', array('project_id' => $values['project_id'])) ?></li> </ul> </div> <?php else: ?> diff --git a/app/Template/task/table.php b/app/Template/task/table.php deleted file mode 100644 index d06bc7b7..00000000 --- a/app/Template/task/table.php +++ /dev/null @@ -1,56 +0,0 @@ -<table class="table-fixed table-small"> - <tr> - <th class="column-8"><?= $paginator->order(t('Id'), 'tasks.id') ?></th> - <th class="column-8"><?= $paginator->order(t('Column'), 'tasks.column_id') ?></th> - <th class="column-8"><?= $paginator->order(t('Category'), 'tasks.category_id') ?></th> - <th><?= $paginator->order(t('Title'), 'tasks.title') ?></th> - <th class="column-10"><?= $paginator->order(t('Assignee'), 'users.username') ?></th> - <th class="column-10"><?= $paginator->order(t('Due date'), 'tasks.date_due') ?></th> - <th class="column-10"><?= $paginator->order(t('Date created'), 'tasks.date_creation') ?></th> - <th class="column-10"><?= $paginator->order(t('Date completed'), 'tasks.date_completed') ?></th> - <th class="column-5"><?= $paginator->order(t('Status'), 'tasks.is_active') ?></th> - </tr> - <?php foreach ($paginator->getCollection() as $task): ?> - <tr> - <td class="task-table color-<?= $task['color_id'] ?>"> - <?= $this->url->link('#'.$this->e($task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', t('View this task')) ?> - </td> - <td> - <?= $this->text->in($task['column_id'], $columns) ?> - </td> - <td> - <?= $this->text->in($task['category_id'], $categories, '') ?> - </td> - <td> - <?= $this->url->link($this->e($task['title']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', t('View this task')) ?> - </td> - <td> - <?php if ($task['assignee_username']): ?> - <?= $this->e($task['assignee_name'] ?: $task['assignee_username']) ?> - <?php else: ?> - <?= t('Unassigned') ?> - <?php endif ?> - </td> - <td> - <?= dt('%B %e, %Y', $task['date_due']) ?> - </td> - <td> - <?= dt('%B %e, %Y', $task['date_creation']) ?> - </td> - <td> - <?php if ($task['date_completed']): ?> - <?= dt('%B %e, %Y', $task['date_completed']) ?> - <?php endif ?> - </td> - <td> - <?php if ($task['is_active'] == \Model\Task::STATUS_OPEN): ?> - <?= t('Open') ?> - <?php else: ?> - <?= t('Closed') ?> - <?php endif ?> - </td> - </tr> - <?php endforeach ?> -</table> - -<?= $paginator ?> |