mirror of
https://github.com/wekan/wekan.git
synced 2025-12-17 07:50:12 +01:00
Merge branch 'feature-custom-fields-filter' of https://github.com/feuerball11/wekan into feuerball11-feature-custom-fields-filter
This commit is contained in:
commit
7dfec58128
4 changed files with 35 additions and 3 deletions
|
|
@ -40,6 +40,21 @@ template(name="filterSidebar")
|
||||||
| (<span class="username">{{ username }}</span>)
|
| (<span class="username">{{ username }}</span>)
|
||||||
if Filter.members.isSelected _id
|
if Filter.members.isSelected _id
|
||||||
i.fa.fa-check
|
i.fa.fa-check
|
||||||
|
hr
|
||||||
|
ul.sidebar-list
|
||||||
|
li(class="{{#if Filter.customFields.isSelected undefined}}active{{/if}}")
|
||||||
|
a.name.js-toggle-custom-fields-filter
|
||||||
|
span.sidebar-list-item-description
|
||||||
|
| {{_ 'filter-no-custom-fields'}}
|
||||||
|
if Filter.customFields.isSelected undefined
|
||||||
|
i.fa.fa-check
|
||||||
|
each currentBoard.customFields
|
||||||
|
li(class="{{#if Filter.customFields.isSelected _id}}active{{/if}}")
|
||||||
|
a.name.js-toggle-custom-fields-filter
|
||||||
|
span.sidebar-list-item-description
|
||||||
|
{{ name }}
|
||||||
|
if Filter.customFields.isSelected _id
|
||||||
|
i.fa.fa-check
|
||||||
if Filter.isActive
|
if Filter.isActive
|
||||||
hr
|
hr
|
||||||
a.sidebar-btn.js-clear-all
|
a.sidebar-btn.js-clear-all
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,11 @@ BlazeComponent.extendComponent({
|
||||||
Filter.members.toggle(this.currentData()._id);
|
Filter.members.toggle(this.currentData()._id);
|
||||||
Filter.resetExceptions();
|
Filter.resetExceptions();
|
||||||
},
|
},
|
||||||
|
'click .js-toggle-custom-fields-filter'(evt) {
|
||||||
|
evt.preventDefault();
|
||||||
|
Filter.customFields.toggle(this.currentData()._id);
|
||||||
|
Filter.resetExceptions();
|
||||||
|
},
|
||||||
'click .js-clear-all'(evt) {
|
'click .js-clear-all'(evt) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
Filter.reset();
|
Filter.reset();
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,13 @@ function showFilterSidebar() {
|
||||||
|
|
||||||
// Use a "set" filter for a field that is a set of documents uniquely
|
// Use a "set" filter for a field that is a set of documents uniquely
|
||||||
// identified. For instance `{ labels: ['labelA', 'labelC', 'labelD'] }`.
|
// identified. For instance `{ labels: ['labelA', 'labelC', 'labelD'] }`.
|
||||||
|
// use "subField" for searching inside object Fields.
|
||||||
|
// For instance '{ 'customFields._id': ['field1','field2']} (subField would be: _id)
|
||||||
class SetFilter {
|
class SetFilter {
|
||||||
constructor() {
|
constructor(subField = '') {
|
||||||
this._dep = new Tracker.Dependency();
|
this._dep = new Tracker.Dependency();
|
||||||
this._selectedElements = [];
|
this._selectedElements = [];
|
||||||
|
this.subField = subField;
|
||||||
}
|
}
|
||||||
|
|
||||||
isSelected(val) {
|
isSelected(val) {
|
||||||
|
|
@ -86,8 +89,9 @@ Filter = {
|
||||||
// before changing the schema.
|
// before changing the schema.
|
||||||
labelIds: new SetFilter(),
|
labelIds: new SetFilter(),
|
||||||
members: new SetFilter(),
|
members: new SetFilter(),
|
||||||
|
customFields: new SetFilter('_id'),
|
||||||
|
|
||||||
_fields: ['labelIds', 'members'],
|
_fields: ['labelIds', 'members', 'customFields'],
|
||||||
|
|
||||||
// We don't filter cards that have been added after the last filter change. To
|
// We don't filter cards that have been added after the last filter change. To
|
||||||
// implement this we keep the id of these cards in this `_exceptions` fields
|
// implement this we keep the id of these cards in this `_exceptions` fields
|
||||||
|
|
@ -111,7 +115,14 @@ Filter = {
|
||||||
this._fields.forEach((fieldName) => {
|
this._fields.forEach((fieldName) => {
|
||||||
const filter = this[fieldName];
|
const filter = this[fieldName];
|
||||||
if (filter._isActive()) {
|
if (filter._isActive()) {
|
||||||
|
if (filter.subField !== '')
|
||||||
|
{
|
||||||
|
filterSelector[`${fieldName}.${filter.subField}`] = filter._getMongoSelector();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
filterSelector[fieldName] = filter._getMongoSelector();
|
filterSelector[fieldName] = filter._getMongoSelector();
|
||||||
|
}
|
||||||
emptySelector[fieldName] = filter._getEmptySelector();
|
emptySelector[fieldName] = filter._getEmptySelector();
|
||||||
if (emptySelector[fieldName] !== null) {
|
if (emptySelector[fieldName] !== null) {
|
||||||
includeEmptySelectors = true;
|
includeEmptySelectors = true;
|
||||||
|
|
|
||||||
|
|
@ -242,6 +242,7 @@
|
||||||
"filter-clear": "Clear filter",
|
"filter-clear": "Clear filter",
|
||||||
"filter-no-label": "No label",
|
"filter-no-label": "No label",
|
||||||
"filter-no-member": "No member",
|
"filter-no-member": "No member",
|
||||||
|
"filter-no-custom-fields": "No Custom Fields",
|
||||||
"filter-on": "Filter is on",
|
"filter-on": "Filter is on",
|
||||||
"filter-on-desc": "You are filtering cards on this board. Click here to edit filter.",
|
"filter-on-desc": "You are filtering cards on this board. Click here to edit filter.",
|
||||||
"filter-to-selection": "Filter to selection",
|
"filter-to-selection": "Filter to selection",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue