mirror of
https://github.com/wekan/wekan.git
synced 2025-04-22 04:57:07 -04:00
Merge pull request #4108 from Ben0it-T/master
Try to fix : Filter List by Title - Hide empty lists in Swimlane view
This commit is contained in:
commit
21de4a2ca0
5 changed files with 46 additions and 11 deletions
|
@ -4,7 +4,9 @@
|
|||
and #each x in y constructors to fix this.
|
||||
|
||||
template(name="filterSidebar")
|
||||
h3 {{_ 'list-filter-label'}}
|
||||
h3
|
||||
i.fa.fa-trello
|
||||
| {{_ 'list-filter-label'}}
|
||||
ul.sidebar-list
|
||||
form.js-list-filter
|
||||
input(type="text")
|
||||
|
|
|
@ -14,7 +14,8 @@ template(name="swimlane")
|
|||
+addListForm
|
||||
else
|
||||
each lists
|
||||
+list(this)
|
||||
if visible this
|
||||
+list(this)
|
||||
if currentCardIsInThisList _id ../_id
|
||||
+cardDetails(currentCard)
|
||||
if currentUser.isBoardMember
|
||||
|
|
|
@ -137,19 +137,38 @@ BlazeComponent.extendComponent({
|
|||
this._isDragging = false;
|
||||
this._lastDragPositionX = 0;
|
||||
},
|
||||
|
||||
id() {
|
||||
return this._id;
|
||||
},
|
||||
|
||||
currentCardIsInThisList(listId, swimlaneId) {
|
||||
return currentCardIsInThisList(listId, swimlaneId);
|
||||
},
|
||||
|
||||
currentListIsInThisSwimlane(swimlaneId) {
|
||||
return currentListIsInThisSwimlane(swimlaneId);
|
||||
},
|
||||
|
||||
visible(list) {
|
||||
if (list.archived) {
|
||||
// Show archived list only when filter archive is on or archive is selected
|
||||
if (!(Filter.archive.isSelected() || archivedRequested)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (Filter.lists._isActive()) {
|
||||
if (!list.title.match(Filter.lists.getRegexSelector())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (Filter.hideEmpty.isSelected()) {
|
||||
const swimlaneId = this.parentComponent()
|
||||
.parentComponent()
|
||||
.data()._id;
|
||||
const cards = list.cards(swimlaneId);
|
||||
if (cards.count() === 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
},
|
||||
events() {
|
||||
return [
|
||||
{
|
||||
|
|
|
@ -682,9 +682,11 @@ Filter = {
|
|||
const filterSelector = {};
|
||||
const emptySelector = {};
|
||||
let includeEmptySelectors = false;
|
||||
let isFilterActive = false; // we don't want there is only Filter.lists
|
||||
this._fields.forEach(fieldName => {
|
||||
const filter = this[fieldName];
|
||||
if (filter._isActive()) {
|
||||
isFilterActive = true;
|
||||
if (filter.subField !== '') {
|
||||
filterSelector[
|
||||
`${fieldName}.${filter.subField}`
|
||||
|
@ -715,12 +717,23 @@ Filter = {
|
|||
)
|
||||
selectors.push(filterSelector);
|
||||
if (includeEmptySelectors) selectors.push(emptySelector);
|
||||
if (this.advanced._isActive())
|
||||
if (this.advanced._isActive()) {
|
||||
isFilterActive = true;
|
||||
selectors.push(this.advanced._getMongoSelector());
|
||||
}
|
||||
|
||||
return {
|
||||
$or: selectors,
|
||||
};
|
||||
if(isFilterActive) {
|
||||
return {
|
||||
$or: selectors,
|
||||
};
|
||||
}
|
||||
else {
|
||||
// we don't want there is only Filter.lists
|
||||
// otherwise no card will be displayed ...
|
||||
// selectors = [exceptionsSelector];
|
||||
// will return [{"_id":{"$in":[]}}]
|
||||
return {};
|
||||
}
|
||||
},
|
||||
|
||||
mongoSelector(additionalSelector) {
|
||||
|
|
|
@ -220,7 +220,7 @@ Swimlanes.helpers({
|
|||
{
|
||||
boardId: this.boardId,
|
||||
swimlaneId: { $in: [this._id, ''] },
|
||||
archived: false,
|
||||
//archived: false,
|
||||
},
|
||||
{ sort: ['sort'] },
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue