summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-06-20 21:59:59 -0300
committerFrédéric Guillot <fred@kanboard.net>2014-06-20 21:59:59 -0300
commitb513313c2fbfb0e5f15cab97ea74929b5c0d0a60 (patch)
treef96d6022f88fc22fc82f85e68a57eddafb423d39
parent08621f99e6333c5e218724d173654bf225586d59 (diff)
Add a board selector instead of the list of projects
-rw-r--r--app/Controller/Board.php9
-rw-r--r--app/Locales/de_DE/translations.php1
-rw-r--r--app/Locales/es_ES/translations.php1
-rw-r--r--app/Locales/fr_FR/translations.php1
-rw-r--r--app/Locales/pl_PL/translations.php1
-rw-r--r--app/Locales/pt_BR/translations.php1
-rw-r--r--app/Locales/zh_CN/translations.php28
-rw-r--r--app/Model/Project.php16
-rw-r--r--app/Templates/board_index.php9
-rw-r--r--app/Templates/layout.php8
-rw-r--r--assets/css/app.css2
-rw-r--r--assets/js/board.js4
12 files changed, 62 insertions, 19 deletions
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']
@@ -366,6 +366,18 @@ class Project extends Base
}
/**
+ * 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
*
* @access public
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 @@
<h2>
<?= t('Project "%s"', $current_project_name) ?>
</h2>
- <ul>
- <?php foreach ($projects as $project_id => $project_name): ?>
- <?php if ($project_id != $current_project_id): ?>
- <li>
- <a href="?controller=board&amp;action=show&amp;project_id=<?= $project_id ?>"><?= Helper\escape($project_name) ?></a>
- </li>
- <?php endif ?>
- <?php endforeach ?>
- </ul>
</div>
<div class="project-menu">
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 @@
<?php else: ?>
<header>
<nav>
- <a class="logo" href="?">kan<span>board</span></a>
+ <a class="logo" href="?">kanboard</a>
+
<ul>
+ <?php if (isset($board_selector)): ?>
+ <li>
+ <?= Helper\form_select('board-selector', $board_selector) ?>
+ </li>
+ <?php endif ?>
<li <?= isset($menu) && $menu === 'boards' ? 'class="active"' : '' ?>>
<a href="?controller=board"><?= t('Boards') ?></a>
</li>
diff --git a/assets/css/app.css b/assets/css/app.css
index f98a7b16..60d37abc 100644
--- a/assets/css/app.css
+++ b/assets/css/app.css
@@ -485,7 +485,7 @@ nav .active a {
/* board */
.page-header.board {
- margin-bottom: 0;
+ margin-bottom: 5px;
}
.project-menu li {
diff --git a/assets/js/board.js b/assets/js/board.js
index 7ff7445b..fb6413ab 100644
--- a/assets/js/board.js
+++ b/assets/js/board.js
@@ -190,6 +190,10 @@
$(function() {
board_load_events();
filter_load_events();
+
+ $("#form-board-selector").change(function() {
+ window.location = "?controller=board&action=show&project_id=" + $(this).val();
+ });
});
}());