summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/components/sidebar/sidebarFilters.jade15
-rw-r--r--client/components/sidebar/sidebarFilters.js5
-rw-r--r--client/lib/filter.js17
-rw-r--r--i18n/en.i18n.json1
4 files changed, 35 insertions, 3 deletions
diff --git a/client/components/sidebar/sidebarFilters.jade b/client/components/sidebar/sidebarFilters.jade
index 273df8c2..5f9fcf72 100644
--- a/client/components/sidebar/sidebarFilters.jade
+++ b/client/components/sidebar/sidebarFilters.jade
@@ -40,6 +40,21 @@ template(name="filterSidebar")
| (<span class="username">{{ username }}</span>)
if Filter.members.isSelected _id
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
hr
a.sidebar-btn.js-clear-all
diff --git a/client/components/sidebar/sidebarFilters.js b/client/components/sidebar/sidebarFilters.js
index f02d3a4a..ba2633de 100644
--- a/client/components/sidebar/sidebarFilters.js
+++ b/client/components/sidebar/sidebarFilters.js
@@ -11,6 +11,11 @@ BlazeComponent.extendComponent({
Filter.members.toggle(this.currentData()._id);
Filter.resetExceptions();
},
+ 'click .js-toggle-custom-fields-filter'(evt) {
+ evt.preventDefault();
+ Filter.customFields.toggle(this.currentData()._id);
+ Filter.resetExceptions();
+ },
'click .js-clear-all'(evt) {
evt.preventDefault();
Filter.reset();
diff --git a/client/lib/filter.js b/client/lib/filter.js
index 8129776b..f68c9711 100644
--- a/client/lib/filter.js
+++ b/client/lib/filter.js
@@ -10,10 +10,13 @@ function showFilterSidebar() {
// Use a "set" filter for a field that is a set of documents uniquely
// 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 {
- constructor() {
+ constructor(subField = '') {
this._dep = new Tracker.Dependency();
this._selectedElements = [];
+ this.subField = subField;
}
isSelected(val) {
@@ -86,8 +89,9 @@ Filter = {
// before changing the schema.
labelIds: 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
// implement this we keep the id of these cards in this `_exceptions` fields
@@ -111,7 +115,14 @@ Filter = {
this._fields.forEach((fieldName) => {
const filter = this[fieldName];
if (filter._isActive()) {
- filterSelector[fieldName] = filter._getMongoSelector();
+ if (filter.subField !== '')
+ {
+ filterSelector[`${fieldName}.${filter.subField}`] = filter._getMongoSelector();
+ }
+ else
+ {
+ filterSelector[fieldName] = filter._getMongoSelector();
+ }
emptySelector[fieldName] = filter._getEmptySelector();
if (emptySelector[fieldName] !== null) {
includeEmptySelectors = true;
diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json
index 6006a078..e2d6ddce 100644
--- a/i18n/en.i18n.json
+++ b/i18n/en.i18n.json
@@ -242,6 +242,7 @@
"filter-clear": "Clear filter",
"filter-no-label": "No label",
"filter-no-member": "No member",
+ "filter-no-custom-fields": "No Custom Fields",
"filter-on": "Filter is on",
"filter-on-desc": "You are filtering cards on this board. Click here to edit filter.",
"filter-to-selection": "Filter to selection",