Category and user filters do not append anymore in search field
This commit is contained in:
parent
f74d7ef209
commit
36bdcf193b
|
|
@ -10,6 +10,7 @@ New features:
|
|||
|
||||
Improvements:
|
||||
|
||||
* Category and user filters do not append anymore in search field
|
||||
* Added more template hooks
|
||||
* Added tasks search with the API
|
||||
* Added priority field to API procedures
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@
|
|||
<div class="dropdown">
|
||||
<a href="#" class="dropdown-menu dropdown-menu-link-icon" title="<?= t('User filters') ?>"><i class="fa fa-users fa-fw"></i> <i class="fa fa-caret-down"></i></a>
|
||||
<ul>
|
||||
<li><a href="#" class="filter-helper" data-append-filter="assignee:nobody"><?= t('Not assigned') ?></a></li>
|
||||
<li><a href="#" class="filter-helper" data-unique-filter="assignee:nobody"><?= t('Not assigned') ?></a></li>
|
||||
<?php foreach ($users_list as $user): ?>
|
||||
<li><a href="#" class="filter-helper" data-append-filter='assignee:"<?= $this->text->e($user) ?>"'><?= $this->text->e($user) ?></a></li>
|
||||
<li><a href="#" class="filter-helper" data-unique-filter='assignee:"<?= $this->text->e($user) ?>"'><?= $this->text->e($user) ?></a></li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
@ -34,9 +34,9 @@
|
|||
<div class="dropdown">
|
||||
<a href="#" class="dropdown-menu dropdown-menu-link-icon" title="<?= t('Category filters') ?>"><i class="fa fa-tags fa-fw"></i><i class="fa fa-caret-down"></i></a>
|
||||
<ul>
|
||||
<li><a href="#" class="filter-helper" data-append-filter="category:none"><?= t('No category') ?></a></li>
|
||||
<li><a href="#" class="filter-helper" data-unique-filter="category:none"><?= t('No category') ?></a></li>
|
||||
<?php foreach ($categories_list as $category): ?>
|
||||
<li><a href="#" class="filter-helper" data-append-filter='category:"<?= $this->text->e($category) ?>"'><?= $this->text->e($category) ?></a></li>
|
||||
<li><a href="#" class="filter-helper" data-unique-filter='category:"<?= $this->text->e($category) ?>"'><?= $this->text->e($category) ?></a></li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -16,15 +16,21 @@ Kanboard.Search.prototype.focus = function() {
|
|||
};
|
||||
|
||||
Kanboard.Search.prototype.listen = function() {
|
||||
// Filter helper for search
|
||||
$(document).on("click", ".filter-helper", function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var filter = $(this).data("filter");
|
||||
var appendFilter = $(this).data("append-filter");
|
||||
var uniqueFilter = $(this).data("unique-filter");
|
||||
var input = $("#form-search");
|
||||
|
||||
if (appendFilter) {
|
||||
if (uniqueFilter) {
|
||||
var attribute = uniqueFilter.substr(0, uniqueFilter.indexOf(':'));
|
||||
filter = input.val().replace(new RegExp('(' + attribute + ':[#a-z0-9]+)', 'g'), '');
|
||||
filter = filter.replace(new RegExp('(' + attribute + ':"(.+)")', 'g'), '');
|
||||
filter = filter.trim();
|
||||
filter += ' ' + uniqueFilter;
|
||||
} else if (appendFilter) {
|
||||
filter = input.val() + " " + appendFilter;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue