Add users and categories filters on the board
This commit is contained in:
@@ -50,6 +50,8 @@ class Board extends Base
|
|||||||
$params = $this->getProjectFilters('board', 'show');
|
$params = $this->getProjectFilters('board', 'show');
|
||||||
|
|
||||||
$this->response->html($this->template->layout('board/private_view', array(
|
$this->response->html($this->template->layout('board/private_view', array(
|
||||||
|
'categories_list' => $this->category->getList($params['project']['id'], false),
|
||||||
|
'users_list' => $this->projectPermission->getMemberList($params['project']['id'], false),
|
||||||
'swimlanes' => $this->taskFilter->search($params['filters']['search'])->getBoard($params['project']['id']),
|
'swimlanes' => $this->taskFilter->search($params['filters']['search'])->getBoard($params['project']['id']),
|
||||||
'description' => $params['project']['description'],
|
'description' => $params['project']['description'],
|
||||||
'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'),
|
'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'),
|
||||||
@@ -116,6 +118,29 @@ class Board extends Base
|
|||||||
$this->response->html($this->renderBoard($project_id));
|
$this->response->html($this->renderBoard($project_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reload the board with new filters
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public function reload()
|
||||||
|
{
|
||||||
|
if (! $this->request->isAjax()) {
|
||||||
|
return $this->response->status(403);
|
||||||
|
}
|
||||||
|
|
||||||
|
$project_id = $this->request->getIntegerParam('project_id');
|
||||||
|
|
||||||
|
if (! $this->projectPermission->isUserAllowed($project_id, $this->userSession->getId())) {
|
||||||
|
$this->response->text('Forbidden', 403);
|
||||||
|
}
|
||||||
|
|
||||||
|
$values = $this->request->getJson();
|
||||||
|
$this->userSession->setFilters($project_id, $values['search']);
|
||||||
|
|
||||||
|
$this->response->html($this->renderBoard($project_id));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get links on mouseover
|
* Get links on mouseover
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
<?= $this->render('project/filters', array(
|
<?= $this->render('project/filters', array(
|
||||||
'project' => $project,
|
'project' => $project,
|
||||||
'filters' => $filters,
|
'filters' => $filters,
|
||||||
|
'categories_list' => $categories_list,
|
||||||
|
'users_list' => $users_list,
|
||||||
'is_board' => true,
|
'is_board' => true,
|
||||||
)) ?>
|
)) ?>
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
data-project-id="<?= $project['id'] ?>"
|
data-project-id="<?= $project['id'] ?>"
|
||||||
data-check-interval="<?= $board_private_refresh_interval ?>"
|
data-check-interval="<?= $board_private_refresh_interval ?>"
|
||||||
data-save-url="<?= $this->url->href('board', 'save', array('project_id' => $project['id'])) ?>"
|
data-save-url="<?= $this->url->href('board', 'save', array('project_id' => $project['id'])) ?>"
|
||||||
|
data-reload-url="<?= $this->url->href('board', 'reload', array('project_id' => $project['id'])) ?>"
|
||||||
data-check-url="<?= $this->url->href('board', 'check', array('project_id' => $project['id'], 'timestamp' => time())) ?>"
|
data-check-url="<?= $this->url->href('board', 'check', array('project_id' => $project['id'], 'timestamp' => time())) ?>"
|
||||||
data-task-creation-url="<?= $this->url->href('taskcreation', 'create', array('project_id' => $project['id'])) ?>"
|
data-task-creation-url="<?= $this->url->href('taskcreation', 'create', array('project_id' => $project['id'])) ?>"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -46,4 +46,30 @@
|
|||||||
<?= $this->form->text('search', $filters, array(), array('placeholder="'.t('Filter').'"'), 'form-input-large') ?>
|
<?= $this->form->text('search', $filters, array(), array('placeholder="'.t('Filter').'"'), 'form-input-large') ?>
|
||||||
</form>
|
</form>
|
||||||
<?= $this->render('app/filters_helper', array('reset' => 'status:open')) ?>
|
<?= $this->render('app/filters_helper', array('reset' => 'status:open')) ?>
|
||||||
|
|
||||||
|
<?php if (isset($users_list)): ?>
|
||||||
|
<div class="dropdown filters">
|
||||||
|
<i class="fa fa-caret-down"></i> <a href="#" class="dropdown-menu"><?= t('Users') ?></a>
|
||||||
|
<ul>
|
||||||
|
<li><a href="#" class="filter-helper" data-filter="status:open"><?= t('All users') ?></a></li>
|
||||||
|
<li><a href="#" class="filter-helper" data-filter="status:open assignee:nobody"><?= t('Not assigned') ?></a></li>
|
||||||
|
<?php foreach ($users_list as $user): ?>
|
||||||
|
<li><a href="#" class="filter-helper" data-filter='status:open assignee:"<?= $this->e($user) ?>"'><?= $this->e($user) ?></a></li>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<?php endif ?>
|
||||||
|
|
||||||
|
<?php if (isset($categories_list) && ! empty($categories_list)): ?>
|
||||||
|
<div class="dropdown filters">
|
||||||
|
<i class="fa fa-caret-down"></i> <a href="#" class="dropdown-menu"><?= t('Categories') ?></a>
|
||||||
|
<ul>
|
||||||
|
<li><a href="#" class="filter-helper" data-filter="status:open"><?= t('All categories') ?></a></li>
|
||||||
|
<li><a href="#" class="filter-helper" data-filter="status:open category:none"><?= t('No category') ?></a></li>
|
||||||
|
<?php foreach ($categories_list as $category): ?>
|
||||||
|
<li><a href="#" class="filter-helper" data-filter='status:open category:"<?= $this->e($category) ?>"'><?= $this->e($category) ?></a></li>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<?php endif ?>
|
||||||
</div>
|
</div>
|
||||||
File diff suppressed because one or more lines are too long
@@ -1,7 +1,8 @@
|
|||||||
function App() {
|
function App() {
|
||||||
|
this.board = new Board(this);
|
||||||
this.markdown = new Markdown();
|
this.markdown = new Markdown();
|
||||||
this.sidebar = new Sidebar();
|
this.sidebar = new Sidebar();
|
||||||
this.search = new Search();
|
this.search = new Search(this);
|
||||||
this.swimlane = new Swimlane();
|
this.swimlane = new Swimlane();
|
||||||
this.dropdown = new Dropdown();
|
this.dropdown = new Dropdown();
|
||||||
this.tooltip = new Tooltip(this);
|
this.tooltip = new Tooltip(this);
|
||||||
|
|||||||
@@ -25,6 +25,23 @@ Board.prototype.poll = function() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Board.prototype.reloadFilters = function(search) {
|
||||||
|
this.app.showLoadingIcon();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
cache: false,
|
||||||
|
url: $("#board").data("reload-url"),
|
||||||
|
contentType: "application/json",
|
||||||
|
type: "POST",
|
||||||
|
processData: false,
|
||||||
|
data: JSON.stringify({
|
||||||
|
search: search
|
||||||
|
}),
|
||||||
|
success: this.refresh.bind(this),
|
||||||
|
error: this.app.hideLoadingIcon.bind(this)
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
Board.prototype.check = function() {
|
Board.prototype.check = function() {
|
||||||
if (this.app.isVisible()) {
|
if (this.app.isVisible()) {
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
function Search() {
|
function Search(app) {
|
||||||
|
this.app = app;
|
||||||
this.keyboardShortcuts();
|
this.keyboardShortcuts();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -12,11 +13,21 @@ Search.prototype.focus = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Search.prototype.listen = function() {
|
Search.prototype.listen = function() {
|
||||||
|
var self = this;
|
||||||
|
|
||||||
// Filter helper for search
|
// Filter helper for search
|
||||||
$(document).on("click", ".filter-helper", function (e) {
|
$(document).on("click", ".filter-helper", function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$("#form-search").val($(this).data("filter"));
|
var filter = $(this).data("filter");
|
||||||
|
|
||||||
|
$("#form-search").val(filter);
|
||||||
|
|
||||||
|
if ($('#board').length) {
|
||||||
|
self.app.board.reloadFilters(filter);
|
||||||
|
}
|
||||||
|
else {
|
||||||
$("form.search").submit();
|
$("form.search").submit();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user