diff options
author | Frédéric Guillot <fred@kanboard.net> | 2014-11-02 15:06:41 -0500 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2014-11-02 15:06:41 -0500 |
commit | 37332ae2222706f8fb330dae780dc938512edcf5 (patch) | |
tree | 9161d539cc289179339162d6922c4d9dd2c30e63 /app/Controller | |
parent | 8fe5df39d97ef851d11931fcf7e906ec08838ef7 (diff) |
Change layout (experimental)
Diffstat (limited to 'app/Controller')
-rw-r--r-- | app/Controller/Action.php | 4 | ||||
-rw-r--r-- | app/Controller/App.php | 1 | ||||
-rw-r--r-- | app/Controller/Base.php | 5 | ||||
-rw-r--r-- | app/Controller/Board.php | 7 | ||||
-rw-r--r-- | app/Controller/Category.php | 5 | ||||
-rw-r--r-- | app/Controller/Comment.php | 6 | ||||
-rw-r--r-- | app/Controller/Config.php | 12 | ||||
-rw-r--r-- | app/Controller/File.php | 4 | ||||
-rw-r--r-- | app/Controller/Project.php | 19 | ||||
-rw-r--r-- | app/Controller/Subtask.php | 10 | ||||
-rw-r--r-- | app/Controller/Task.php | 43 | ||||
-rw-r--r-- | app/Controller/User.php | 10 |
12 files changed, 37 insertions, 89 deletions
diff --git a/app/Controller/Action.php b/app/Controller/Action.php index 714c87f3..63f72e1f 100644 --- a/app/Controller/Action.php +++ b/app/Controller/Action.php @@ -31,7 +31,6 @@ class Action extends Base 'projects_list' => $this->project->getList(false), 'colors_list' => $this->color->getList(), 'categories_list' => $this->category->getList($project['id']), - 'menu' => 'projects', 'title' => t('Automatic actions') ))); } @@ -54,7 +53,6 @@ class Action extends Base 'values' => $values, 'project' => $project, 'events' => $this->action->getCompatibleEvents($values['action_name']), - 'menu' => 'projects', 'title' => t('Automatic actions') ))); } @@ -92,7 +90,6 @@ class Action extends Base 'colors_list' => $this->color->getList(), 'categories_list' => $this->category->getList($project['id']), 'project' => $project, - 'menu' => 'projects', 'title' => t('Automatic actions') ))); } @@ -145,7 +142,6 @@ class Action extends Base 'available_events' => $this->action->getAvailableEvents(), 'available_actions' => $this->action->getAvailableActions(), 'project' => $project, - 'menu' => 'projects', 'title' => t('Remove an action') ))); } diff --git a/app/Controller/App.php b/app/Controller/App.php index feec4221..193c2583 100644 --- a/app/Controller/App.php +++ b/app/Controller/App.php @@ -26,7 +26,6 @@ class App extends Base 'board_selector' => $projects, 'events' => $this->projectActivity->getProjects(array_keys($projects), 10), 'tasks' => $this->taskFinder->getAllTasksByUser($user_id), - 'menu' => 'dashboard', 'title' => t('Dashboard'), ))); } diff --git a/app/Controller/Base.php b/app/Controller/Base.php index a8e22fd8..c0483aa1 100644 --- a/app/Controller/Base.php +++ b/app/Controller/Base.php @@ -245,6 +245,8 @@ abstract class Base $content = $this->template->load($template, $params); $params['task_content_for_layout'] = $content; + $params['title'] = $params['task']['project_name'].' > '.$params['task']['title']; + $params['board_selector'] = $this->projectPermission->getAllowedProjects($this->acl->getUserId()); return $this->template->layout('task_layout', $params); } @@ -261,7 +263,8 @@ abstract class Base { $content = $this->template->load($template, $params); $params['project_content_for_layout'] = $content; - $params['menu'] = 'projects'; + $params['title'] = $params['project']['name'] === $params['title'] ? $params['title'] : $params['project']['name'].' > '.$params['title']; + $params['board_selector'] = $this->projectPermission->getAllowedProjects($this->acl->getUserId()); return $this->template->layout('project_layout', $params); } diff --git a/app/Controller/Board.php b/app/Controller/Board.php index d49ad021..0cd8f169 100644 --- a/app/Controller/Board.php +++ b/app/Controller/Board.php @@ -59,7 +59,6 @@ class Board extends Base else { $this->response->html($this->template->layout('board_assignee', $params + array( - 'menu' => 'boards', 'title' => t('Change assignee').' - '.$task['title'], ))); } @@ -113,7 +112,6 @@ class Board extends Base else { $this->response->html($this->template->layout('board_category', $params + array( - 'menu' => 'boards', 'title' => t('Change category').' - '.$task['title'], ))); } @@ -222,7 +220,6 @@ class Board extends Base 'current_project_name' => $project['name'], 'board' => $this->board->get($project['id']), 'categories' => $this->category->getList($project['id'], true, true), - 'menu' => 'boards', 'title' => $project['name'], 'board_selector' => $board_selector, 'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'), @@ -251,7 +248,6 @@ class Board extends Base 'values' => $values + array('project_id' => $project['id']), 'columns' => $columns, 'project' => $project, - 'menu' => 'projects', 'title' => t('Edit board') ))); } @@ -292,7 +288,6 @@ class Board extends Base 'values' => $values + array('project_id' => $project['id']), 'columns' => $columns, 'project' => $project, - 'menu' => 'projects', 'title' => t('Edit board') ))); } @@ -331,7 +326,6 @@ class Board extends Base 'values' => $values + $data, 'columns' => $columns, 'project' => $project, - 'menu' => 'projects', 'title' => t('Edit board') ))); } @@ -362,7 +356,6 @@ class Board extends Base $this->response->html($this->projectLayout('board_remove', array( 'column' => $this->board->getColumn($this->request->getIntegerParam('column_id')), 'project' => $project, - 'menu' => 'projects', 'title' => t('Remove a column from a board') ))); } diff --git a/app/Controller/Category.php b/app/Controller/Category.php index 38322294..4a0128f3 100644 --- a/app/Controller/Category.php +++ b/app/Controller/Category.php @@ -43,7 +43,6 @@ class Category extends Base 'values' => array('project_id' => $project['id']), 'errors' => array(), 'project' => $project, - 'menu' => 'projects', 'title' => t('Categories') ))); } @@ -76,7 +75,6 @@ class Category extends Base 'values' => $values, 'errors' => $errors, 'project' => $project, - 'menu' => 'projects', 'title' => t('Categories') ))); } @@ -95,7 +93,6 @@ class Category extends Base 'values' => $category, 'errors' => array(), 'project' => $project, - 'menu' => 'projects', 'title' => t('Categories') ))); } @@ -127,7 +124,6 @@ class Category extends Base 'values' => $values, 'errors' => $errors, 'project' => $project, - 'menu' => 'projects', 'title' => t('Categories') ))); } @@ -145,7 +141,6 @@ class Category extends Base $this->response->html($this->projectLayout('category_remove', array( 'project' => $project, 'category' => $category, - 'menu' => 'projects', 'title' => t('Remove a category') ))); } diff --git a/app/Controller/Comment.php b/app/Controller/Comment.php index a9032ed8..efa7e066 100644 --- a/app/Controller/Comment.php +++ b/app/Controller/Comment.php @@ -26,7 +26,6 @@ class Comment extends Base if (! $this->acl->isAdminUser() && $comment['user_id'] != $this->acl->getUserId()) { $this->response->html($this->template->layout('comment_forbidden', array( - 'menu' => 'tasks', 'title' => t('Access Forbidden') ))); } @@ -50,7 +49,6 @@ class Comment extends Base ), 'errors' => array(), 'task' => $task, - 'menu' => 'tasks', 'title' => t('Add a comment') ))); } @@ -83,7 +81,6 @@ class Comment extends Base 'values' => $values, 'errors' => $errors, 'task' => $task, - 'menu' => 'tasks', 'title' => t('Add a comment') ))); } @@ -103,7 +100,6 @@ class Comment extends Base 'errors' => array(), 'comment' => $comment, 'task' => $task, - 'menu' => 'tasks', 'title' => t('Edit a comment') ))); } @@ -138,7 +134,6 @@ class Comment extends Base 'errors' => $errors, 'comment' => $comment, 'task' => $task, - 'menu' => 'tasks', 'title' => t('Edit a comment') ))); } @@ -156,7 +151,6 @@ class Comment extends Base $this->response->html($this->taskLayout('comment_remove', array( 'comment' => $comment, 'task' => $task, - 'menu' => 'tasks', 'title' => t('Remove a comment') ))); } diff --git a/app/Controller/Config.php b/app/Controller/Config.php index 7c8373c3..3e0b290b 100644 --- a/app/Controller/Config.php +++ b/app/Controller/Config.php @@ -20,9 +20,9 @@ class Config extends Base */ private function layout($template, array $params) { + $params['board_selector'] = $this->projectPermission->getAllowedProjects($this->acl->getUserId()); $params['values'] = $this->config->getAll(); $params['errors'] = array(); - $params['menu'] = 'config'; $params['config_content_for_layout'] = $this->template->load($template, $params); return $this->template->layout('config_layout', $params); @@ -61,7 +61,7 @@ class Config extends Base { $this->response->html($this->layout('config_about', array( 'db_size' => $this->config->getDatabaseSize(), - 'title' => t('About'), + 'title' => t('Settings').' > '.t('About'), ))); } @@ -75,10 +75,10 @@ class Config extends Base $this->common('application'); $this->response->html($this->layout('config_application', array( - 'title' => t('Application settings'), 'languages' => $this->config->getLanguages(), 'timezones' => $this->config->getTimezones(), 'date_formats' => $this->dateParser->getAvailableFormats(), + 'title' => t('Settings').' > '.t('Application settings'), ))); } @@ -92,8 +92,8 @@ class Config extends Base $this->common('board'); $this->response->html($this->layout('config_board', array( - 'title' => t('Board settings'), 'default_columns' => implode(', ', $this->board->getDefaultColumns()), + 'title' => t('Settings').' > '.t('Board settings'), ))); } @@ -107,7 +107,7 @@ class Config extends Base $this->common('webhook'); $this->response->html($this->layout('config_webhook', array( - 'title' => t('Webhook settings'), + 'title' => t('Settings').' > '.t('Webhook settings'), ))); } @@ -119,7 +119,7 @@ class Config extends Base public function api() { $this->response->html($this->layout('config_api', array( - 'title' => t('API'), + 'title' => t('Settings').' > '.t('API'), ))); } diff --git a/app/Controller/File.php b/app/Controller/File.php index 3c8c32d1..24db7565 100644 --- a/app/Controller/File.php +++ b/app/Controller/File.php @@ -23,9 +23,7 @@ class File extends Base $this->response->html($this->taskLayout('file_new', array( 'task' => $task, - 'menu' => 'tasks', 'max_size' => ini_get('upload_max_filesize'), - 'title' => t('Attach a document') ))); } @@ -137,8 +135,6 @@ class File extends Base $this->response->html($this->taskLayout('file_remove', array( 'task' => $task, 'file' => $file, - 'menu' => 'tasks', - 'title' => t('Remove a file') ))); } } diff --git a/app/Controller/Project.php b/app/Controller/Project.php index c5f16496..becdd135 100644 --- a/app/Controller/Project.php +++ b/app/Controller/Project.php @@ -34,10 +34,10 @@ class Project extends Base } $this->response->html($this->template->layout('project_index', array( + 'board_selector' => $this->projectPermission->getAllowedProjects($this->acl->getUserId()), 'active_projects' => $active_projects, 'inactive_projects' => $inactive_projects, 'nb_projects' => $nb_projects, - 'menu' => 'projects', 'title' => t('Projects').' ('.$nb_projects.')' ))); } @@ -405,7 +405,6 @@ class Project extends Base $this->response->html($this->template->layout('project_activity', array( 'events' => $this->projectActivity->getProject($project['id']), - 'menu' => 'projects', 'project' => $project, 'title' => t('%s\'s activity', $project['name']) ))); @@ -452,10 +451,9 @@ class Project extends Base 'project_id' => $project['id'], ), 'project' => $project, - 'menu' => 'projects', 'columns' => $this->board->getColumnsList($project['id']), 'categories' => $this->category->getList($project['id'], false), - 'title' => $project['name'].($nb_tasks > 0 ? ' ('.$nb_tasks.')' : '') + 'title' => t('Search in the project "%s"', $project['name']).($nb_tasks > 0 ? ' ('.$nb_tasks.')' : '') ))); } @@ -487,12 +485,11 @@ class Project extends Base 'limit' => $limit, ), 'project' => $project, - 'menu' => 'projects', 'columns' => $this->board->getColumnsList($project['id']), 'categories' => $this->category->getList($project['id'], false), 'tasks' => $tasks, 'nb_tasks' => $nb_tasks, - 'title' => $project['name'].' ('.$nb_tasks.')' + 'title' => t('Completed tasks for "%s"', $project['name']).' ('.$nb_tasks.')' ))); } @@ -503,12 +500,15 @@ class Project extends Base */ public function create() { + $is_private = $this->request->getIntegerParam('private', $this->acl->isRegularUser()); + $this->response->html($this->template->layout('project_new', array( + 'board_selector' => $this->projectPermission->getAllowedProjects($this->acl->getUserId()), 'errors' => array(), 'values' => array( - 'is_private' => $this->request->getIntegerParam('private', $this->acl->isRegularUser()), + 'is_private' => $is_private, ), - 'title' => t('New project') + 'title' => $is_private ? t('New private project') : t('New project'), ))); } @@ -534,9 +534,10 @@ class Project extends Base } $this->response->html($this->template->layout('project_new', array( + 'board_selector' => $this->projectPermission->getAllowedProjects($this->acl->getUserId()), 'errors' => $errors, 'values' => $values, - 'title' => t('New Project') + 'title' => ! empty($values['is_private']) ? t('New private project') : t('New project'), ))); } } diff --git a/app/Controller/Subtask.php b/app/Controller/Subtask.php index 48f0d6e2..5db7471a 100644 --- a/app/Controller/Subtask.php +++ b/app/Controller/Subtask.php @@ -44,8 +44,6 @@ class Subtask extends Base 'errors' => array(), 'users_list' => $this->projectPermission->getUsersList($task['project_id']), 'task' => $task, - 'menu' => 'tasks', - 'title' => t('Add a sub-task') ))); } @@ -82,8 +80,6 @@ class Subtask extends Base 'errors' => $errors, 'users_list' => $this->projectPermission->getUsersList($task['project_id']), 'task' => $task, - 'menu' => 'tasks', - 'title' => t('Add a sub-task') ))); } @@ -104,8 +100,6 @@ class Subtask extends Base 'status_list' => $this->subTask->getStatusList(), 'subtask' => $subtask, 'task' => $task, - 'menu' => 'tasks', - 'title' => t('Edit a sub-task') ))); } @@ -141,8 +135,6 @@ class Subtask extends Base 'status_list' => $this->subTask->getStatusList(), 'subtask' => $subtask, 'task' => $task, - 'menu' => 'tasks', - 'title' => t('Edit a sub-task') ))); } @@ -159,8 +151,6 @@ class Subtask extends Base $this->response->html($this->taskLayout('subtask_remove', array( 'subtask' => $subtask, 'task' => $task, - 'menu' => 'tasks', - 'title' => t('Remove a sub-task') ))); } diff --git a/app/Controller/Task.php b/app/Controller/Task.php index 1b20cf15..70fda556 100644 --- a/app/Controller/Task.php +++ b/app/Controller/Task.php @@ -77,8 +77,7 @@ class Task extends Base 'colors_list' => $this->color->getList(), 'date_format' => $this->config->get('application_date_format'), 'date_formats' => $this->dateParser->getAvailableFormats(), - 'menu' => 'tasks', - 'title' => $task['title'], + 'title' => $task['project_name'].' > '.$task['title'], ))); } @@ -89,27 +88,25 @@ class Task extends Base */ public function create() { - $project_id = $this->request->getIntegerParam('project_id'); - $this->checkProjectPermissions($project_id); + $project = $this->getProject(); $this->response->html($this->template->layout('task_new', array( 'errors' => array(), 'values' => array( - 'project_id' => $project_id, + 'project_id' => $project['id'], 'column_id' => $this->request->getIntegerParam('column_id'), 'color_id' => $this->request->getStringParam('color_id'), 'owner_id' => $this->request->getIntegerParam('owner_id'), 'another_task' => $this->request->getIntegerParam('another_task'), ), 'projects_list' => $this->project->getListByStatus(ProjectModel::ACTIVE), - 'columns_list' => $this->board->getColumnsList($project_id), - 'users_list' => $this->projectPermission->getUsersList($project_id), + 'columns_list' => $this->board->getColumnsList($project['id']), + 'users_list' => $this->projectPermission->getUsersList($project['id']), 'colors_list' => $this->color->getList(), - 'categories_list' => $this->category->getList($project_id), + 'categories_list' => $this->category->getList($project['id']), 'date_format' => $this->config->get('application_date_format'), 'date_formats' => $this->dateParser->getAvailableFormats(), - 'menu' => 'tasks', - 'title' => t('New task') + 'title' => $project['name'].' > '.t('New task') ))); } @@ -120,6 +117,7 @@ class Task extends Base */ public function save() { + $project = $this->getProject(); $values = $this->request->getValues(); $values['creator_id'] = $this->acl->getUserId(); @@ -150,14 +148,13 @@ class Task extends Base 'errors' => $errors, 'values' => $values, 'projects_list' => $this->project->getListByStatus(ProjectModel::ACTIVE), - 'columns_list' => $this->board->getColumnsList($values['project_id']), - 'users_list' => $this->projectPermission->getUsersList($values['project_id']), + 'columns_list' => $this->board->getColumnsList($project['id']), + 'users_list' => $this->projectPermission->getUsersList($project['id']), 'colors_list' => $this->color->getList(), - 'categories_list' => $this->category->getList($values['project_id']), + 'categories_list' => $this->category->getList($project['id']), 'date_format' => $this->config->get('application_date_format'), 'date_formats' => $this->dateParser->getAvailableFormats(), - 'menu' => 'tasks', - 'title' => t('New task') + 'title' => $project['name'].' > '.t('New task') ))); } @@ -183,8 +180,6 @@ class Task extends Base 'date_format' => $this->config->get('application_date_format'), 'date_formats' => $this->dateParser->getAvailableFormats(), 'ajax' => $ajax, - 'menu' => 'tasks', - 'title' => t('Edit a task') ); if ($ajax) { @@ -234,8 +229,6 @@ class Task extends Base 'categories_list' => $this->category->getList($values['project_id']), 'date_format' => $this->config->get('application_date_format'), 'date_formats' => $this->dateParser->getAvailableFormats(), - 'menu' => 'tasks', - 'title' => t('Edit a task'), 'ajax' => $this->request->isAjax(), ))); } @@ -286,8 +279,6 @@ class Task extends Base $this->response->html($this->taskLayout('task_close', array( 'task' => $task, - 'menu' => 'tasks', - 'title' => t('Close a task') ))); } @@ -315,8 +306,6 @@ class Task extends Base $this->response->html($this->taskLayout('task_open', array( 'task' => $task, - 'menu' => 'tasks', - 'title' => t('Open a task') ))); } @@ -348,8 +337,6 @@ class Task extends Base $this->response->html($this->taskLayout('task_remove', array( 'task' => $task, - 'menu' => 'tasks', - 'title' => t('Remove a task') ))); } @@ -378,8 +365,6 @@ class Task extends Base $this->response->html($this->taskLayout('task_duplicate', array( 'task' => $task, - 'menu' => 'tasks', - 'title' => t('Duplicate a task') ))); } @@ -426,8 +411,6 @@ class Task extends Base 'errors' => $errors, 'task' => $task, 'ajax' => $ajax, - 'menu' => 'tasks', - 'title' => t('Edit the description'), ); if ($ajax) { @@ -494,8 +477,6 @@ class Task extends Base 'errors' => $errors, 'task' => $task, 'projects_list' => $projects_list, - 'menu' => 'tasks', - 'title' => t(ucfirst($action).' the task to another project') ))); } } diff --git a/app/Controller/User.php b/app/Controller/User.php index e757fa84..0a4d66f2 100644 --- a/app/Controller/User.php +++ b/app/Controller/User.php @@ -84,10 +84,10 @@ class User extends Base { $content = $this->template->load($template, $params); $params['user_content_for_layout'] = $content; - $params['menu'] = 'users'; + $params['board_selector'] = $this->projectPermission->getAllowedProjects($this->acl->getUserId()); if (isset($params['user'])) { - $params['title'] = $params['user']['name'] ?: $params['user']['username']; + $params['title'] = ($params['user']['name'] ?: $params['user']['username']).' (#'.$params['user']['id'].')'; } return $this->template->layout('user_layout', $params); @@ -131,10 +131,10 @@ class User extends Base $this->response->html( $this->template->layout('user_index', array( + 'board_selector' => $this->projectPermission->getAllowedProjects($this->acl->getUserId()), 'projects' => $this->project->getList(), 'nb_users' => $nb_users, 'users' => $users, - 'menu' => 'users', 'title' => t('Users').' ('.$nb_users.')', 'pagination' => array( 'controller' => 'user', @@ -157,10 +157,10 @@ class User extends Base public function create() { $this->response->html($this->template->layout('user_new', array( + 'board_selector' => $this->projectPermission->getAllowedProjects($this->acl->getUserId()), 'projects' => $this->project->getList(), 'errors' => array(), 'values' => array(), - 'menu' => 'users', 'title' => t('New user') ))); } @@ -187,10 +187,10 @@ class User extends Base } $this->response->html($this->template->layout('user_new', array( + 'board_selector' => $this->projectPermission->getAllowedProjects($this->acl->getUserId()), 'projects' => $this->project->getList(), 'errors' => $errors, 'values' => $values, - 'menu' => 'users', 'title' => t('New user') ))); } |