Add a board selector instead of the list of projects
This commit is contained in:
parent
08621f99e6
commit
b513313c2f
|
|
@ -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,
|
||||
)));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -375,4 +375,5 @@ return array(
|
|||
// 'Sub-task added successfully.' => '',
|
||||
// 'Maximum size: ' => '',
|
||||
// 'Unable to upload the file.' => '',
|
||||
// 'Display another project' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -373,4 +373,5 @@ return array(
|
|||
// 'Sub-task added successfully.' => '',
|
||||
// 'Maximum size: ' => '',
|
||||
// 'Unable to upload the file.' => '',
|
||||
// 'Display another project' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -378,4 +378,5 @@ return array(
|
|||
// 'Sub-task added successfully.' => '',
|
||||
// 'Maximum size: ' => '',
|
||||
// 'Unable to upload the file.' => '',
|
||||
// 'Display another project' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -374,4 +374,5 @@ return array(
|
|||
// 'Sub-task added successfully.' => '',
|
||||
// 'Maximum size: ' => '',
|
||||
// 'Unable to upload the file.' => '',
|
||||
// 'Display another project' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -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' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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&action=show&project_id=<?= $project_id ?>"><?= Helper\escape($project_name) ?></a>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="project-menu">
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -485,7 +485,7 @@ nav .active a {
|
|||
|
||||
/* board */
|
||||
.page-header.board {
|
||||
margin-bottom: 0;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.project-menu li {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
}());
|
||||
|
|
|
|||
Loading…
Reference in New Issue