Browse Source

Merge branch 'feuerball11-feature-custom-fields-filter' into devel

Lauri Ojansivu 7 years ago
parent
commit
38ab2b766d

+ 9 - 0
CHANGELOG.md

@@ -1,3 +1,12 @@
+# Upcoming Wekan release
+
+This release adds the following new features:
+
+* [Filtering by Custom Field](https://github.com/wekan/wekan/pull/1645);
+* Update to NPM 6.0.1 and MongoDB 3.2.20.
+
+Thanks to GitHub users feuerball11 and xet7 for their contributions.
+
 # v0.97 2018-05-19 Wekan release
 
 Updated translations.

+ 1 - 1
Dockerfile

@@ -19,7 +19,7 @@ ENV NODE_VERSION ${NODE_VERSION:-v8.11.1}
 ENV METEOR_RELEASE ${METEOR_RELEASE:-1.6.0.1}
 ENV USE_EDGE ${USE_EDGE:-false}
 ENV METEOR_EDGE ${METEOR_EDGE:-1.5-beta.17}
-ENV NPM_VERSION ${NPM_VERSION:-5.5.1}
+ENV NPM_VERSION ${NPM_VERSION:-6.0.1}
 ENV FIBERS_VERSION ${FIBERS_VERSION:-2.0.0}
 ENV ARCHITECTURE ${ARCHITECTURE:-linux-x64}
 ENV SRC_PATH ${SRC_PATH:-./}

+ 15 - 0
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

+ 5 - 0
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();

+ 14 - 3
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;

+ 1 - 0
i18n/en-GB.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",

+ 1 - 0
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",

+ 1 - 0
i18n/fi.i18n.json

@@ -242,6 +242,7 @@
     "filter-clear": "Poista suodatin",
     "filter-no-label": "Ei tunnistetta",
     "filter-no-member": "Ei jäseniä",
+    "filter-no-custom-fields": "Ei mukautettuja kenttiä",
     "filter-on": "Suodatus on päällä",
     "filter-on-desc": "Suodatat kortteja tällä taululla. Klikkaa tästä muokataksesi suodatinta.",
     "filter-to-selection": "Suodata valintaan",

+ 1 - 1
snapcraft.yaml

@@ -83,7 +83,7 @@ parts:
         plugin: nodejs
         node-engine: 8.11.1
         node-packages:
-            - npm@5.5.1
+            - npm@6.0.1
             - node-gyp
             - node-pre-gyp
             - fibers@2.0.0