From b513313c2fbfb0e5f15cab97ea74929b5c0d0a60 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Fri, 20 Jun 2014 21:59:59 -0300 Subject: Add a board selector instead of the list of projects --- app/Controller/Board.php | 9 +++------ app/Locales/de_DE/translations.php | 1 + app/Locales/es_ES/translations.php | 1 + app/Locales/fr_FR/translations.php | 1 + app/Locales/pl_PL/translations.php | 1 + app/Locales/pt_BR/translations.php | 1 + app/Locales/zh_CN/translations.php | 28 ++++++++++++++++++++++++++++ app/Model/Project.php | 16 ++++++++++++++-- app/Templates/board_index.php | 9 --------- app/Templates/layout.php | 8 +++++++- 10 files changed, 57 insertions(+), 18 deletions(-) (limited to 'app') diff --git a/app/Controller/Board.php b/app/Controller/Board.php index 67072895..a4d91a99 100644 --- a/app/Controller/Board.php +++ b/app/Controller/Board.php @@ -185,11 +185,7 @@ class Board extends Base $user_id = $this->request->getIntegerParam('user_id', UserModel::EVERYBODY_ID); $this->checkProjectPermissions($project_id); - $projects = $this->project->getListByStatus(ProjectModel::ACTIVE); - - if ($this->acl->isRegularUser()) { - $projects = $this->project->filterListByAccess($projects, $this->acl->getUserId()); - } + $projects = $this->project->getAvailableList($this->acl->getUserId()); if (! isset($projects[$project_id])) { $this->notfound(); @@ -204,7 +200,8 @@ class Board extends Base 'board' => $this->board->get($project_id), 'categories' => $this->category->getList($project_id, true, true), 'menu' => 'boards', - 'title' => $projects[$project_id] + 'title' => $projects[$project_id], + 'board_selector' => array(t('Display another project')) + $projects, ))); } diff --git a/app/Locales/de_DE/translations.php b/app/Locales/de_DE/translations.php index fafb42ce..48c7ee16 100644 --- a/app/Locales/de_DE/translations.php +++ b/app/Locales/de_DE/translations.php @@ -375,4 +375,5 @@ return array( // 'Sub-task added successfully.' => '', // 'Maximum size: ' => '', // 'Unable to upload the file.' => '', + // 'Display another project' => '', ); diff --git a/app/Locales/es_ES/translations.php b/app/Locales/es_ES/translations.php index b46cdcf0..6319fd53 100644 --- a/app/Locales/es_ES/translations.php +++ b/app/Locales/es_ES/translations.php @@ -373,4 +373,5 @@ return array( // 'Sub-task added successfully.' => '', // 'Maximum size: ' => '', // 'Unable to upload the file.' => '', + // 'Display another project' => '', ); diff --git a/app/Locales/fr_FR/translations.php b/app/Locales/fr_FR/translations.php index d8113f54..0f760dea 100644 --- a/app/Locales/fr_FR/translations.php +++ b/app/Locales/fr_FR/translations.php @@ -373,4 +373,5 @@ return array( 'Sub-task added successfully.' => 'Sous-tâche ajouté avec succès.', 'Maximum size: ' => 'Taille maximum : ', 'Unable to upload the file.' => 'Impossible de transférer le fichier.', + 'Display another project' => 'Afficher un autre projet', ); diff --git a/app/Locales/pl_PL/translations.php b/app/Locales/pl_PL/translations.php index d868b112..c055c421 100644 --- a/app/Locales/pl_PL/translations.php +++ b/app/Locales/pl_PL/translations.php @@ -378,4 +378,5 @@ return array( // 'Sub-task added successfully.' => '', // 'Maximum size: ' => '', // 'Unable to upload the file.' => '', + // 'Display another project' => '', ); diff --git a/app/Locales/pt_BR/translations.php b/app/Locales/pt_BR/translations.php index 9966340a..c0f7b76c 100644 --- a/app/Locales/pt_BR/translations.php +++ b/app/Locales/pt_BR/translations.php @@ -374,4 +374,5 @@ return array( // 'Sub-task added successfully.' => '', // 'Maximum size: ' => '', // 'Unable to upload the file.' => '', + // 'Display another project' => '', ); diff --git a/app/Locales/zh_CN/translations.php b/app/Locales/zh_CN/translations.php index 23ca6ba0..2144fcef 100644 --- a/app/Locales/zh_CN/translations.php +++ b/app/Locales/zh_CN/translations.php @@ -354,4 +354,32 @@ return array( 'Add a comment' => '添加一个注释', 'Edit a comment' => '修改一个注释', 'Summary' => '概要', + // 'Time tracking' => '', + // 'Estimate:' => '', + // 'Spent:' => '', + // 'Do you really want to remove this sub-task?' => '', + // 'Remaining:' => '', + // 'hours' => '', + // 'spent' => '', + // 'estimated' => '', + // 'Sub-Tasks' => '', + // 'Add a sub-task' => '', + // 'Original Estimate' => '', + // 'Create another sub-task' => '', + // 'Time Spent' => '', + // 'Edit a sub-task' => '', + // 'Remove a sub-task' => '', + // 'The time must be a numeric value' => '', + // 'Todo' => '', + // 'In progress' => '', + // 'Done' => '', + // 'Sub-task removed successfully.' => '', + // 'Unable to remove this sub-task.' => '', + // 'Sub-task updated successfully.' => '', + // 'Unable to update your sub-task.' => '', + // 'Unable to create your sub-task.' => '', + // 'Sub-task added successfully.' => '', + // 'Maximum size: ' => '', + // 'Unable to upload the file.' => '', + // 'Display another project' => '', ); diff --git a/app/Model/Project.php b/app/Model/Project.php index b5716a81..51a23967 100644 --- a/app/Model/Project.php +++ b/app/Model/Project.php @@ -319,7 +319,7 @@ class Project extends Base * Get a list of project by status * * @access public - * @param integer $status Proejct status: self::ACTIVE or self:INACTIVE + * @param integer $status Project status: self::ACTIVE or self:INACTIVE * @return array */ public function getListByStatus($status) @@ -347,7 +347,7 @@ class Project extends Base } /** - * Return a list of projects for a given user + * Filter a list of projects for a given user * * @access public * @param array $projects Project list: ['project_id' => 'project_name'] @@ -365,6 +365,18 @@ class Project extends Base return $projects; } + /** + * Return a list of projects for a given user + * + * @access public + * @param integer $user_id User id + * @return array + */ + public function getAvailableList($user_id) + { + return $this->filterListByAccess($this->getListByStatus(self::ACTIVE), $user_id); + } + /** * Create a project * diff --git a/app/Templates/board_index.php b/app/Templates/board_index.php index 38fb985c..4b9b107c 100644 --- a/app/Templates/board_index.php +++ b/app/Templates/board_index.php @@ -4,15 +4,6 @@

-
diff --git a/app/Templates/layout.php b/app/Templates/layout.php index 62377588..b45ddb96 100644 --- a/app/Templates/layout.php +++ b/app/Templates/layout.php @@ -31,8 +31,14 @@